* Admin: Add bulk changes as a context menu action for user list

This commit is contained in:
nathan 2024-06-28 15:16:41 -06:00
parent c51f77a9dd
commit fdb9040f3f
5 changed files with 39 additions and 6 deletions

View File

@ -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']))
{

View File

@ -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);

View File

@ -1785,8 +1785,6 @@ class AdminApp extends EgwApp
data, this.egw
);
}
}
app.classes.admin = AdminApp;

View File

@ -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!<br>Are you really sure you want to do that?

View File

@ -9,12 +9,12 @@
<column/>
</columns>
<rows>
<row>
<row disabled="@dialog">
<et2-description value="Select users"></et2-description>
<et2-description></et2-description>
</row>
<row>
<et2-select-account id="users" rows="15" multiple="1">
<row>
<et2-select-account id="users" rows="15" multiple="1" hidden="@dialog">
<!--<option value="~all~">All users</option>-->
</et2-select-account>
</row>
@ -59,7 +59,7 @@
</grid>
</et2-vbox>
</row>
<row>
<row>
<et2-button label="Start" id="start" noSubmit="true" onclick="app.admin.bulkPasswordReset"></et2-button>
<!--<et2-button label="Download CSV" id="download_csv" onclick="widget.getInstanceManager().postSubmit()" noSubmit="true"></et2-button>-->
</row>