pass context to getAccessMode()

This commit is contained in:
Uwe Steinmann 2024-10-12 13:50:30 +02:00
parent 5a3ba8243d
commit cd0ec52931
2 changed files with 8 additions and 4 deletions

View File

@ -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'] = '<span style="padding: 2px; color: #CCC;"><i class="fa fa-remove"></i></span>';

View File

@ -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'] = '<span style="padding: 2px; color: #CCC;"><i class="fa fa-remove"></i></span>';