Capabilities are not shown in role detailed view for a role created via API with only capability sets

Description

Overview: Capabilities are not shown in role detailed view for a role created via API with only capability sets

Steps to Reproduce:

  1. In Postman or similar software, create a new authorization role (POST /roles) on evrk2 environment

    1. body:

  2. Assign a capability set to created role (POST /roles/capability-sets)

    1. body:

  3. In a browser, login to evrk2 environment

  4. Go to “Settings“ → “Authorization roles“

  5. Click on the name of created role in second pane

  6. Click on “Capability sets“ accordion

  7. Click on “Capabilities“ accordion

Actual Results:

  • “Capability sets“ accordion contains one set selected (the same assigned at Step 2)

  • “Capabilities“ accordion is empty

Expected Results:

  • “Capability sets“ accordion contains one set selected (the same assigned at Step 2)

  • “Capabilities“ accordion contains all capabilities selected which are included in assigned capability set

Additional Information:

  • If such role is the opened for edit, capabilities included in assigned set are shown as checked as expected. Editing and saving a role will trigger for necessary capabilities to be also shown in detailed view.

  • Behavior is the same if several capability sets were assigned via API

  • Reproduced on ALL Eureka environments

  • See attached screencast:

 

CSP Request Details

None

CSP Rejection Details

None

Potential Workaround

look up the user by UUID in the users app on an as-needed basis

Attachments

2

Checklist

hide

Activity

Show:

Yauhen Viazau May 28, 2024 at 12:16 PM

Tested on evrk2 - works as expected

Capabilities associated with assigned capability sets are properly shown in role detailed view and edit view. See example:

 

Zak Burke May 24, 2024 at 1:54 PM

New details:

  • The UI should not make the third request identified above; capabilities assigned via capability-sets MUST NOT be directly assigned to roles. This is a bug in the current implementation; see

  • The UI can retrieve all capabilities assigned to a role, including those assigned via capability-sets, with a query like /roles/{roleId}/capabilities?expand=true (likewise for users, /users/{userId}/capabilities?expand=true). The fact that the UI does not do this is the bug that must be addressed here.

Special thanks to for describing both the data-model and the available APIs. Note to UI devs and : we should look through ui-users for analogous bugs.

Oleksii Kuzminov May 16, 2024 at 12:35 PM

Please take a look on this bug

Zak Burke May 13, 2024 at 7:35 PM

, I think this is an artifact of how the APIs work, not a bug in the UI. If you update a role via the UI by adding a single capability set, you’ll see three PUT requests:

  1. one to /roles/ROLE_ID with values like name and description

  2. one to /roles/ROLE_ID/capability-sets with a body that is an array of capability set IDs

  3. one to /roles/ROLE_ID/capabilities with a body that is an array of the capability IDs derived from the capability-sets in the previous PUT request.

IOW, from the UI’s point of view, three requests are required to save all the data that corresponds to a fully-populated role. The “Steps to reproduce” here only execute two of these steps. There’s nothing the UI can do about that; it displays incomplete data because it received incomplete data.

In Community FOLIO, there is an analogous situation with permissions where the /bl-users/_self endpoint only returns the permissions that are directly assigned to a user (analogous to retrieving capabilities-sets without their underlying capabilities). Calling /bl-users/_self?expandPermissions=true causes the hierarchy to be expanded and flattened. Perhaps we need something similar here?

CC:

Yauhen Viazau May 7, 2024 at 4:38 PM
Edited

- it does reproduce with or without reloading the browser or refreshing the page. Logging in a separate incognito tab also does not help. Moreover, while capabilities are checked in edit view, they will only be shown in detailed view if you update something in edit view and then save. Simply opening edit view and closing it does not help.
Also, GET /roles/:roleId/capabilities returns nothing if you only assigned capability set(s) via API. It was always like that when assigning via API but capability set is working - when such role is assigned to a user, corresponding actions/data available in UI. So this in itself does not seem like a bug.
I think that UI needs to somehow extact capability information from the capability set, similarly to how it does in edit view.

Done

Details

Assignee

Reporter

Priority

Story Points

Sprint

Development Team

Fix versions

RCA Group

TestRail: Cases

Open TestRail: Cases

TestRail: Runs

Open TestRail: Runs

Created April 10, 2024 at 12:27 PM
Updated May 28, 2024 at 4:34 PM
Resolved May 28, 2024 at 12:17 PM
TestRail: Cases
TestRail: Runs