Skip to main content

How access works

The guard middleware (app.UseSuperAdmin()) checks every request in the protected scope. By default the scope is everything under /admin.

Request ──► in protected scope? ──no──► your endpoint (not touched)
│yes
▼
anonymous path / [AllowAnonymous]? ──yes──► endpoint
│no
▼
signed in (SuperAdmin cookie)? ──no──► 302 /admin/auth/login (API: 401)
│yes
▼
user active + security stamp valid? ──no──► sign out, 302 login
│yes
▼
must change password? ──yes──► 302 /admin/auth/setting/password
│no
▼
[SkipUrlPermission]? ──yes──► endpoint
│no
▼
super admin, or a held permission has a rule matching METHOD + path?
├─yes──► endpoint ([HasPermission] etc. are checked on top)
└─no───► 302 /admin/auth/denied (API: 403)

Concepts​

ConceptMeaning
UserAdmin panel account. Has roles and optional direct permissions
RoleNamed group of permissions (editor). A role with Super administrator bypasses every check
PermissionA slug (posts.edit) with 0..n URL rules. A user's permissions are the direct permissions plus the permissions of all roles. * grants everything
URL ruleHTTP methods (empty = any) plus a path pattern. The URL guard allows a request if any rule of any held permission matches. See URL pattern syntax
Menu itemTitle, icon, URL, parent. Visible only if the user may GET its URL (switchable per item), plus optional "require permission" and "restrict to roles". Groups without visible children are hidden

Changes apply on the next request​

Permissions are not stored in the cookie. They are cached per user, and the cache is cleared on every change made in the panel. A change therefore applies on the user's next request.

In a web farm, other instances notice a change within Cache:VersionCheckSeconds (default 5 seconds). See Configuration.

What a denied user sees​

A signed-in user who opens a URL without a matching rule sees the denied page. Here the editor opens /admin/auth/users:

Access denied page

Paths that match Protection:ApiPaths (default /admin/api/*) get 401 or 403 status codes instead of redirects.

Check one user's access​

Go to Users and click the user name. The access view lists the roles, every effective permission with its source, and the visible menu:

User access view

To test one URL against the rules, use Permissions → URL tester. See URL pattern syntax.