Skip to content

As an admin, I want to be able to assign users to a Group while on the Users page #11

@usrrname

Description

@usrrname

Currently, we lack the ability to assign users to groups.

This functionality could be added to the UpdateUserModal, which is triggered by double-clicking the row in the User list.

What this entails:

  • loading all available groups (excluding the groups a user is already part of)
  • adding a solution like a dropdown to select the group the user will be a part of.
  • when saved, post request/ query to a12n-server adds a user to the group.
  • UX feedback on success and error with toast

To see who is in a group, check the member relationship on /group/:id.

To add someone to a group, there is a PATCH request on that endpoint that looks like this:

{
  memberHref: '/url/to/user/you're/adding',
  operation: 'add-member'
}

If it's interesting, if you were to get a list of users in a group with @badgateway/ketting this would work roughly as follows:

const group = ketting.go('/group/1234');
const members = await group.followAll('member');

for(const member of members) {

  console.log(member.uri);
  
  // Get the full member object.
  console.log(await member.get());

}

To add a member:

const group = ketting.go('/group/1234');
const user = ketting.go('/user/4567');

await group.patch({
  memberHref: user.uri,
  operation: 'add-member'
});

Out of scope

  • privilege inheritance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions