* Preferences: Fix delete personal category required admin permission

This commit is contained in:
nathangray 2020-06-03 15:45:25 -06:00
parent e613a561f6
commit b398935fd6
3 changed files with 7 additions and 3 deletions

View File

@ -42,6 +42,7 @@ class admin_categories
protected $list_link = 'admin.admin_categories.index';
protected $add_link = 'admin.admin_categories.edit';
protected $edit_link = 'admin.admin_categories.edit';
protected $delete_link = 'admin.admin_categories.delete';
/**
* Stupid old admin ACL - dont think anybody uses or understands it ;-)
@ -322,6 +323,8 @@ class admin_categories
$readonlys['button[delete]'] = !$content['id'] || !self::$acl_delete || // cant delete not yet saved category
$appname != $content['appname'] || // Can't edit a category from a different app
($this->appname != 'admin' && $content['owner'] != $GLOBALS['egw_info']['user']['account_id']);
$content['delete_link'] = $this->delete_link;
// Make sure $content['owner'] is an array otherwise it wont show up values in the multiselectbox
if (!is_array($content['owner'])) $content['owner'] = explode(',',$content['owner']);
$tmpl = new Etemplate('admin.categories.edit');
@ -662,7 +665,7 @@ class admin_categories
}
}
$tpl = new Etemplate('admin.categories.delete');
$tpl->exec('admin.admin_categories.delete', $content, array(), array(), $content, 2);
$tpl->exec($this->delete_link, $content, array(), array(), $content, 2);
}
protected function get_actions($appname=Api\Categories::GLOBAL_APPNAME) {
@ -706,7 +709,7 @@ class admin_categories
'group' => ++$group,
'disableClass' => 'rowNoDelete',
'popup' => '450x400',
'url' => 'menuaction=admin.admin_categories.delete&cat_id=$id',
'url' => 'menuaction='.$this->delete_link.'&cat_id=$id',
),
);

View File

@ -80,7 +80,7 @@
<button label="Save" id="button[save]" onclick="return app.admin.check_owner(widget);" image="save" background_image="1"/>
<button label="Apply" id="button[apply]" onclick="return app.admin.check_owner(widget);" image="apply" background_image="1"/>
<buttononly label="Cancel" id="button[cancel]" onclick="window.close();" image="cancel" background_image="1"/>
<buttononly align="right" statustext="Delete this category" label="Delete" id="button[delete]" onclick="egw.open_link('admin.admin_categories.delete&amp;cat_id='+widget.getRoot().getArrayMgr('content').getEntry('id'),'_browser','450x400');window.close();" image="delete" background_image="1"/>
<buttononly align="right" statustext="Delete this category" label="Delete" id="button[delete]" onclick="egw.open_link('$cont[delete_link]&amp;cat_id='+widget.getRoot().getArrayMgr('content').getEntry('id'),'_browser','450x400');window.close();" image="delete" background_image="1"/>
</hbox>
</row>
</rows>

View File

@ -23,6 +23,7 @@ class preferences_categories_ui extends admin_categories {
protected $list_link = 'preferences.preferences_categories_ui.index';
protected $edit_link = 'preferences.preferences_categories_ui.edit';
protected $add_link = 'preferences.preferences_categories_ui.edit';
protected $delete_link = 'preferences.preferences_categories_ui.delete';
function __construct()
{