feat(settings): provide user groups for accounts list

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
This commit is contained in:
Ferdinand Thiessen 2025-04-24 13:10:11 +02:00
parent 8df3310cc4
commit 8cc0c266d5
No known key found for this signature in database
GPG key ID: 45FAE7268762B400
2 changed files with 15 additions and 1 deletions

View file

@ -41,6 +41,7 @@ use OCP\BackgroundJob\IJobList;
use OCP\Encryption\IManager;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\IConfig;
use OCP\IGroup;
use OCP\IGroupManager;
use OCP\IL10N;
use OCP\INavigationManager;
@ -204,6 +205,12 @@ class UsersController extends Controller {
$serverData = [];
// groups
$serverData['systemGroups'] = [$adminGroupData, $recentUsersGroup, $disabledUsersGroup];
$serverData['userGroups'] = array_values(
array_map(
fn (IGroup $group) => ['id' => $group->getGID(), 'name' => $group->getDisplayName()],
$this->groupManager->getUserGroups($user),
),
);
// Various data
$serverData['isAdmin'] = $isAdmin;
$serverData['isDelegatedAdmin'] = $isDelegatedAdmin;

View file

@ -36,7 +36,10 @@ const defaults = {
const state = {
users: [],
groups: [...(usersSettings.systemGroups ?? [])],
groups: [
...(usersSettings.userGroups ?? []),
...(usersSettings.systemGroups ?? []),
],
orderBy: usersSettings.sortGroups ?? GroupSorting.UserCount,
minPasswordLength: 0,
usersOffset: 0,
@ -264,6 +267,10 @@ const mutations = {
}
const getters = {
getUserGroups() {
return usersSettings.userGroups ?? []
},
getUsers(state) {
return state.users
},