replace check for guest by generic acl check

This commit is contained in:
Uwe Steinmann 2019-11-25 09:35:05 +01:00
parent 684f27ef87
commit 79aa6c079c

View File

@ -359,7 +359,7 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
echo " <li class=\"dropdown\">\n"; echo " <li class=\"dropdown\">\n";
echo " <a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\">".($this->params['session']->getSu() ? getMLText("switched_to") : getMLText("signed_in_as"))." '".htmlspecialchars($this->params['user']->getFullName())."' <i class=\"icon-caret-down\"></i></a>\n"; echo " <a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\">".($this->params['session']->getSu() ? getMLText("switched_to") : getMLText("signed_in_as"))." '".htmlspecialchars($this->params['user']->getFullName())."' <i class=\"icon-caret-down\"></i></a>\n";
echo " <ul class=\"dropdown-menu\" role=\"menu\">\n"; echo " <ul class=\"dropdown-menu\" role=\"menu\">\n";
if (!$this->params['user']->isGuest()) { // if (!$this->params['user']->isGuest()) {
$menuitems = array(); $menuitems = array();
if ($accessobject->check_view_access('MyDocuments')) if ($accessobject->check_view_access('MyDocuments'))
$menuitems['my_documents'] = array('link'=>"../out/out.MyDocuments.php", 'label'=>'my_documents'); $menuitems['my_documents'] = array('link'=>"../out/out.MyDocuments.php", 'label'=>'my_documents');
@ -379,7 +379,7 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
} }
echo " <li class=\"divider\"></li>\n"; echo " <li class=\"divider\"></li>\n";
} }
} // }
$showdivider = false; $showdivider = false;
if($this->params['enablelanguageselector']) { if($this->params['enablelanguageselector']) {
$showdivider = true; $showdivider = true;
@ -421,16 +421,18 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
echo " </li>\n"; echo " </li>\n";
echo " </ul>\n"; echo " </ul>\n";
if($this->params['enablemenutasks'] && !$this->params['user']->isGuest()) { if($this->params['enablemenutasks']) {
echo " <div id=\"menu-tasks\">"; if($accessobject->check_view_access('Tasks', array('action'=>'menuTasks'))) {
echo " <div class=\"ajax\" data-no-spinner=\"true\" data-view=\"Tasks\" data-action=\"menuTasks\"></div>"; echo " <div id=\"menu-tasks\">";
// echo " <ul id=\"main-menu-tasks\" class=\"nav pull-right\">\n"; echo " <div class=\"ajax\" data-no-spinner=\"true\" data-view=\"Tasks\" data-action=\"menuTasks\"></div>";
// echo " <li class=\"dropdown\">\n"; // echo " <ul id=\"main-menu-tasks\" class=\"nav pull-right\">\n";
// echo $this->menuTasks(array('review'=>array(), 'approval'=>array(), 'receipt'=>array(), 'revision'=>array())); // echo " <li class=\"dropdown\">\n";
// echo " </li>\n"; // echo $this->menuTasks(array('review'=>array(), 'approval'=>array(), 'receipt'=>array(), 'revision'=>array()));
// echo " </ul>\n"; // echo " </li>\n";
echo " </div>"; // echo " </ul>\n";
//$this->addFooterJS('checkTasks();'); echo " </div>";
//$this->addFooterJS('checkTasks();');
}
} }
if($this->params['dropfolderdir'] && $this->params['enabledropfolderlist']) { if($this->params['dropfolderdir'] && $this->params['enabledropfolderlist']) {
@ -587,7 +589,7 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
echo "<ul class=\"nav\">\n"; echo "<ul class=\"nav\">\n";
$menuitems = array(); $menuitems = array();
if ($accessMode == M_READ && !$this->params['user']->isGuest()) { if ($accessMode == M_READ) {
if ($accessobject->check_view_access('FolderNotify')) if ($accessobject->check_view_access('FolderNotify'))
$menuitems['edit_folder_notify'] = array('link'=>"../out/out.FolderNotify.php?folderid=".$folderID."&showtree=".showtree(), 'label'=>'edit_folder_notify'); $menuitems['edit_folder_notify'] = array('link'=>"../out/out.FolderNotify.php?folderid=".$folderID."&showtree=".showtree(), 'label'=>'edit_folder_notify');
} }
@ -611,7 +613,7 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
} }
$menuitems['edit_existing_notify'] = array('link'=>"../out/out.FolderNotify.php?folderid=". $folderID ."&showtree=". showtree(), 'label'=>'edit_existing_notify'); $menuitems['edit_existing_notify'] = array('link'=>"../out/out.FolderNotify.php?folderid=". $folderID ."&showtree=". showtree(), 'label'=>'edit_existing_notify');
} }
if ($this->params['user']->isAdmin() && $this->params['enablefullsearch']) { if ($accessobject->check_view_access('Indexer') && $this->params['enablefullsearch']) {
$menuitems['index_folder'] = array('link'=>"../out/out.Indexer.php?folderid=". $folderID."&showtree=".showtree(), 'label'=>'index_folder'); $menuitems['index_folder'] = array('link'=>"../out/out.Indexer.php?folderid=". $folderID."&showtree=".showtree(), 'label'=>'index_folder');
} }
@ -638,7 +640,8 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
if ($accessMode >= M_READWRITE) { if ($accessMode >= M_READWRITE) {
if (!$document->isLocked()) { if (!$document->isLocked()) {
$menuitems['update_document'] = array('link'=>"../out/out.UpdateDocument".$docid, 'label'=>'update_document'); $menuitems['update_document'] = array('link'=>"../out/out.UpdateDocument".$docid, 'label'=>'update_document');
$menuitems['lock_document'] = array('link'=>"../op/op.LockDocument".$docid, 'label'=>'lock_document'); if($accessobject->check_controller_access('LockDocument'))
$menuitems['lock_document'] = array('link'=>"../op/op.LockDocument".$docid, 'label'=>'lock_document');
if($document->isCheckedOut()) if($document->isCheckedOut())
$menuitems['checkin_document'] = array('link'=>"../out/out.CheckInDocument".$docid, 'label'=>'checkin_document'); $menuitems['checkin_document'] = array('link'=>"../out/out.CheckInDocument".$docid, 'label'=>'checkin_document');
else { else {
@ -653,7 +656,8 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
$lockingUser = $document->getLockingUser(); $lockingUser = $document->getLockingUser();
if (($lockingUser->getID() == $this->params['user']->getID()) || ($document->getAccessMode($this->params['user']) == M_ALL)) { if (($lockingUser->getID() == $this->params['user']->getID()) || ($document->getAccessMode($this->params['user']) == M_ALL)) {
$menuitems['update_document'] = array('link'=>"../out/out.UpdateDocument".$docid, 'label'=>'update_document'); $menuitems['update_document'] = array('link'=>"../out/out.UpdateDocument".$docid, 'label'=>'update_document');
$menuitems['unlock_document'] = array('link'=>"../op/op.UnlockDocument".$docid, 'label'=>'unlock_document'); if($accessobject->check_controller_access('UnlockDocument'))
$menuitems['unlock_document'] = array('link'=>"../op/op.UnlockDocument".$docid, 'label'=>'unlock_document');
if($document->isCheckedOut()) { if($document->isCheckedOut()) {
$menuitems['checkin_document'] = array('link'=>"../out/out.CheckInDocument".$docid, 'label'=>'checkin_document'); $menuitems['checkin_document'] = array('link'=>"../out/out.CheckInDocument".$docid, 'label'=>'checkin_document');
} else { } else {
@ -665,20 +669,22 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
$menuitems['move_document'] = array('link'=>"../out/out.MoveDocument".$docid, 'label'=>'move_document'); $menuitems['move_document'] = array('link'=>"../out/out.MoveDocument".$docid, 'label'=>'move_document');
} }
} }
if($this->params['accessobject']->maySetExpires($document)) { if($accessobject->maySetExpires($document)) {
$menuitems['expires'] = array('link'=>"../out/out.SetExpires".$docid, 'label'=>'expires'); if ($accessobject->check_view_access('SetExpires'))
// $menuitems[''] = array('link'=>"", 'label'=>''); $menuitems['expires'] = array('link'=>"../out/out.SetExpires".$docid, 'label'=>'expires');
} }
} }
if ($accessMode == M_ALL) { if ($accessMode == M_ALL) {
$menuitems['rm_document'] = array('link'=>"../out/out.RemoveDocument".$docid, 'label'=>'rm_document'); if ($accessobject->check_view_access('RemoveDocument'))
$menuitems['rm_document'] = array('link'=>"../out/out.RemoveDocument".$docid, 'label'=>'rm_document');
if ($accessobject->check_view_access('DocumentAccess')) if ($accessobject->check_view_access('DocumentAccess'))
$menuitems['edit_document_access'] = array('link'=>"../out/out.DocumentAccess". $docid, 'label'=>'edit_document_access'); $menuitems['edit_document_access'] = array('link'=>"../out/out.DocumentAccess". $docid, 'label'=>'edit_document_access');
} }
if ($accessMode >= M_READ && !$this->params['user']->isGuest()) { if ($accessMode >= M_READ) {
$menuitems['edit_existing_notify'] = array('link'=>"../out/out.DocumentNotify". $docid, 'label'=>'edit_existing_notify'); if ($accessobject->check_view_access('DocumentNotify'))
$menuitems['edit_existing_notify'] = array('link'=>"../out/out.DocumentNotify". $docid, 'label'=>'edit_existing_notify');
} }
if ($this->params['user']->isAdmin()) { if ($accessobject->check_view_access('TransferDocument')) {
$menuitems['transfer_document'] = array('link'=>"../out/out.TransferDocument". $docid, 'label'=>'transfer_document'); $menuitems['transfer_document'] = array('link'=>"../out/out.TransferDocument". $docid, 'label'=>'transfer_document');
} }
@ -712,7 +718,7 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
echo "<ul class=\"nav\">\n"; echo "<ul class=\"nav\">\n";
$menuitems = array(); $menuitems = array();
if ($this->params['user']->isAdmin() || !$this->params['disableselfedit']) if ($accessobject->check_view_access('EditUserData') || !$this->params['disableselfedit'])
$menuitems['edit_user_details'] = array('link'=>"../out/out.EditUserData.php", 'label'=>'edit_user_details'); $menuitems['edit_user_details'] = array('link'=>"../out/out.EditUserData.php", 'label'=>'edit_user_details');
if (!$this->params['user']->isAdmin()) if (!$this->params['user']->isAdmin())
@ -881,7 +887,8 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
echo "<li><a href=\"../out/out.CalendarOld.php?mode=w".$ds."\">".getMLText("week_view")."</a></li>\n"; echo "<li><a href=\"../out/out.CalendarOld.php?mode=w".$ds."\">".getMLText("week_view")."</a></li>\n";
echo "<li><a href=\"../out/out.CalendarOld.php?mode=m".$ds."\">".getMLText("month_view")."</a></li>\n"; echo "<li><a href=\"../out/out.CalendarOld.php?mode=m".$ds."\">".getMLText("month_view")."</a></li>\n";
echo "<li><a href=\"../out/out.CalendarOld.php?mode=y".$ds."\">".getMLText("year_view")."</a></li>\n"; echo "<li><a href=\"../out/out.CalendarOld.php?mode=y".$ds."\">".getMLText("year_view")."</a></li>\n";
if (!$this->params['user']->isGuest()) echo "<li><a href=\"../out/out.AddEvent.php\">".getMLText("add_event")."</a></li>\n"; if($accessobject->check_view_access(array('AddEvent')))
echo "<li><a href=\"../out/out.AddEvent.php\">".getMLText("add_event")."</a></li>\n";
echo "</ul>\n"; echo "</ul>\n";
echo "</div>\n"; echo "</div>\n";
return; return;
@ -894,7 +901,7 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
echo "<ul class=\"nav\">\n"; echo "<ul class=\"nav\">\n";
$menuitems = array(); $menuitems = array();
if (!$this->params['user']->isGuest()) if($accessobject->check_view_access(array('AddEvent')))
$menuitems['addevent'] = array('link'=>"../out/out.AddEvent.php", 'label'=>'add_event'); $menuitems['addevent'] = array('link'=>"../out/out.AddEvent.php", 'label'=>'add_event');
/* Check if hook exists because otherwise callHook() will override $menuitems */ /* Check if hook exists because otherwise callHook() will override $menuitems */