←→ switch·Esc back
Authorization
You might say
After people sign in, I still need different access levels for admins and regular users.
Decide what an authenticated user is allowed to see or change·Authorization checks permissions for each resource and action after the user's identity is known. A person may view one project but not another, or edit content without managing billing. Enforce the rule on the backend for every request, not only by hiding controls in the interface.
Know first
Current UserMember · Xiaolin
View itemsAllow
Edit own tasksAllow
Delete other people's tasksReject
Manage all accountsReject
When to use it
- Check record ownership
- Apply roles and permissions
- Limit access by workspace or organization
- Protect administrative and billing actions
When NOT to use it
- Rely on hidden buttons as access control
- Check a role but ignore which record is being accessed
- Grant broad administrator access for convenience
- Cache permissions without handling changes and revocation
Anatomy
whocanwhatacts onwhich resource
Currently authenticated users, along with roles and memberships in trusted sources
The ability to read, edit, delete, approve, etc. requires judgment on an item-by-item basis
Target record, project or file; also check who owns it and which organization it belongs to
Variants
Role-based
viewer · editor · admin
Simple systems with clear roles.
Ownership
post.userId === me.id
Users may only operate on their own data.
Membership
project_members
Team and collaboration products.
Typical use cases
Project access
Personal dataJudge editing permissions based on resource ownership
Current useru_23Profile owneru_23ResultsAllow editing
Team roles
Project membersMembership determines viewing permissions
ProjectVibeHubUser roleviewerPermissionsViewable · Cannot be deleted
Admin settings
Administrator operationsBlock accounts and leave audit records
Target accountuser_42ReasonRepeated abuse
Confirm banRecord admin_u7 · 16:42 · disable user_42
Billing permission
Paid functionSubscription status is confirmed by the server
Current PlanFree
→
Export HD filesRequires Pro
Hiding a control is not enough; the server must still check subscription access
Further reading