-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
rbac: Add show all to roles tab, add role tab to groups #19097
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
✅ Deploy Preview for authentik-integrations ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for authentik-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #19097 +/- ##
==========================================
- Coverage 93.37% 93.30% -0.08%
==========================================
Files 949 949
Lines 52254 52304 +50
==========================================
+ Hits 48794 48801 +7
- Misses 3460 3503 +43
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
3e65903 to
c526a61
Compare
✅ Deploy Preview for authentik-storybook ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
authentik PR Installation instructions Instructions for docker-composeAdd the following block to your AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-c9bd016b2ccc77ab4e09f9fe12d4c12deef84708
AUTHENTIK_OUTPOSTS__CONTAINER_IMAGE_BASE=ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)sAfterwards, run the upgrade commands from the latest release notes. Instructions for KubernetesAdd the following block to your authentik:
outposts:
container_image_base: ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s
global:
image:
repository: ghcr.io/goauthentik/dev-server
tag: gh-c9bd016b2ccc77ab4e09f9fe12d4c12deef84708Afterwards, run the upgrade commands from the latest release notes. |
authentik/core/api/groups.py
Outdated
| direct_role_pks = set(instance.roles.values_list("pk", flat=True)) | ||
| inherited_roles = instance.all_roles().exclude(pk__in=direct_role_pks) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic wise looks fine but I think this is gonna cost us a lot of query time when listing groups, I think we either have to pre-fetch things or only include this field in the detail view
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went with with an include, let me know if it looks good
GirlBossRush
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good code wise. Minor nits 👏🏻
| // Handle user filtering - always fetch both direct and inherited roles | ||
| const [directResponse, inheritedResponse] = await Promise.all([ | ||
| new RbacApi(DEFAULT_CONFIG).rbacRolesList({ | ||
| ...config, | ||
| users: this.targetUser?.pk ? [this.targetUser.pk] : undefined, | ||
| }), | ||
| new RbacApi(DEFAULT_CONFIG).rbacRolesList({ | ||
| ...config, | ||
| inheritedUserRoles: this.targetUser?.pk, | ||
| }), | ||
| ]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider something like this at the top of the class:
class RelatedRoleList {
#api = new CoreApi(DEFAULT_CONFIG);
...
async apiEndpoint() {
this.#api.rbacRolesList({
...config,
inheritedUserRoles: this.targetUser?.pk,
})}There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated this, let me know what you think
Co-authored-by: Teffen Ellis <[email protected]> Signed-off-by: Connor Peshek <[email protected]>
Co-authored-by: Teffen Ellis <[email protected]> Signed-off-by: Connor Peshek <[email protected]>
Co-authored-by: Teffen Ellis <[email protected]> Signed-off-by: Connor Peshek <[email protected]>
Co-authored-by: Teffen Ellis <[email protected]> Signed-off-by: Connor Peshek <[email protected]>
Co-authored-by: Teffen Ellis <[email protected]> Signed-off-by: Connor Peshek <[email protected]>
Co-authored-by: Teffen Ellis <[email protected]> Signed-off-by: Connor Peshek <[email protected]>
| OpenApiParameter("include_users", bool, default=True), | ||
| OpenApiParameter("include_children", bool, default=False), | ||
| OpenApiParameter("include_parents", bool, default=False), | ||
| OpenApiParameter("include_inherited_roles", bool, default=False), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost nobody should ever use this in list, but I don't see any harm including it.
gergosimonyi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Conditional on #19194
* improve sort order and inherit visual * Update web/src/admin/groups/GroupViewPage.ts Co-authored-by: Teffen Ellis <[email protected]> Signed-off-by: Connor Peshek <[email protected]> * Update web/src/admin/users/UserViewPage.ts Co-authored-by: Teffen Ellis <[email protected]> Signed-off-by: Connor Peshek <[email protected]> * Update web/src/admin/roles/RelatedRoleList.ts Co-authored-by: Teffen Ellis <[email protected]> Signed-off-by: Connor Peshek <[email protected]> * Update web/src/admin/roles/RelatedRoleList.ts Co-authored-by: Teffen Ellis <[email protected]> Signed-off-by: Connor Peshek <[email protected]> * Update web/src/admin/roles/RelatedRoleList.ts Co-authored-by: Teffen Ellis <[email protected]> Signed-off-by: Connor Peshek <[email protected]> * Update web/src/admin/roles/RelatedRoleList.ts Co-authored-by: Teffen Ellis <[email protected]> Signed-off-by: Connor Peshek <[email protected]> * setup include inherited roles and fix returning nothing * update api calls * fix rendering error * do not use set * change from exception handling * go off query param * fix wording * fix linting error for new group api structure --------- Signed-off-by: Connor Peshek <[email protected]> Co-authored-by: Teffen Ellis <[email protected]>
|
🍒 Cherry-pick to |
…19097 to version-2025.12) (#19199) rbac: Add show all to roles tab, add role tab to groups (#19097) * improve sort order and inherit visual * Update web/src/admin/groups/GroupViewPage.ts * Update web/src/admin/users/UserViewPage.ts * Update web/src/admin/roles/RelatedRoleList.ts * Update web/src/admin/roles/RelatedRoleList.ts * Update web/src/admin/roles/RelatedRoleList.ts * Update web/src/admin/roles/RelatedRoleList.ts * setup include inherited roles and fix returning nothing * update api calls * fix rendering error * do not use set * change from exception handling * go off query param * fix wording * fix linting error for new group api structure --------- Signed-off-by: Connor Peshek <[email protected]> Co-authored-by: Connor Peshek <[email protected]> Co-authored-by: Teffen Ellis <[email protected]> Co-authored-by: Marcelo Elizeche Landó <[email protected]>
* main: outpost/proxyv2: reduce max number of postgres connections (#19211) web/maintenance: lint pass to add missing HTMLElementEventMap entries (#18953) translate: Updates for project authentik and language pt_BR (#19082) core: bump goauthentik.io/api/v3 from 3.2026020.6 to 3.2026020.7 (#19202) lifecycle/aws: bump aws-cdk from 2.1100.1 to 2.1100.2 in /lifecycle/aws (#19203) core: bump axllent/mailpit from v1.28.0 to v1.28.1 in /tests/e2e (#19204) web: bump knip from 5.79.0 to 5.80.0 in /web (#19207) website/integrations: glpi: add step (#19208) admin/files: support %(theme)s variable in media file paths (#19108) web: bump the eslint group across 1 directory with 3 updates (#19205) core: add last_login filter to users API (#18993) website/docs: rewrite section about users and perms (#19195) rbac: Add show all to roles tab, add role tab to groups (#19097) web: Defer table refresh, visibility checks. (#19194) Add docs for roles (#19196) web: Merge branch -- Stale notifications, synchronized context objects, rendering fixes (#19141) root: codespell: ignore Python virtual env, group patterns. (#19180)
Details
This PR adds the "roles" tab to groups.
The Roles tab now also has an "Assigned Roles" tab (showing only directly assigned roles), and an "All Roles" tab (that shows inherited and assigned roles)
Checklist
ak test authentik/)make lint-fix)If an API change has been made
make gen-build)If changes to the frontend have been made
make web)If applicable
make docs)