Skip to content

Add an admin section with three access levels - #13163

Merged
iHiD merged 16 commits into
mainfrom
admin-access-levels
Nov 26, 2026
Merged

iHiD merged 16 commits into
mainfrom
admin-access-levels

Conversation

@iHiD

@iHiD iHiD commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

This PR gives the website one admin section at /admin, so that jobs which needed a Rails console (adding a track, changing someone's roles) can be done from the site. Everyone with access uses the same section, and each person sees the pages their level allows.

Access levels

Access now comes in three levels, highest first. Each level can do everything the levels below it can.

  • Admin can use every page that shows personal data or acts on users: users, roles, partners (with their adverts and perks), mailshots, shadow bans and Sidekiq. Admins can also read any mentoring discussion or submission, manage OAuth apps and get verbose query logging.
  • Maintainer admin is a new role for running the site and the org. It can add tracks, and use community videos, streaming events, submissions, bootcamp admin, and site updates and representations for every track. It also has maintainer and automator rights on every track, and has every exercise unlocked.
  • Maintainer is unchanged. It can use site updates, track maintainers, track categories, the experimental editor and the solution export API.

The staff role now only marks a person as staff. It still gives the "Exercism Staff" profile tag, the staff flair, lifetime Insiders and is_internal in analytics. It gives no access to any page. Verbose query logging is for admins, and the exception for one named user is removed.

The admin section

  • A sidebar lists every page the user can see, grouped under Admin, Maintainer admin and Maintainer. The front page of /admin shows the same groups as cards. Anyone below maintainer is sent to the home page.
  • The maintaining pages now live under /admin. Old /maintaining/... links (with or without a locale) redirect with a 301 to the same page under /admin/....
  • The existing admin pages keep their content inside the new layout, with one shared table style and a message for empty lists.
  • The Donors and Insiders admin pages are removed.
  • The track maintainers page shows each person as a bubble, coloured by status, with the legend and thresholds below the table.
  • The experimental editor has a language picker (every track in Track::CLIENT_SIDE_TEST_RUNNER_SLUGS), a searchable exercise list and an Open button. Its URL is now /admin/experimental_editors/:track_slug/:exercise_slug.

New pages

  • Add a track (/admin/tracks/new, maintainer admin). It takes a slug, checks its format and that no track has it yet, and queues Track::Create. The page lists the five most recently added tracks, so it's clear when the new one has been created.
  • Roles (/admin/roles, admin). It lists everyone with a role, with a filter by role. An admin can add or remove a role on each row, or give a role to someone new by handle. It uses User::AddRoles and User::RemoveRoles, so Discord roles, Insiders status and analytics update as they do for other role changes. An admin can't remove their own admin role.

Risks

  • Anyone who has only the staff role will lose access to the admin pages, the automation pages on every track and mentoring, along with the maintainer and supermentor roles on Discord and the "Maintainer" profile tag. Before this is deployed, someone needs to give them maintainer_admin or admin, or do it on the Roles page straight after.
  • At the next Discord sync, admins without the supermentor role will lose the supermentor Discord role.
  • Maintainers will lose the submissions page.
  • This PR has no data migration. Nobody has maintainer_admin until it is given on the Roles page.
  • The add-track page doesn't check whether exercism/<slug> exists on GitHub. If the repo is missing, the job will fail and retry in Sidekiq. If the track's config.json marks it as active, it will go live as soon as the job finishes.
  • The Roles page can change the maintainer and supermentor roles, but the next sync from GitHub teams and mentoring stats will undo those changes. The page shows a warning about this.

🤖 Generated with Claude Code

@iHiD
iHiD added this pull request to stack #13169 November 26, 2026 07:15
iHiD and others added 11 commits November 26, 2026 16:52
Add a maintainer_admin role between admin and maintainer. Each level
now implies the ones below it. The staff role becomes a label only and
no longer gives access to anything.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keep the existing rule for inactive tracks. maintainer? now covers
maintainer admins and admins, so the separate admin check goes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every page at /admin now shares one layout. The sidebar lists the pages
the current user can see, grouped under Admin, Maintainer admin and
Maintainer, and the /admin front page shows the same groups as cards.

The maintaining pages move into /admin. The old /maintaining URLs
redirect to their new ones.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The selected item's accent border sits on its start edge. Without
rounded corners on that side, the accent is a straight line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Take out the donors and Insiders pages, their routes, tests and their
entries in the admin sidebar and front page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…legend below the table

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…le exercise list

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Maintainer admins can now add a track from /admin/tracks/new by entering
its slug. The page checks the slug, queues Track::Create in Sidekiq, and
lists the most recently added tracks so it's clear when the new one has
been created.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…jobs don't count

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@iHiD
iHiD force-pushed the admin-access-levels branch from a82a08a to 8347753 Compare November 26, 2026 07:52
iHiD and others added 5 commits November 26, 2026 17:01
…parse

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Admins can now see everyone with a role at /admin/roles, filter the
list by role, and give or take away each role. The page uses
User::AddRoles and User::RemoveRoles, so Discord, Insiders and analytics
are updated as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Role tags, the role select and the messages now use the same names as
the filter ("Maintainer admin"). The add-a-role column has a fixed width,
so the select is the same size on every row and the button stays inside
the table.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A form above the roles table takes a handle and a role, so an admin can
give a role to someone who isn't in the table yet. If no user has the
handle, the page says so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@iHiD
iHiD requested a review from dem4ron as a code owner November 26, 2026 08:30
@iHiD iHiD changed the title Split access into admin, maintainer admin and maintainer Add an admin section with three access levels Nov 26, 2026
@iHiD
iHiD merged commit 80e4b05 into main Nov 26, 2026
93 of 104 checks passed
@iHiD
iHiD deleted the admin-access-levels branch November 26, 2026 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant