add more role based access checks

This commit is contained in:
Uwe Steinmann 2016-08-12 12:43:21 +02:00
parent 504cfe6d3e
commit bf7a63bf5a

View File

@ -169,7 +169,7 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style {
$document = $this->params['document']; $document = $this->params['document'];
$accessop = $this->params['accessobject']; $accessop = $this->params['accessobject'];
if($accessop->check_controller_access('Download', array('action'=>'run'))) { if($accessop->check_controller_access('Download', array('action'=>'version'))) {
$latestContent = $document->getLatestContent(); $latestContent = $document->getLatestContent();
switch($latestContent->getMimeType()) { switch($latestContent->getMimeType()) {
case 'audio/mpeg': case 'audio/mpeg':
@ -480,7 +480,7 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style {
print "<a target=\"_blank\" href=\"../op/op.ViewOnline.php?documentid=".$documentid."&version=". $latestContent->getVersion()."\">"; print "<a target=\"_blank\" href=\"../op/op.ViewOnline.php?documentid=".$documentid."&version=". $latestContent->getVersion()."\">";
} }
} else { } else {
if($accessop->check_controller_access('Download', array('action'=>'run'))) { if($accessop->check_controller_access('Download', array('action'=>'version'))) {
print "<a href=\"../op/op.Download.php?documentid=".$documentid."&version=".$latestContent->getVersion()."\">"; print "<a href=\"../op/op.Download.php?documentid=".$documentid."&version=".$latestContent->getVersion()."\">";
} }
} }
@ -538,7 +538,7 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style {
print "<ul class=\"unstyled actions\">"; print "<ul class=\"unstyled actions\">";
if ($file_exists){ if ($file_exists){
if($accessop->check_controller_access('Download', array('action'=>'run'))) { if($accessop->check_controller_access('Download', array('action'=>'version'))) {
print "<li><a href=\"../op/op.Download.php?documentid=".$documentid."&version=".$latestContent->getVersion()."\"><i class=\"icon-download\"></i>".getMLText("download")."</a></li>"; print "<li><a href=\"../op/op.Download.php?documentid=".$documentid."&version=".$latestContent->getVersion()."\"><i class=\"icon-download\"></i>".getMLText("download")."</a></li>";
} }
if($accessop->check_controller_access('ViewOnline', array('action'=>'run'))) { if($accessop->check_controller_access('ViewOnline', array('action'=>'run'))) {
@ -1237,7 +1237,7 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style {
print "<a target=\"_blank\" href=\"../op/op.ViewOnline.php?documentid=".$documentid."&version=".$version->getVersion()."\">"; print "<a target=\"_blank\" href=\"../op/op.ViewOnline.php?documentid=".$documentid."&version=".$version->getVersion()."\">";
} }
} else { } else {
if($accessop->check_controller_access('Download', array('action'=>'run'))) { if($accessop->check_controller_access('Download', array('action'=>'version'))) {
print "<a href=\"../op/op.Download.php?documentid=".$documentid."&version=".$version->getVersion()."\">"; print "<a href=\"../op/op.Download.php?documentid=".$documentid."&version=".$version->getVersion()."\">";
} }
} }
@ -1283,7 +1283,7 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style {
print "<td>"; print "<td>";
print "<ul class=\"actions unstyled\">"; print "<ul class=\"actions unstyled\">";
if ($file_exists){ if ($file_exists){
if($accessop->check_controller_access('Download', array('action'=>'run'))) { if($accessop->check_controller_access('Download', array('action'=>'version'))) {
print "<li><a href=\"../op/op.Download.php?documentid=".$documentid."&version=".$version->getVersion()."\"><i class=\"icon-download\"></i>".getMLText("download")."</a>"; print "<li><a href=\"../op/op.Download.php?documentid=".$documentid."&version=".$version->getVersion()."\"><i class=\"icon-download\"></i>".getMLText("download")."</a>";
} }
if ($viewonlinefiletypes && in_array(strtolower($version->getFileType()), $viewonlinefiletypes)) if ($viewonlinefiletypes && in_array(strtolower($version->getFileType()), $viewonlinefiletypes))
@ -1346,7 +1346,7 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style {
print "<a target=\"_blank\" href=\"../op/op.ViewOnline.php?documentid=".$documentid."&file=". $file->getID()."\">"; print "<a target=\"_blank\" href=\"../op/op.ViewOnline.php?documentid=".$documentid."&file=". $file->getID()."\">";
} }
} else { } else {
if($accessop->check_controller_access('Download', array('action'=>'run'))) { if($accessop->check_controller_access('Download', array('action'=>'file'))) {
print "<a href=\"../op/op.Download.php?documentid=".$documentid."&file=".$file->getID()."\">"; print "<a href=\"../op/op.Download.php?documentid=".$documentid."&file=".$file->getID()."\">";
} }
} }
@ -1376,7 +1376,7 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style {
print "<td><ul class=\"unstyled actions\">"; print "<td><ul class=\"unstyled actions\">";
if ($file_exists) { if ($file_exists) {
if($accessop->check_controller_access('Download', array('action'=>'run'))) { if($accessop->check_controller_access('Download', array('action'=>'file'))) {
print "<li><a href=\"../op/op.Download.php?documentid=".$documentid."&file=".$file->getID()."\"><i class=\"icon-download\"></i>".getMLText('download')."</a></li>"; print "<li><a href=\"../op/op.Download.php?documentid=".$documentid."&file=".$file->getID()."\"><i class=\"icon-download\"></i>".getMLText('download')."</a></li>";
} }
if ($viewonlinefiletypes && in_array(strtolower($file->getFileType()), $viewonlinefiletypes)) { if ($viewonlinefiletypes && in_array(strtolower($file->getFileType()), $viewonlinefiletypes)) {
@ -1436,7 +1436,7 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style {
if(0){ if(0){
print "<tr>"; print "<tr>";
print "<td style=\"width:".$previewwidthdetail."px; text-align: center;\">"; print "<td style=\"width:".$previewwidthdetail."px; text-align: center;\">";
if($accessop->check_controller_access('Download', array('action'=>'run'))) if($accessop->check_controller_access('Download', array('action'=>'version')))
print "<a href=\"../op/op.Download.php?documentid=".$targetDoc->getID()."&version=".$targetlc->getVersion()."\">"; print "<a href=\"../op/op.Download.php?documentid=".$targetDoc->getID()."&version=".$targetlc->getVersion()."\">";
if($previewer->hasPreview($targetlc)) { if($previewer->hasPreview($targetlc)) {
print "<img class=\"mimeicon\" width=\"".$previewwidthdetail."\"src=\"../op/op.Preview.php?documentid=".$targetDoc->getID()."&version=".$targetlc->getVersion()."&width=".$previewwidthdetail."\" title=\"".htmlspecialchars($targetlc->getMimeType())."\">"; print "<img class=\"mimeicon\" width=\"".$previewwidthdetail."\"src=\"../op/op.Preview.php?documentid=".$targetDoc->getID()."&version=".$targetlc->getVersion()."&width=".$previewwidthdetail."\" title=\"".htmlspecialchars($targetlc->getMimeType())."\">";
@ -1513,7 +1513,7 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style {
$previewer->createPreview($sourcelc, $previewwidthdetail); $previewer->createPreview($sourcelc, $previewwidthdetail);
print "<tr>"; print "<tr>";
print "<td style=\"width:".$previewwidthdetail."px; text-align: center;\">"; print "<td style=\"width:".$previewwidthdetail."px; text-align: center;\">";
if($accessop->check_controller_access('Download', array('action'=>'run'))) if($accessop->check_controller_access('Download', array('action'=>'version')))
print "<a href=\"../op/op.Download.php?documentid=".$sourceDoc->getID()."&version=".$sourcelc->getVersion()."\">"; print "<a href=\"../op/op.Download.php?documentid=".$sourceDoc->getID()."&version=".$sourcelc->getVersion()."\">";
if($previewer->hasPreview($sourcelc)) { if($previewer->hasPreview($sourcelc)) {
print "<img class=\"mimeicon\" width=\"".$previewwidthdetail."\"src=\"../op/op.Preview.php?documentid=".$sourceDoc->getID()."&version=".$sourcelc->getVersion()."&width=".$previewwidthdetail."\" title=\"".htmlspecialchars($sourcelc->getMimeType())."\">"; print "<img class=\"mimeicon\" width=\"".$previewwidthdetail."\"src=\"../op/op.Preview.php?documentid=".$sourceDoc->getID()."&version=".$sourcelc->getVersion()."&width=".$previewwidthdetail."\" title=\"".htmlspecialchars($sourcelc->getMimeType())."\">";