forked from extern/egroupware
Admin: Fix some errors deleting a group
- use the minified app.js - export the JS class - include the PHP command class explicitly so it's always found - Make sure to send all expected parameters to ajax_delete_group
This commit is contained in:
parent
aee54e5f45
commit
d521d2aa24
@ -496,7 +496,7 @@ class AdminApp extends EgwApp
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'delete':
|
case 'delete':
|
||||||
this.egw.json('admin_account::ajax_delete_group', [account_id, _action.data, this.et2._inst.etemplate_exec_id]).sendRequest();
|
this.egw.json('admin_account::ajax_delete_group', [account_id, _action.data, this.et2.getInstanceManager().etemplate_exec_id]).sendRequest();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (!_action.data.url)
|
if (!_action.data.url)
|
||||||
@ -1564,7 +1564,7 @@ class AdminApp extends EgwApp
|
|||||||
{
|
{
|
||||||
if(button == Et2Dialog.YES_BUTTON)
|
if(button == Et2Dialog.YES_BUTTON)
|
||||||
{
|
{
|
||||||
egw.json('admin_account::ajax_delete_group', [account_id]).sendRequest(false); // false = synchronious request
|
egw.json('admin_account::ajax_delete_group', [account_id, [], _widget.getInstanceManager().etemplate_exec_id]).sendRequest(false); // false = synchronious request
|
||||||
window.close();
|
window.close();
|
||||||
}
|
}
|
||||||
}, this.egw.lang('Delete this group') + '?');
|
}, this.egw.lang('Delete this group') + '?');
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
namespace EGroupware\Admin;
|
namespace EGroupware\Admin;
|
||||||
|
|
||||||
|
use admin_cmd_edit_group;
|
||||||
use EGroupware\Api;
|
use EGroupware\Api;
|
||||||
use EGroupware\Api\Framework;
|
use EGroupware\Api\Framework;
|
||||||
use EGroupware\Api\Egw;
|
use EGroupware\Api\Egw;
|
||||||
@ -50,18 +51,18 @@ class Groups
|
|||||||
* @var type
|
* @var type
|
||||||
*/
|
*/
|
||||||
protected $apps_with_acl = array(
|
protected $apps_with_acl = array(
|
||||||
'calendar' => True,
|
'calendar' => True,
|
||||||
'infolog' => True,
|
'infolog' => True,
|
||||||
'filemanager' => array(
|
'filemanager' => array(
|
||||||
'menuaction' => 'filemanager.filemanager_ui.file',
|
'menuaction' => 'filemanager.filemanager_ui.file',
|
||||||
'path' => '/home/$account_lid',
|
'path' => '/home/$account_lid',
|
||||||
'tabs' => 'eacl',
|
'tabs' => 'eacl',
|
||||||
'popup' => '495x400',
|
'popup' => '495x400',
|
||||||
),
|
),
|
||||||
'bookmarks' => True,
|
'bookmarks' => True,
|
||||||
'phpbrain' => True,
|
'phpbrain' => True,
|
||||||
'projectmanager' => True,
|
'projectmanager' => True,
|
||||||
'timesheet' => True
|
'timesheet' => True
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -96,12 +97,12 @@ class Groups
|
|||||||
{
|
{
|
||||||
// invalidate account, before reading it, to code with changed to DB or LDAP outside EGw
|
// invalidate account, before reading it, to code with changed to DB or LDAP outside EGw
|
||||||
Api\Accounts::cache_invalidate((int)$_GET['account_id']);
|
Api\Accounts::cache_invalidate((int)$_GET['account_id']);
|
||||||
if ($this->accounts->exists((int)$_GET['account_id']) != 2 || // 2 = group
|
if ($this->accounts->exists((int)$_GET['account_id']) != 2 || // 2 = group
|
||||||
!($content = $this->accounts->read((int)$_GET['account_id'])))
|
!($content = $this->accounts->read((int)$_GET['account_id'])))
|
||||||
{
|
{
|
||||||
Framework::window_close(lang('Entry not found!'));
|
Framework::window_close(lang('Entry not found!'));
|
||||||
}
|
}
|
||||||
if ($GLOBALS['egw']->acl->check('group_access', 8, 'admin')) // no view
|
if ($GLOBALS['egw']->acl->check('group_access', 8, 'admin')) // no view
|
||||||
{
|
{
|
||||||
Framework::window_close(lang('Permission denied!'));
|
Framework::window_close(lang('Permission denied!'));
|
||||||
}
|
}
|
||||||
@ -120,7 +121,7 @@ class Groups
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($GLOBALS['egw']->acl->check('group_access', 4, 'admin')) // no add
|
if ($GLOBALS['egw']->acl->check('group_access', 4, 'admin')) // no add
|
||||||
{
|
{
|
||||||
Framework::window_close(lang('Permission denied!'));
|
Framework::window_close(lang('Permission denied!'));
|
||||||
}
|
}
|
||||||
@ -169,11 +170,11 @@ class Groups
|
|||||||
{
|
{
|
||||||
//error_log(__METHOD__."() apps added: ".array2string($added));
|
//error_log(__METHOD__."() apps added: ".array2string($added));
|
||||||
$allow = array(
|
$allow = array(
|
||||||
'allow' => true,
|
'allow' => true,
|
||||||
'account' => $content['account_id'],
|
'account' => $content['account_id'],
|
||||||
'apps' => $added,
|
'apps' => $added,
|
||||||
// This is the documentation from policy app
|
// This is the documentation from policy app
|
||||||
)+(array)$content['admin_cmd'];
|
)+(array)$content['admin_cmd'];
|
||||||
$add_cmd = new admin_cmd_account_app($allow);
|
$add_cmd = new admin_cmd_account_app($allow);
|
||||||
$msg .= $add_cmd->run();
|
$msg .= $add_cmd->run();
|
||||||
}
|
}
|
||||||
@ -182,11 +183,11 @@ class Groups
|
|||||||
{
|
{
|
||||||
//error_log(__METHOD__."() apps removed: ".array2string($removed));
|
//error_log(__METHOD__."() apps removed: ".array2string($removed));
|
||||||
$allow = array(
|
$allow = array(
|
||||||
'allow' => false,
|
'allow' => false,
|
||||||
'account' => $content['account_id'],
|
'account' => $content['account_id'],
|
||||||
'apps' => $removed,
|
'apps' => $removed,
|
||||||
// This is the documentation from policy app
|
// This is the documentation from policy app
|
||||||
)+(array)$content['admin_cmd'];
|
)+(array)$content['admin_cmd'];
|
||||||
$rm_cmd = new admin_cmd_account_app($allow);
|
$rm_cmd = new admin_cmd_account_app($allow);
|
||||||
$msg .= $rm_cmd->run();
|
$msg .= $rm_cmd->run();
|
||||||
}
|
}
|
||||||
@ -194,7 +195,7 @@ class Groups
|
|||||||
}
|
}
|
||||||
catch (Exception $ex) {
|
catch (Exception $ex) {
|
||||||
$msg .= $ex->getMessage();
|
$msg .= $ex->getMessage();
|
||||||
unset($button); // do NOT close dialog
|
unset($button); // do NOT close dialog
|
||||||
}
|
}
|
||||||
if (!$msg)
|
if (!$msg)
|
||||||
{
|
{
|
||||||
@ -203,7 +204,7 @@ class Groups
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
Framework::refresh_opener($msg, 'admin', $content['account_id'], $refresh_type, null, null, null,
|
Framework::refresh_opener($msg, 'admin', $content['account_id'], $refresh_type, null, null, null,
|
||||||
isset($ex) ? 'error' : 'success');
|
isset($ex) ? 'error' : 'success');
|
||||||
}
|
}
|
||||||
if ($button != 'save')
|
if ($button != 'save')
|
||||||
{
|
{
|
||||||
@ -219,7 +220,7 @@ class Groups
|
|||||||
{
|
{
|
||||||
if (!$data['enabled'] || !$data['status'] || $data['status'] == 3)
|
if (!$data['enabled'] || !$data['status'] || $data['status'] == 3)
|
||||||
{
|
{
|
||||||
continue; // do NOT show disabled apps, or our API (status = 3)
|
continue; // do NOT show disabled apps, or our API (status = 3)
|
||||||
}
|
}
|
||||||
|
|
||||||
$popup = null;
|
$popup = null;
|
||||||
@ -227,10 +228,10 @@ class Groups
|
|||||||
|
|
||||||
$content['apps'][] = array(
|
$content['apps'][] = array(
|
||||||
'appname' => $app,
|
'appname' => $app,
|
||||||
'title' => lang($app),
|
'title' => lang($app),
|
||||||
'action' => $acl_action,
|
'action' => $acl_action,
|
||||||
'popup' => $popup,
|
'popup' => $popup,
|
||||||
'run' => (int)(boolean)$run_rights[$app],
|
'run' => (int)(boolean)$run_rights[$app],
|
||||||
);
|
);
|
||||||
if ($run_rights[$app]) $content['old_run'][] = $app;
|
if ($run_rights[$app]) $content['old_run'][] = $app;
|
||||||
$readonlys['apps']['button['.$app.']'] = !$acl_action;
|
$readonlys['apps']['button['.$app.']'] = !$acl_action;
|
||||||
@ -242,8 +243,8 @@ class Groups
|
|||||||
});
|
});
|
||||||
|
|
||||||
$readonlys['button[delete]'] = !$content['account_id'] ||
|
$readonlys['button[delete]'] = !$content['account_id'] ||
|
||||||
$GLOBALS['egw']->acl->check('group_access', 32, 'admin'); // no delete
|
$GLOBALS['egw']->acl->check('group_access', 32, 'admin'); // no delete
|
||||||
if ($GLOBALS['egw']->acl->check('group_access', $content['account_id'] ? 16 : 4, 'admin')) // no edit / add
|
if ($GLOBALS['egw']->acl->check('group_access', $content['account_id'] ? 16 : 4, 'admin')) // no edit / add
|
||||||
{
|
{
|
||||||
$readonlys['button[save]'] = $readonlys['button[apply]'] = true;
|
$readonlys['button[save]'] = $readonlys['button[apply]'] = true;
|
||||||
}
|
}
|
||||||
@ -295,14 +296,15 @@ class Groups
|
|||||||
if(count($account) == 0) return $content['account_id'];
|
if(count($account) == 0) return $content['account_id'];
|
||||||
|
|
||||||
$cmd = new admin_cmd_edit_group(array(
|
$cmd = new admin_cmd_edit_group(array(
|
||||||
'account' => (int)$content['account_id'],
|
'account' => (int)$content['account_id'],
|
||||||
'set' => $account,
|
'set' => $account,
|
||||||
'old' => $old,
|
'old' => $old,
|
||||||
// This is the documentation from policy app
|
// This is the documentation from policy app
|
||||||
)+(array)$content['admin_cmd']);
|
)+(array)$content['admin_cmd']);
|
||||||
$msg = $cmd->run();
|
$msg = $cmd->run();
|
||||||
return $cmd->account;
|
return $cmd->account;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check entered data and return error-msg via json data or null
|
* Check entered data and return error-msg via json data or null
|
||||||
*
|
*
|
||||||
@ -330,32 +332,32 @@ class Groups
|
|||||||
*/
|
*/
|
||||||
public static function edit_group($location)
|
public static function edit_group($location)
|
||||||
{
|
{
|
||||||
unset($location); // unused, but required by hooks signature
|
unset($location); // unused, but required by hooks signature
|
||||||
|
|
||||||
$ret = array(
|
$ret = array(
|
||||||
array(
|
array(
|
||||||
'id' => 'edit',
|
'id' => 'edit',
|
||||||
'caption' => 'Edit group',
|
'caption' => 'Edit group',
|
||||||
'icon' => 'edit',
|
'icon' => 'edit',
|
||||||
'popup' => '600x400',
|
'popup' => '600x400',
|
||||||
'url' => 'menuaction=admin.'.self::class.'.edit&account_id=$id',
|
'url' => 'menuaction=admin.'.self::class.'.edit&account_id=$id',
|
||||||
'group' => 2,
|
'group' => 2,
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'id' => 'add_group',
|
'id' => 'add_group',
|
||||||
'caption' => 'Add group',
|
'caption' => 'Add group',
|
||||||
'icon' => 'new',
|
'icon' => 'new',
|
||||||
'popup' => '600x400',
|
'popup' => '600x400',
|
||||||
'url' => 'menuaction=admin.'.self::class.'.edit',
|
'url' => 'menuaction=admin.'.self::class.'.edit',
|
||||||
'group' => 2,
|
'group' => 2,
|
||||||
'enableId' => '',
|
'enableId' => '',
|
||||||
),
|
),
|
||||||
'delete' => array(
|
'delete' => array(
|
||||||
'id' => 'delete',
|
'id' => 'delete',
|
||||||
'caption' => 'Delete',
|
'caption' => 'Delete',
|
||||||
'icon' => 'delete',
|
'icon' => 'delete',
|
||||||
'confirm' => 'Delete this group',
|
'confirm' => 'Delete this group',
|
||||||
'group' => 99,
|
'group' => 99,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
// if policy app is used, use admin_account delete to delete groups
|
// if policy app is used, use admin_account delete to delete groups
|
||||||
@ -363,7 +365,7 @@ class Groups
|
|||||||
{
|
{
|
||||||
$ret['delete'] += array(
|
$ret['delete'] += array(
|
||||||
'policy_confirmation' => true,
|
'policy_confirmation' => true,
|
||||||
'url' => 'menuaction=admin.admin_account.delete&account_id=$id'
|
'url' => 'menuaction=admin.admin_account.delete&account_id=$id'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return $ret;
|
return $ret;
|
||||||
@ -389,8 +391,8 @@ class Groups
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
$replacements = array(
|
$replacements = array(
|
||||||
'$app' => $app,
|
'$app' => $app,
|
||||||
'$account_id' => $account_id,
|
'$account_id' => $account_id,
|
||||||
'$account_lid' => $account_lid,
|
'$account_lid' => $account_lid,
|
||||||
);
|
);
|
||||||
foreach($acl_action as &$value)
|
foreach($acl_action as &$value)
|
||||||
|
@ -709,8 +709,9 @@ egwAction.prototype._check_confirm = function(_senders, _target)
|
|||||||
{
|
{
|
||||||
if(this.data.policy_confirmation && egw.app('policy'))
|
if(this.data.policy_confirmation && egw.app('policy'))
|
||||||
{
|
{
|
||||||
egw.includeJS(egw.link('/policy/js/app.js'), function() {
|
egw.includeJS(egw.link('/policy/js/app.min.js'), function ()
|
||||||
if(typeof app.policy === 'undefined' || typeof app.policy.confirm === 'undefined')
|
{
|
||||||
|
if (typeof app.policy === 'undefined' || typeof app.policy.confirm === 'undefined')
|
||||||
{
|
{
|
||||||
app.policy = new app.classes.policy();
|
app.policy = new app.classes.policy();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user