forked from extern/egroupware
* Admin: Context menu action to clear user credentials
This commit is contained in:
parent
4c53f007bd
commit
f5a835e3ea
@ -196,6 +196,15 @@ class admin_hooks
|
||||
'icon' => 'lock',
|
||||
);
|
||||
|
||||
// Clear Credentials
|
||||
$actions[] = array(
|
||||
'id' => 'clear_credentials',
|
||||
'caption' => 'Clear credentials',
|
||||
'icon' => 'password',
|
||||
'onExecute' => 'javaScript:app.admin.clear_credentials_handler',
|
||||
'confirm' => 'Clear credentials'
|
||||
);
|
||||
|
||||
if (!$GLOBALS['egw']->acl->check('current_sessions',1,'admin')) // no rights to view
|
||||
{
|
||||
$actions[] = array(
|
||||
|
@ -13,6 +13,7 @@
|
||||
include_once(EGW_INCLUDE_ROOT.'/setup/inc/hook_config.inc.php'); // functions to return password hashes
|
||||
|
||||
use EGroupware\Api;
|
||||
use EGroupware\Api\Framework;
|
||||
|
||||
/**
|
||||
* Reset passwords
|
||||
@ -26,6 +27,7 @@ class admin_passwordreset
|
||||
*/
|
||||
public $public_functions = array(
|
||||
'index' => true,
|
||||
'ajax_clear_credentials' => true
|
||||
);
|
||||
|
||||
/**
|
||||
@ -284,4 +286,41 @@ class admin_passwordreset
|
||||
'changed' => $changed,
|
||||
));
|
||||
}
|
||||
|
||||
public function ajax_clear_credentials($account_ids)
|
||||
{
|
||||
$msg = [];
|
||||
|
||||
if($count = Api\Mail\Credentials::delete(0,$account_ids))
|
||||
{
|
||||
$msg[] = lang("%1 mail credentials deleted", $count);
|
||||
}
|
||||
|
||||
$action['action'] = 'delete';
|
||||
$action['selected'] = $account_ids;
|
||||
|
||||
$hook_data = Api\Hooks::process(array('location' => 'preferences_security'), ['openid'], true);
|
||||
foreach($hook_data as $extra_tab)
|
||||
{
|
||||
if($extra_tab['delete'])
|
||||
{
|
||||
$msg[] = call_user_func_array($extra_tab['delete'], [$account_ids]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Each credential / security option can have its nm as a different ID
|
||||
$content['tabs'] = $extra_tab['name'];
|
||||
foreach($extra_tab['data'] as $id => $datum)
|
||||
{
|
||||
if($datum['get_rows'])
|
||||
{
|
||||
$content[$id] = $action;
|
||||
}
|
||||
}
|
||||
$msg[] = call_user_func_array($extra_tab['save_callback'], [$content]);
|
||||
}
|
||||
}
|
||||
Framework::message(implode("\n",$msg), 'success');
|
||||
Framework::redirect_link('/index.php', 'menuaction=admin.admin_ui.index','admin');
|
||||
}
|
||||
}
|
||||
|
@ -1142,6 +1142,21 @@ var AdminApp = /** @class */ (function (_super) {
|
||||
this.egw.json('admin.admin_hooks.ajax_clear_cache&errored=1', null, success).sendRequest(true);
|
||||
}, this));
|
||||
};
|
||||
/**
|
||||
* Action handler for clear credentials action
|
||||
*
|
||||
* @param action
|
||||
* @param selected
|
||||
*/
|
||||
AdminApp.prototype.clear_credentials_handler = function (action, selected) {
|
||||
var ids = [];
|
||||
debugger;
|
||||
for (var _i = 0, selected_1 = selected; _i < selected_1.length; _i++) {
|
||||
var row = selected_1[_i];
|
||||
ids.push(row.id.split("::").pop());
|
||||
}
|
||||
this.egw.request("admin.admin_passwordreset.ajax_clear_credentials", [ids]);
|
||||
};
|
||||
/**
|
||||
* Export content of given field into relevant file
|
||||
*/
|
||||
|
@ -1382,6 +1382,23 @@ class AdminApp extends EgwApp
|
||||
}, this));
|
||||
}
|
||||
|
||||
/**
|
||||
* Action handler for clear credentials action
|
||||
*
|
||||
* @param action
|
||||
* @param selected
|
||||
*/
|
||||
clear_credentials_handler(action : egwAction, selected: egwActionObject[])
|
||||
{
|
||||
let ids = [];
|
||||
debugger;
|
||||
for(let row of selected)
|
||||
{
|
||||
ids.push(row.id.split("::").pop());
|
||||
}
|
||||
this.egw.request("admin.admin_passwordreset.ajax_clear_credentials", [ids]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Export content of given field into relevant file
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user