From cd0ec529310663bc7dc0dc469105cd9bec432607 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Sat, 12 Oct 2024 13:50:30 +0200 Subject: [PATCH] pass context to getAccessMode() --- views/bootstrap/class.Bootstrap.php | 6 ++++-- views/bootstrap4/class.Bootstrap4.php | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/views/bootstrap/class.Bootstrap.php b/views/bootstrap/class.Bootstrap.php index 81ede0ba3..24bd2e592 100644 --- a/views/bootstrap/class.Bootstrap.php +++ b/views/bootstrap/class.Bootstrap.php @@ -774,9 +774,11 @@ background-image: linear-gradient(to bottom, #882222, #111111);; $menuitems['expires'] = array('link'=>$this->params['settings']->_httpRoot."out/out.SetExpires".$docid, 'label'=>getMLText('expires')); } } - if ($accessMode == M_ALL) { + if ($document->getAccessMode($this->params['user'], 'removeDocument') == M_ALL) { if ($accessobject->check_view_access('RemoveDocument')) $menuitems['rm_document'] = array('link'=>$this->params['settings']->_httpRoot."out/out.RemoveDocument".$docid, 'label'=>getMLText('rm_document')); + } + if($accessMode == M_ALL) { if ($accessobject->check_view_access('DocumentAccess')) $menuitems['edit_document_access'] = array('link'=>$this->params['settings']->_httpRoot."out/out.DocumentAccess". $docid, 'label'=>getMLText('edit_document_access')); } @@ -3144,7 +3146,7 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) if(!empty($extracontent['begin_action_list'])) $content .= $extracontent['begin_action_list']; if($accessop->check_view_access('RemoveDocument')) { - if($document->getAccessMode($user) >= M_ALL) { + if($document->getAccessMode($user, 'removeDocument') >= M_ALL) { $actions['remove_document'] = $this->printDeleteDocumentButton($document, 'splash_rm_document', true); } else { $actions['remove_document'] = ''; diff --git a/views/bootstrap4/class.Bootstrap4.php b/views/bootstrap4/class.Bootstrap4.php index c0a2d23d1..63514c45b 100644 --- a/views/bootstrap4/class.Bootstrap4.php +++ b/views/bootstrap4/class.Bootstrap4.php @@ -773,9 +773,11 @@ background-image: linear-gradient(to bottom, #882222, #111111);; $menuitems['expires'] = array('link'=>$this->params['settings']->_httpRoot."out/out.SetExpires".$docid, 'label'=>getMLText('expires')); } } - if ($accessMode == M_ALL) { + if ($document->getAccessMode($this->params['user'], 'removeDocument') == M_ALL) { if ($accessobject->check_view_access('RemoveDocument')) $menuitems['rm_document'] = array('link'=>$this->params['settings']->_httpRoot."out/out.RemoveDocument".$docid, 'label'=>getMLText('rm_document')); + } + if($accessMode == M_ALL) { if ($accessobject->check_view_access('DocumentAccess')) $menuitems['edit_document_access'] = array('link'=>$this->params['settings']->_httpRoot."out/out.DocumentAccess". $docid, 'label'=>getMLText('edit_document_access')); } @@ -3194,7 +3196,7 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) if(!empty($extracontent['begin_action_list'])) $content .= $extracontent['begin_action_list']; if($accessop->check_view_access('RemoveDocument')) { - if($document->getAccessMode($user) >= M_ALL) { + if($document->getAccessMode($user, 'removeDocument') >= M_ALL) { $actions['remove_document'] = $this->printDeleteDocumentButton($document, 'splash_rm_document', true); } else { $actions['remove_document'] = '';