Skip to content

Check the admin role on each request - #417

Open
mraible wants to merge 1 commit into
masterfrom
admin-role-live-check
Open

mraible wants to merge 1 commit into
masterfrom
admin-role-live-check

Conversation

@mraible

@mraible mraible commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

A login keeps the roles it had when it started. So when an administrator takes the admin role away from a user who is logged in, that user could still open the Server Admin pages until they logged out or their session ended.

  • The URL rules that need the admin role (/roller-ui/admin/**, /rewrite-status and any security.access rule naming admin) now also check that the login's user is an administrator in Roller's database, on each request. The check only narrows access: it never grants anything the login's roles didn't.
  • Other roles are taken as the login carries them. LDAP gives directory users a default role (users.ldap.defaultRole) that Roller doesn't store, so checking editor the same way would lock them out.
  • Before Roller is set up there's no database to ask, so the login's roles stand, as before. A failed lookup refuses.
  • The Planet groups page now requires an administrator at the action level, like the other admin pages. A new test checks that every action in the admin namespace does.

This doesn't end the user's session; they stay logged in with whatever other roles they have.

Tests: AdministratorRoleTest checks the database lookup (role taken away, user disabled, user gone). SecurityConfigTest sends a demoted admin's requests through the filter chain. Both new checks fail without the change. The full suite passes (1,032 tests), and the branch merges cleanly with #321 and #411–#416.

A login keeps the roles it had when it started, so a user whose admin role was taken away could still open the admin pages until their session ended. The URL rules that need the admin role, including security.access rules, now also check that the login's user is an administrator in Roller's database. Other roles are taken as the login carries them, since LDAP gives directory users a default role that Roller doesn't store.

The Planet groups page now requires an administrator at the action level too, like the other admin pages.
@mraible mraible added the 7.0.0 label Dec 3, 2026
@mraible
mraible requested a review from snoopdave December 3, 2026 22:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant