From fdb9040f3f10d1cf19e80ef8e59faf71310dc361 Mon Sep 17 00:00:00 2001 From: nathan Date: Fri, 28 Jun 2024 15:16:41 -0600 Subject: [PATCH] * Admin: Add bulk changes as a context menu action for user list --- admin/inc/class.admin_passwordreset.inc.php | 22 +++++++++++++++++++++ admin/inc/class.admin_ui.inc.php | 12 +++++++++++ admin/js/app.ts | 2 -- admin/lang/egw_en.lang | 1 + admin/templates/default/passwordreset.xet | 8 ++++---- 5 files changed, 39 insertions(+), 6 deletions(-) diff --git a/admin/inc/class.admin_passwordreset.inc.php b/admin/inc/class.admin_passwordreset.inc.php index 35bba2afe7..1a6264f475 100644 --- a/admin/inc/class.admin_passwordreset.inc.php +++ b/admin/inc/class.admin_passwordreset.inc.php @@ -66,6 +66,28 @@ class admin_passwordreset */ function index(array $content=null, $msg='') { + + // Setup if opened as a dialog + $content['dialog'] = $_GET['dialog']; + if($content['dialog'] && !$content['users'] && isset($_GET['ids'])) + { + $content['users'] = $_GET['ids']; + + $query = Api\Cache::getSession('admin', 'account_list'); + if($_GET['select_all'] == 'true') + { + @set_time_limit(0); // switch off the execution time limit, as it's for big selections to small + $query['num_rows'] = -1; // all + $readonlys = null; + $content['users'] = []; + $rows = []; + admin_ui::get_users($query, $rows); + foreach($rows as $row) + { + $content['users'][] = $row['account_id']; + } + } + } if (!($account_repository = $GLOBALS['egw_info']['server']['account_repository']) && !($account_repository = $GLOBALS['egw_info']['server']['auth_type'])) { diff --git a/admin/inc/class.admin_ui.inc.php b/admin/inc/class.admin_ui.inc.php index 99d249f9e5..3f0b2bf122 100644 --- a/admin/inc/class.admin_ui.inc.php +++ b/admin/inc/class.admin_ui.inc.php @@ -183,6 +183,17 @@ class admin_ui $actions['add']['url'] .= ($actions['edit']['url'] ? '&' : '').$name.'='.$val; } ++$group; + $config = Api\Config::read('admin'); + $reset = new admin_passwordreset(); + $actions['change'] = array( + 'caption' => 'Bulk changes', + 'allowOnMultiple' => true, + 'group' => $group, + 'nm_action' => 'popup', + 'url' => 'menuaction=admin.admin_passwordreset.index&dialog=true&ids=$id&select_all=$select_all', + 'width' => 750, + 'height' => 600 + ); // supporting both old way using $GLOBALS['menuData'] and new just returning data in hook $apps = array_unique(array_merge(array('admin'), Api\Hooks::implemented('edit_user'))); foreach($apps as $app) @@ -385,6 +396,7 @@ class admin_ui { $params['account_id'] = (array)$query['account_id']; } + Api\Cache::setSession('admin', 'account_list', $query); $rows = array_values(self::$accounts->search($params)); //error_log(__METHOD__."() accounts->search(".array2string($params).") total=".self::$accounts->total); diff --git a/admin/js/app.ts b/admin/js/app.ts index 94e2c4a360..b32736a56a 100644 --- a/admin/js/app.ts +++ b/admin/js/app.ts @@ -1785,8 +1785,6 @@ class AdminApp extends EgwApp data, this.egw ); } - - } app.classes.admin = AdminApp; \ No newline at end of file diff --git a/admin/lang/egw_en.lang b/admin/lang/egw_en.lang index 466f73b7b5..6e5ad6d08f 100644 --- a/admin/lang/egw_en.lang +++ b/admin/lang/egw_en.lang @@ -180,6 +180,7 @@ bi-dir passthrough admin en bi-dir passthrough bi-directional admin en bi-directional blocking after wrong password admin en Blocking after wrong password bottom admin en Bottom +bulk changes admin en Bulk changes bulk password reset admin en Bulk password reset by admin en By by selecting a user or group you effectively delete the mail account for all other users!\n\nare you really sure you want to do that? admin en By selecting a user or group you effectively delete the mail account for all other users!
Are you really sure you want to do that? diff --git a/admin/templates/default/passwordreset.xet b/admin/templates/default/passwordreset.xet index 2cd9ecf0c8..3d8451a47f 100644 --- a/admin/templates/default/passwordreset.xet +++ b/admin/templates/default/passwordreset.xet @@ -9,12 +9,12 @@ - + - - + + @@ -59,7 +59,7 @@ - +