add role based access check

This commit is contained in:
Uwe Steinmann 2016-08-12 15:00:12 +02:00
parent 9a20306399
commit f2ffca8096

View File

@ -32,9 +32,10 @@ require_once("class.Bootstrap.php");
class SeedDMS_View_LogManagement extends SeedDMS_Bootstrap_Style { class SeedDMS_View_LogManagement extends SeedDMS_Bootstrap_Style {
function filelist($entries, $mode) { /* {{{ */ function filelist($entries, $mode) { /* {{{ */
$accessop = $this->params['accessobject'];
$print_header = true; $print_header = true;
foreach ($entries as $entry){ foreach ($entries as $entry){
if ($print_header){ if ($print_header){
print "<form action=\"out.RemoveLog.php\" method=\"get\">\n"; print "<form action=\"out.RemoveLog.php\" method=\"get\">\n";
print "<table class=\"table-condensed\">\n"; print "<table class=\"table-condensed\">\n";
@ -47,7 +48,7 @@ class SeedDMS_View_LogManagement extends SeedDMS_Bootstrap_Style {
print "</tr>\n</thead>\n<tbody>\n"; print "</tr>\n</thead>\n<tbody>\n";
$print_header=false; $print_header=false;
} }
print "<tr>\n"; print "<tr>\n";
print "<td><input type=\"checkbox\" name=\"logname[]\" value=\"".$entry."\"/></td>\n"; print "<td><input type=\"checkbox\" name=\"logname[]\" value=\"".$entry."\"/></td>\n";
print "<td><a href=\"out.LogManagement.php?logname=".$entry."\">".$entry."</a></td>\n"; print "<td><a href=\"out.LogManagement.php?logname=".$entry."\">".$entry."</a></td>\n";
@ -55,13 +56,17 @@ class SeedDMS_View_LogManagement extends SeedDMS_Bootstrap_Style {
print "<td>".getLongReadableDate(filectime($this->contentdir.$entry))."</td>\n"; print "<td>".getLongReadableDate(filectime($this->contentdir.$entry))."</td>\n";
print "<td>".SeedDMS_Core_File::format_filesize(filesize($this->contentdir.$entry))."</td>\n"; print "<td>".SeedDMS_Core_File::format_filesize(filesize($this->contentdir.$entry))."</td>\n";
print "<td>"; print "<td>";
print "<a href=\"out.RemoveLog.php?mode=".$mode."&logname=".$entry."\" class=\"btn btn-mini\"><i class=\"icon-remove\"></i> ".getMLText("rm_file")."</a>"; if($accessop->check_view_access('RemoveLog')) {
print "&nbsp;"; print "<a href=\"out.RemoveLog.php?mode=".$mode."&logname=".$entry."\" class=\"btn btn-mini\"><i class=\"icon-remove\"></i> ".getMLText("rm_file")."</a>";
print "<a href=\"../op/op.Download.php?logname=".$entry."\" class=\"btn btn-mini\"><i class=\"icon-download\"></i> ".getMLText("download")."</a>"; }
if($accessop->check_controller_access('Download', array('action'=>'log'))) {
print "&nbsp;";
print "<a href=\"../op/op.Download.php?logname=".$entry."\" class=\"btn btn-mini\"><i class=\"icon-download\"></i> ".getMLText("download")."</a>";
}
print "&nbsp;"; print "&nbsp;";
print "<a data-target=\"#logViewer\" data-cache=\"false\" href=\"out.LogManagement.php?logname=".$entry."\" role=\"button\" class=\"btn btn-mini\" data-toggle=\"modal\"><i class=\"icon-eye-open\"></i> ".getMLText('view')." …</a>"; print "<a data-target=\"#logViewer\" data-cache=\"false\" href=\"out.LogManagement.php?logname=".$entry."\" role=\"button\" class=\"btn btn-mini\" data-toggle=\"modal\"><i class=\"icon-eye-open\"></i> ".getMLText('view')." …</a>";
print "</td>\n"; print "</td>\n";
print "</tr>\n"; print "</tr>\n";
} }
@ -79,13 +84,14 @@ $(document).ready( function() {
$('input[type=checkbox]').prop('checked', true); $('input[type=checkbox]').prop('checked', true);
}); });
}); });
<?php <?php
} /* }}} */ } /* }}} */
function show() { /* {{{ */ function show() { /* {{{ */
$dms = $this->params['dms']; $dms = $this->params['dms'];
$user = $this->params['user']; $user = $this->params['user'];
$accessop = $this->params['accessobject'];
$this->contentdir = $this->params['contentdir']; $this->contentdir = $this->params['contentdir'];
$logname = $this->params['logname']; $logname = $this->params['logname'];
$mode = $this->params['mode']; $mode = $this->params['mode'];