Repository navigation
Description
Before reporting an issue
- I have searched existing issues
- I have reproduced the issue with the latest nightly release
Area
admin/api
Describe the bug
There are a couple of issues here worth considering:
-
It appears that the 'manage-account' role (assigned to a new user automatically) makes the addition of account roles such as 'view-profile', 'manage-profile', 'view-applications', 'view-consent', and 'manage-consent' redundant, yet the user can be assigned these roles via User > selected new User > Role mapping > Assign role > Filter by clients.
-
Removing the 'manage-account' role from realm settings > User registration results in 401 Unauthorized in the account console and the addition of any (account) role to a user doesn't have any effect, still resulting in 401 Unauthorized in the account console.
-
Inherited roles (roles already added to a user on the user creation) such as manage-account, manage-account-links, and view-profile can be added again via select user > Assign role > Filter by clients
-
Inconsistencies in role names and functions i.e. we have view-consent and manage-consent (which seem to be doing the same thing or maybe it's because of manage-account) but we only have view-profile which is a "read and write" type of role (maybe it's again because of manage-account role).
-
Documentation explaining each account role is missing (what each role does, and how they can be enabled). Sometimes a few steps are required to enable a role but that's not documented. For example, adding a delete-account role to a user also requires going to Authentication/Required actions and setting 'Delete account' to On.
Version
22.0.3
Expected behavior
The above issues are addressed. At the moment it's very confusing how the roles are working.
Actual behavior
As outlined above.
How to Reproduce?
Steps and all details are provided in the issue.
Anything else?
No response
Activity
pedroigor commentedon Sep 28, 2023
The question here is whether we should enable certain areas of the UI and API. These areas are:
** Consent
From what I understand from the account console and looking at the
accountclient roles, we should hide/show these areas depending on theaccountclient roles assigned to the user. Access to those areas also involves checking whether the user has permission to read and write (perform actions) in these areas.However, I'm not sure if we are supposed to support such fine-grained control in all these areas. The roles we have today point toward this direction though.
As you pointed out, if you take the
Groupsarea as an example, it is shown depending on theview-groupsrole. Even if you have themanage-accountrole, groups are hidden if the user does not have theview-groupsroles assigned. Why does it behave differently than othersview-*roles?I did not check the old (the first one) account but I'll see how these roles play there.
@stianst @mposolda @ssilvert What are your thoughts on this?
pedroigor commentedon Sep 28, 2023
I agree it is confusing. The behavior is because those roles are inherited from the default role set. When you grant them directly to the user then you have a redundant role assignment.
IMO, we should not make it possible at all to grant roles inherited from the default role set, or from any other composite role, or even if a role is granted by a group the user is a member of. Perhaps return an error from the API without necessarily hiding these roles from the UI (not ideal from a UX perspective).
pedroigor commentedon Sep 28, 2023
It is somewhat related to #1 and #3. So we need to decide how much fine-grained access we want to enable around those areas in the account.
pedroigor commentedon Sep 28, 2023
We are missing every single aspect you are pointing out here. I could not find anything at https://www.keycloak.org/docs/latest/server_admin/#_account-service.
pedroigor commentedon Sep 28, 2023
@agagancarczyk In general, I think the open questions are:
manage-accounta super role that grants access to all areas in the account?manage-accountrole so that they can customize which areas users can access?agagancarczyk commentedon Sep 28, 2023
Yes @pedroigor I agree 100% Thanks!
stianst commentedon Sep 29, 2023
This is not a bug, but rather a enhancement request, as the account console has never supported the fine-grained roles, but rather just manage-account role. The finer grained roles where added primarily for various Account API use-cases.
That being said for sure it would for sure be nice to support the fine-grained roles.
With regard to preventing adding roles that are already associated with a user from a composite role, that should be possible, and is not something we should change. A user may get a composite role through default roles, or some other composite role, then have a child role added directly, to in the future have the composite role removed, while it is still intended to leave the child role. So, don't change this behaviour for sure.
I would close this bug, and open an enhancement request to review current roles, make sure there is a role (both view and manage) for each logical section to Account UI and API. Consider leveraging composite roles for
manage-account. Then also of course support enabling/disabling sections of the UI based on what roles are available.A quick glance looking at roles we have now:
manage-account-links: Got no clue what this is. What even is aaccount-link?agagancarczyk commentedon Sep 29, 2023
I'm closing this issue in favor of enhancement -> #23606