fixed not working setting of ACL, if user has no access to admin app

This commit is contained in:
Ralf Becker 2014-03-12 12:49:28 +00:00
parent 8d1633f58b
commit 64f4989004
3 changed files with 27 additions and 15 deletions

View File

@ -10,15 +10,18 @@
* @version $Id$ * @version $Id$
*/ */
require_once EGW_INCLUDE_ROOT.'/etemplate/inc/class.etemplate.inc.php';
/** /**
* UI for admin * UI for admin ACL
* *
* @todo acl needs to use etemplate_old, as auto-repeat does not work for acl & label * Will also be extended by preferences_acl for user ACL
*/ */
class admin_acl class admin_acl
{ {
/**
* Appname we are running as
*/
const APPNAME = 'preferences';
/** /**
* Methods callable via menuaction * Methods callable via menuaction
* @var array * @var array
@ -148,7 +151,7 @@ class admin_acl
} }
//error_log(__METHOD__."() _GET[id]=".array2string($_GET['id'])." --> content=".array2string($content)); //error_log(__METHOD__."() _GET[id]=".array2string($_GET['id'])." --> content=".array2string($content));
$tpl->exec('admin.admin_acl.acl', $content, $sel_options, $readonlys, $content); $tpl->exec('admin.admin_acl.acl', $content, $sel_options, $readonlys, $content, 2);
} }
/** /**
@ -181,15 +184,15 @@ class admin_acl
} }
elseif (!$old_apps) elseif (!$old_apps)
{ {
egw_framework::refresh_opener(lang('ACL added.'), 'admin', null, 'add'); egw_framework::refresh_opener(lang('ACL added.'), static::APPNAME, null, 'add');
} }
elseif (!$added_apps) elseif (!$added_apps)
{ {
egw_framework::refresh_opener(lang('ACL deleted.'), 'admin', $deleted_ids, 'delete'); egw_framework::refresh_opener(lang('ACL deleted.'), static::APPNAME, $deleted_ids, 'delete');
} }
else else
{ {
egw_framework::refresh_opener(lang('ACL updated.'), 'admin', null, 'edit'); egw_framework::refresh_opener(lang('ACL updated.'), static::APPNAME, null, 'edit');
} }
} }
@ -217,18 +220,18 @@ class admin_acl
elseif (!$rights) // all rights removed --> delete it elseif (!$rights) // all rights removed --> delete it
{ {
$this->acl->delete_repository($content['acl_appname'], $content['acl_location'], $content['acl_account']); $this->acl->delete_repository($content['acl_appname'], $content['acl_location'], $content['acl_account']);
egw_framework::refresh_opener(lang('ACL deleted.'), 'admin', $id, 'delete'); egw_framework::refresh_opener(lang('ACL deleted.'), static::APPNAME, $id, 'delete');
} }
else else
{ {
$this->acl->add_repository($content['acl_appname'], $content['acl_location'], $content['acl_account'], $rights); $this->acl->add_repository($content['acl_appname'], $content['acl_location'], $content['acl_account'], $rights);
if ($content['id']) if ($content['id'])
{ {
egw_framework::refresh_opener(lang('ACL updated.'), 'admin', $id, 'edit'); egw_framework::refresh_opener(lang('ACL updated.'), static::APPNAME, $id, 'edit');
} }
else else
{ {
egw_framework::refresh_opener(lang('ACL added.'), 'admin', $id, 'add'); egw_framework::refresh_opener(lang('ACL added.'), static::APPNAME, $id, 'add');
} }
} }
} }

View File

@ -255,20 +255,22 @@ app.classes.admin = AppJS.extend(
var ids = []; var ids = [];
for(var i=0; i < _senders.length; ++i) for(var i=0; i < _senders.length; ++i)
{ {
ids.push(_senders[i].id.substr(7)); // remove "admin::" prefix ids.push(_senders[i].id.split('::').pop()); // remove "admin::" prefix
} }
var app = egw.app_name(); // can be either admin or preferences!
var className = app+'_acl';
switch(_action.id) switch(_action.id)
{ {
case 'delete': case 'delete':
var request = egw.json('admin_acl::ajax_change_acl', [ids], this._acl_callback,this,false,this) var request = egw.json(className+'::ajax_change_acl', [ids], this._acl_callback,this,false,this)
.sendRequest(); .sendRequest();
break; break;
case 'edit': case 'edit':
// need to specify window to get correct opener, as admin has multiple windows open! // need to specify window to get correct opener, as admin has multiple windows open!
egw('admin', window).open_link(egw.link('/index.php', { egw('admin', window).open_link(egw.link('/index.php', {
menuaction: 'admin.admin_acl.acl', menuaction: app+'.'+className+'.acl',
id: ids[0] id: ids[0]
}), 'acl', '300x300'); }), 'acl', '300x300');
break; break;
@ -276,7 +278,7 @@ app.classes.admin = AppJS.extend(
case 'add': case 'add':
var current = ids[0].split(':'); var current = ids[0].split(':');
egw('admin', window).open_link(egw.link('/index.php', { egw('admin', window).open_link(egw.link('/index.php', {
menuaction: 'admin.admin_acl.acl', menuaction: app+'.'+className+'.acl',
app: current[0], app: current[0],
account: current[1] account: current[1]
}), 'acl', '250x250'); }), 'acl', '250x250');

View File

@ -17,9 +17,16 @@
*/ */
class preferences_acl extends admin_acl class preferences_acl extends admin_acl
{ {
/**
* Appname we are running as
*/
const APPNAME = 'preferences';
function __construct() function __construct()
{ {
translation::add_app('admin'); translation::add_app('admin');
egw_framework::includeCSS('admin', 'app'); egw_framework::includeCSS('admin', 'app');
parent::__construct();
} }
} }