call $accessobject->check_view_access() instead of $this->check_access()

This commit is contained in:
Uwe Steinmann 2019-11-20 13:13:51 +01:00
parent 1b6a07b73e
commit ed32e8e2b2

View File

@ -281,6 +281,7 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
*/
function __menuTasks($tasks) { /* {{{ */
$dms = $this->params['dms'];
$accessobject = $this->params['accessobject'];
$content = '';
// $content .= " <ul id=\"main-menu-tasks\" class=\"nav pull-right\">\n";
// $content .= " <li class=\"dropdown\">\n";
@ -330,7 +331,7 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
$content .= " </ul>\n";
$content .= " </li>\n";
}
if ($this->check_access('MyDocuments')) {
if ($accessobject->check_view_access('MyDocuments')) {
$content .= " <li class=\"divider\"></li>\n";
$content .= " <li><a href=\"../out/out.MyDocuments.php\">".getMLText("my_documents")."</a></li>\n";
}
@ -342,6 +343,7 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
function globalNavigation($folder=null) { /* {{{ */
$dms = $this->params['dms'];
$accessobject = $this->params['accessobject'];
echo "<div class=\"navbar navbar-inverse navbar-fixed-top\">\n";
echo " <div class=\"navbar-inner\">\n";
echo " <div class=\"container-fluid\">\n";
@ -359,11 +361,11 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
echo " <ul class=\"dropdown-menu\" role=\"menu\">\n";
if (!$this->params['user']->isGuest()) {
$menuitems = array();
if ($this->check_access('MyDocuments'))
if ($accessobject->check_view_access('MyDocuments'))
$menuitems['my_documents'] = array('link'=>"../out/out.MyDocuments.php", 'label'=>'my_documents');
if ($this->check_access('MyAccount'))
if ($accessobject->check_view_access('MyAccount'))
$menuitems['my_account'] = array('link'=>"../out/out.MyAccount.php", 'label'=>'my_account');
if ($this->check_access('TransmittalMgr'))
if ($accessobject->check_view_access('TransmittalMgr'))
$menuitems['my_transmittals'] = array('link'=>"../out/out.TransmittalMgr.php", 'label'=>'my_transmittals');
$hookObjs = $this->getHookObjects('SeedDMS_View_Bootstrap');
foreach($hookObjs as $hookObj) {
@ -453,8 +455,8 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
echo " <ul class=\"nav\">\n";
// echo " <li id=\"first\"><a href=\"../out/out.ViewFolder.php?folderid=".$this->params['rootfolderid']."\">".getMLText("content")."</a></li>\n";
// echo " <li><a href=\"../out/out.SearchForm.php?folderid=".$this->params['rootfolderid']."\">".getMLText("search")."</a></li>\n";
if ($this->params['enablecalendar'] && $this->check_access('Calendar')) echo " <li><a href=\"../out/out.Calendar.php?mode=".$this->params['calendardefaultview']."\">".getMLText("calendar")."</a></li>\n";
if ($this->check_access('AdminTools')) echo " <li><a href=\"../out/out.AdminTools.php\">".getMLText("admin_tools")."</a></li>\n";
if ($this->params['enablecalendar'] && $accessobject->check_view_access('Calendar')) echo " <li><a href=\"../out/out.Calendar.php?mode=".$this->params['calendardefaultview']."\">".getMLText("calendar")."</a></li>\n";
if ($accessobject->check_view_access('AdminTools')) echo " <li><a href=\"../out/out.AdminTools.php\">".getMLText("admin_tools")."</a></li>\n";
if($this->params['enablehelp']) {
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
echo " <li><a href=\"../out/out.Help.php?context=".$tmp[1]."\">".getMLText("help")."</a></li>\n";
@ -572,6 +574,7 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
private function folderNavigationBar($folder) { /* {{{ */
$dms = $this->params['dms'];
$accessobject = $this->params['accessobject'];
if (!is_object($folder) || !$folder->isType('folder')) {
echo "<ul class=\"nav\">\n";
echo "</ul>\n";
@ -585,12 +588,13 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
$menuitems = array();
if ($accessMode == M_READ && !$this->params['user']->isGuest()) {
if ($accessobject->check_view_access('FolderNotify'))
$menuitems['edit_folder_notify'] = array('link'=>"../out/out.FolderNotify.php?folderid=".$folderID."&showtree=".showtree(), 'label'=>'edit_folder_notify');
}
else if ($accessMode >= M_READWRITE) {
if ($this->check_access('AddSubFolder'))
if ($accessobject->check_view_access('AddSubFolder'))
$menuitems['add_subfolder'] = array('link'=>"../out/out.AddSubFolder.php?folderid=". $folderID ."&showtree=".showtree(), 'label'=>'add_subfolder');
if ($this->check_access('AddDocument'))
if ($accessobject->check_view_access('AddDocument'))
$menuitems['add_document'] = array('link'=>"../out/out.AddDocument.php?folderid=". $folderID ."&showtree=".showtree(), 'label'=>'add_document');
if(0 && $this->params['enablelargefileupload'])
$menuitems['add_multiple_documents'] = array('link'=>"../out/out.AddMultiDocument.php?folderid=". $folderID ."&showtree=".showtree(), 'label'=>'add_multiple_documents');
@ -623,6 +627,7 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
} /* }}} */
private function documentNavigationBar($document) { /* {{{ */
$accessobject = $this->params['accessobject'];
$accessMode = $document->getAccessMode($this->params['user']);
$docid=".php?documentid=" . $document->getID();
echo "<id=\"first\"><a href=\"../out/out.ViewDocument". $docid ."\" class=\"brand\">".getMLText("document")."</a>\n";
@ -667,7 +672,7 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
}
if ($accessMode == M_ALL) {
$menuitems['rm_document'] = array('link'=>"../out/out.RemoveDocument".$docid, 'label'=>'rm_document');
if ($this->check_access('DocumentAccess'))
if ($accessobject->check_view_access('DocumentAccess'))
$menuitems['edit_document_access'] = array('link'=>"../out/out.DocumentAccess". $docid, 'label'=>'edit_document_access');
}
if ($accessMode >= M_READ && !$this->params['user']->isGuest()) {
@ -701,6 +706,7 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
} /* }}} */
private function accountNavigationBar() { /* {{{ */
$accessobject = $this->params['accessobject'];
echo "<id=\"first\"><a href=\"../out/out.MyAccount.php\" class=\"brand\">".getMLText("my_account")."</a>\n";
echo "<div class=\"nav-collapse col2\">\n";
echo "<ul class=\"nav\">\n";
@ -717,9 +723,9 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
$menuitems['2_factor_auth'] = array('link'=>"../out/out.Setup2Factor.php", 'label'=>'edit_existing_notify');
if ($this->params['enableusersview']){
if ($this->check_access('UsrView'))
if ($accessobject->check_view_access('UsrView'))
$menuitems['users'] = array('link'=>"../out/out.UsrView.php", 'label'=>'users');
if ($this->check_access('GroupView'))
if ($accessobject->check_view_access('GroupView'))
$menuitems['groups'] = array('link'=>"../out/out.GroupView.php", 'label'=>'groups');
}
@ -735,6 +741,7 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
} /* }}} */
private function myDocumentsNavigationBar() { /* {{{ */
$accessobject = $this->params['accessobject'];
echo "<id=\"first\"><a href=\"../out/out.MyDocuments.php\" class=\"brand\">".getMLText("my_documents")."</a>\n";
echo "<div class=\"nav-collapse col2\">\n";
@ -763,91 +770,92 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
} /* }}} */
private function adminToolsNavigationBar() { /* {{{ */
$accessobject = $this->params['accessobject'];
echo " <id=\"first\"><a href=\"../out/out.AdminTools.php\" class=\"brand\">".getMLText("admin_tools")."</a>\n";
echo "<div class=\"nav-collapse col2\">\n";
echo " <ul class=\"nav\">\n";
if($this->check_access(array('UsrMgr', 'RoleMgr', 'GroupMgr', 'UserList', 'Acl'))) {
if($accessobject->check_view_access(array('UsrMgr', 'RoleMgr', 'GroupMgr', 'UserList', 'Acl'))) {
$menuitems = array();
$menuitems['user_group_management'] = array('link'=>"#", 'label'=>'user_group_management');
if ($this->check_access('UsrMgr'))
if ($accessobject->check_view_access('UsrMgr'))
$menuitems['user_group_management']['children']['user_management'] = array('link'=>"../out/out.UsrMgr.php", 'label'=>'user_management');
if ($this->check_access('RoleMgr'))
if ($accessobject->check_view_access('RoleMgr'))
$menuitems['user_group_management']['children']['role_management'] = array('link'=>"../out/out.RoleMgr.php", 'label'=>'role_management');
if ($this->check_access('GroupMgr'))
if ($accessobject->check_view_access('GroupMgr'))
$menuitems['user_group_management']['children']['group_management'] = array('link'=>"../out/out.GroupMgr.php", 'label'=>'group_management');
if ($this->check_access('UserList'))
if ($accessobject->check_view_access('UserList'))
$menuitems['user_group_management']['children']['user_list'] = array('link'=>"../out/out.UserList.php", 'label'=>'user_list');
if ($this->check_access('Acl'))
if ($accessobject->check_view_access('Acl'))
$menuitems['user_group_management']['children']['access_control'] = array('link'=>"../out/out.Acl.php", 'label'=>'access_control');
}
if($this->check_access(array('DefaultKeywords', 'Categories', 'AttributeMgr', 'WorkflowMgr', 'WorkflowStatesMgr', 'WorkflowActionsMgr'))) {
if($accessobject->check_view_access(array('DefaultKeywords', 'Categories', 'AttributeMgr', 'WorkflowMgr', 'WorkflowStatesMgr', 'WorkflowActionsMgr'))) {
$menuitems['definitions'] = array('link'=>"#", 'label'=>'definitions');
if ($this->check_access('DefaultKeywords'))
if ($accessobject->check_view_access('DefaultKeywords'))
$menuitems['definitions']['children']['default_keywords'] = array('link'=>"../out/out.DefaultKeywords.php", 'label'=>'global_default_keywords');
if ($this->check_access('Categories'))
if ($accessobject->check_view_access('Categories'))
$menuitems['definitions']['children']['document_categories'] = array('link'=>"../out/out.Categories.php", 'label'=>'global_document_categories');
if ($this->check_access('AttributeMgr'))
if ($accessobject->check_view_access('AttributeMgr'))
$menuitems['definitions']['children']['attribute_definitions'] = array('link'=>"../out/out.AttributeMgr.php", 'label'=>'global_attributedefinitions');
if($this->params['workflowmode'] == 'advanced') {
if ($this->check_access('WorkflowMgr'))
if ($accessobject->check_view_access('WorkflowMgr'))
$menuitems['definitions']['children']['workflows'] = array('link'=>"../out/out.WorkflowMgr.php", 'label'=>'global_workflows');
if ($this->check_access('WorkflowStatesMgr'))
if ($accessobject->check_view_access('WorkflowStatesMgr'))
$menuitems['definitions']['children']['workflow_states'] = array('link'=>"../out/out.WorkflowStatesMgr.php", 'label'=>'global_workflow_states');
if ($this->check_access('WorkflowActionsMgr'))
if ($accessobject->check_view_access('WorkflowActionsMgr'))
$menuitems['definitions']['children']['workflow_actions'] = array('link'=>"../out/out.WorkflowActionsMgr.php", 'label'=>'global_workflow_actions');
}
}
if($this->params['enablefullsearch']) {
if($this->check_access(array('Indexer', 'CreateIndex', 'IndexInfo'))) {
if($accessobject->check_view_access(array('Indexer', 'CreateIndex', 'IndexInfo'))) {
$menuitems['fulltext'] = array('link'=>"#", 'label'=>'fullsearch');
if ($this->check_access('Indexer'))
if ($accessobject->check_view_access('Indexer'))
$menuitems['fulltext']['children']['update_fulltext_index'] = array('link'=>"../out/out.Indexer.php", 'label'=>'update_fulltext_index');
if ($this->check_access('CreateIndex'))
if ($accessobject->check_view_access('CreateIndex'))
$menuitems['fulltext']['children']['create_fulltext_index'] = array('link'=>"../out/out.CreateIndex.php", 'label'=>'create_fulltext_index');
if ($this->check_access('IndexInfo'))
if ($accessobject->check_view_access('IndexInfo'))
$menuitems['fulltext']['children']['fulltext_info'] = array('link'=>"../out/out.IndexInfo.php", 'label'=>'fulltext_info');
}
}
if($this->check_access(array('BackupTools', 'LogManagement'))) {
if($accessobject->check_view_access(array('BackupTools', 'LogManagement'))) {
$menuitems['backup_log_management'] = array('link'=>"#", 'label'=>'backup_log_management');
if ($this->check_access('BackupTools'))
if ($accessobject->check_view_access('BackupTools'))
$menuitems['backup_log_management']['children'][] = array('link'=>"../out/out.BackupTools.php", 'label'=>'backup_tools');
if ($this->params['logfileenable'])
if ($this->check_access('LogManagement'))
if ($accessobject->check_view_access('LogManagement'))
$menuitems['backup_log_management']['children'][] = array('link'=>"../out/out.LogManagement.php", 'label'=>'log_management');
}
if($this->check_access(array('Statistic', 'Charts', 'Timeline', 'ObjectCheck', 'ExtensionMgr', 'Info'))) {
if($accessobject->check_view_access(array('Statistic', 'Charts', 'Timeline', 'ObjectCheck', 'ExtensionMgr', 'Info'))) {
$menuitems['misc'] = array('link'=>"#", 'label'=>'misc');
if ($this->check_access('ImportFS'))
if ($accessobject->check_view_access('ImportFS'))
$menuitems['misc']['children']['import_fs'] = array('link'=>"../out/out.ImportFS.php", 'label'=>'import_fs');
if ($this->check_access('Statistic'))
if ($accessobject->check_view_access('Statistic'))
$menuitems['misc']['children']['folders_and_documents_statistic'] = array('link'=>"../out/out.Statistic.php", 'label'=>'folders_and_documents_statistic');
if ($this->check_access('Charts'))
if ($accessobject->check_view_access('Charts'))
$menuitems['misc']['children']['charts'] = array('link'=>"../out/out.Charts.php", 'label'=>'charts');
if ($this->check_access('Timeline'))
if ($accessobject->check_view_access('Timeline'))
$menuitems['misc']['children']['timeline'] = array('link'=>"../out/out.Timeline.php", 'label'=>'timeline');
if ($this->check_access('SchedulerTaskMgr'))
if ($accessobject->check_view_access('SchedulerTaskMgr'))
$menuitems['misc']['children']['schedulertaskmgr'] = array('link'=>"../out/out.SchedulerTaskMgr.php", 'label'=>'scheduler_task_mgr');
if ($this->check_access('ObjectCheck'))
if ($accessobject->check_view_access('ObjectCheck'))
$menuitems['misc']['children']['objectcheck'] = array('link'=>"../out/out.ObjectCheck.php", 'label'=>'objectcheck');
if ($this->check_access('ExpiredDocuments'))
if ($accessobject->check_view_access('ExpiredDocuments'))
$menuitems['misc']['children']['documents_expired'] = array('link'=>"../out/out.ExpiredDocuments.php", 'label'=>'documents_expired');
if ($this->check_access('ExtensionMgr'))
if ($accessobject->check_view_access('ExtensionMgr'))
$menuitems['misc']['children']['extension_manager'] = array('link'=>"../out/out.ExtensionMgr.php", 'label'=>'extension_manager');
if ($this->check_access('ClearCache'))
if ($accessobject->check_view_access('ClearCache'))
$menuitems['misc']['children']['clear_cache'] = array('link'=>"../out/out.ClearCache.php", 'label'=>'clear_cache');
if ($this->check_access('Info'))
if ($accessobject->check_view_access('Info'))
$menuitems['misc']['children']['version_info'] = array('link'=>"../out/out.Info.php", 'label'=>'version_info');
}
if($this->check_access(array('Hooks'))) {
if($accessobject->check_view_access(array('Hooks'))) {
$menuitems['debug'] = array('link'=>"#", 'label'=>'debug');
if ($this->check_access('Hooks'))
if ($accessobject->check_view_access('Hooks'))
$menuitems['debug']['children']['hooks'] = array('link'=>"../out/out.Hooks.php", 'label'=>'list_hooks');
}