mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-23 16:33:17 +01:00
finished WIP Mail REST API: regular user UI for application passwords
This commit is contained in:
parent
d178087b16
commit
5c02a0d98e
@ -76,7 +76,7 @@ class Token
|
||||
!(new Api\Auth())->authenticate($GLOBALS['egw_info']['user']['account_lid'], $content['password']))
|
||||
{
|
||||
Api\Etemplate::set_validation_error('password', lang('Password is invalid'));
|
||||
unset($content['button']);
|
||||
$button = null;
|
||||
}
|
||||
try {
|
||||
switch($button)
|
||||
@ -127,6 +127,7 @@ class Token
|
||||
'button[delete]' => !$content['token_id'],
|
||||
'account_id' => empty($GLOBALS['egw_info']['user']['apps']['admin']) || static::APP !== 'admin',
|
||||
];
|
||||
$GLOBALS['egw_info']['flags']['app_header'] = empty($content['token_id']) ? lang('Add token') : lang('Edit token');
|
||||
$tmpl = new Api\Etemplate(self::APP.'.token.edit');
|
||||
$tmpl->exec(static::APP.'.'.static::class.'.edit', $content, [], $readonlys, $content, 2);
|
||||
}
|
||||
@ -191,7 +192,7 @@ class Token
|
||||
elseif(!empty($content['token']['action']))
|
||||
{
|
||||
try {
|
||||
Api\Framework::message($this->action($content['token']['action'],
|
||||
Api\Framework::message(self::action($content['token']['action'],
|
||||
$content['token']['selected'], $content['token']['select_all']));
|
||||
}
|
||||
catch (\Exception $ex) {
|
||||
@ -285,7 +286,7 @@ class Token
|
||||
* @returns string with success message
|
||||
* @throws Api\Exception\AssertionFailed
|
||||
*/
|
||||
protected function action($action, $selected, $select_all)
|
||||
protected static function action($action, $selected, $select_all=false)
|
||||
{
|
||||
$success = 0;
|
||||
try {
|
||||
|
@ -5,7 +5,7 @@
|
||||
<grid width="100%" height="100%">
|
||||
<columns>
|
||||
<column width="30"/>
|
||||
<column width="120"/> <!-- User / All user -->
|
||||
<column width="120" disabled="@no_account_id"/> <!-- User / All user -->
|
||||
<column width="25%"/> <!-- Applications -->
|
||||
<column width="120"/> <!-- Expiration -->
|
||||
<column width="120"/> <!-- Revoked / By -->
|
||||
|
@ -42,16 +42,26 @@ class Token extends Admin\Token
|
||||
'prepend' => false,
|
||||
'data' => [
|
||||
'token' => [
|
||||
'default_cols' => '!account_id',
|
||||
'add_action' => 'app.preferences.addToken',
|
||||
'no_account_id' => true,
|
||||
]+self::get_nm_options(),
|
||||
],
|
||||
'preserve' => [
|
||||
],
|
||||
'sel_options' => [
|
||||
],
|
||||
'save_callback' => __CLASS__.'::action',
|
||||
'save_callback' => __CLASS__.'::save_callback',
|
||||
];
|
||||
}
|
||||
|
||||
public static function save_callback(array &$content)
|
||||
{
|
||||
Api\Translation::add_app('admin');
|
||||
try {
|
||||
Api\Framework::message(self::action($content['token']['action'], $content['token']['selected']), 'success');
|
||||
}
|
||||
catch (\Exception $e) {
|
||||
Api\Framework::message($e->getMessage(), 'error');
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user