SUBTASK #86: Roles and permissions (2.1)
Maintainers usually reply within 1 day
@Titus0341 is already working on this.
Since Nov 2, 2026.
Assessment
- Difficulty
- 3/5
- Estimated time
- Half a day
- Newbie friendliness
- 42/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- python
- Domain
- authorization, backend
Research direction
Start with backend/records/enums.py for UserRole and AccountStatus, then backend/records/user.py for where has_role goes. The role-to-permission table is not in the payload; it must come from the team's agreed decision on #86 before ROLE_PERMISSIONS can be written. Done when tests/services/access_control/test_permissions.py passes without a database and permissions.py imports no Flask, database or network code.
Written by the indexing model from the issue text.
Description
What to do
One table that says which role may do what, and a pure function that answers "may this user do this?" with a reason when the answer is no. Everything else (the Application Controller, the screens) asks this function and never compares role names itself.
Background
- Spec SEC-03 (access by role), POL-01 and SEC-09 (refuse everything else), SEC-10 (backup only for authorized users)
- OOD:
AccessControlService.authorizeAction(),verifyRole(),User.hasRole(role) UserRole(admin, editor, viewer) andAccountStatus(active, disabled) are inbackend/records/enums.py- The table is the "What each role may do" decision on #PARENT. Use the version the team agreed.
Steps
-
backend/services/access_control/permissions.py:-
Permissionenum:VIEW_DATA,EXPORT,START_SCAN,EDIT_DEVICES,EDIT_REFERENCE_DATA,MANAGE_ALERTS,BACKUP_RESTORE,MANAGE_USERS,VIEW_AUDIT_LOG -
ROLE_PERMISSIONS: dict[UserRole, frozenset[Permission]]: the agreed table, and the only place it's written -
AccessDecision(allowed: bool, reason: str | None), frozen -
authorize(user: User | None, permission: Permission) -> AccessDecision:- No user: refused, "Sign in to continue."
- Disabled account: refused, "This account is disabled."
- Role without the permission: refused in plain words, e.g. "Your role (viewer) can't start scans."
-
permissions_for(user: User) -> list[str]: the user's permissions by name, sorted, so the UI can hide what the user can't use (subtask 5)
-
-
User.has_role(role: UserRole) -> boolinbackend/records/user.py(OODhasRole) - Unit tests:
- Every
UserRolehas a row (a new role without one fails the test) - The table equals the agreed one exactly, written out in the test, so changing a permission is a visible change in the PR
- A viewer may
VIEW_DATAbut notSTART_SCAN; an editor mayEDIT_DEVICESbut notMANAGE_USERSorBACKUP_RESTORE; an admin may do everything - A disabled admin may do nothing
- No user gives "Sign in to continue."
- Each refusal has a reason; each permission granted has none
- Every
Where
backend/services/access_control/permissions.pybackend/records/user.py(addhas_role)tests/services/access_control/test_permissions.py
Done when
- All the tests above pass without a database
-
permissions.pyimports no Flask, database or network code
Depends on
- The role table decision on #86
- Dominant language
- Python
- Stars
- 1
- Forks
- 1
- Avg merge
- 9h 31m
- Merged PRs (30d)
- 36
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Bearkat-Professionals/Software-Engineering-Project
-
SUBTASK #86: Password hashing (BB-5)Possibly taken @Edgeless6 claimed this 1 day ago. Openbackend Low Priority subtask
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Bearkat-Professionals/Software-Engineering-Project#87 · 1 assignee ·
Maintainers usually reply within 1 day
-
Enhancement: Regression tests for Validate Input crash fixes (SH-1)Possibly taken @yoshi301 claimed this today. Openbackend Low Priority
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
Bearkat-Professionals/Software-Engineering-Project#59 · 1 assignee ·
Maintainers usually reply within 1 day
-
SUBTASK #86: Manage user accounts (admin)Possibly taken @Edgeless6 claimed this 1 day ago. Openbackend Low Priority subtask
Difficulty 4/5 Over a week Newbie friendliness 20/100
Bearkat-Professionals/Software-Engineering-Project#92 · 1 assignee ·
Maintainers usually reply within 1 day
-
SUBTASK #86: Login screen and signed-in layoutPossibly taken @Solo-Her0 claimed this 1 day ago. Openfrontend Low Priority subtask
Difficulty 4/5 3-5 days Newbie friendliness 28/100
Bearkat-Professionals/Software-Engineering-Project#91 · 1 assignee ·
Maintainers usually reply within 1 day
-
SUBTASK #86: Sessions and route protection in the Application Controller (2.0)Possibly taken @javi120467 claimed this 1 day ago. Openbackend Low Priority security subtask
Difficulty 4/5 3-5 days Newbie friendliness 22/100
Bearkat-Professionals/Software-Engineering-Project#90 · 1 assignee ·
Maintainers usually reply within 1 day
All issues in Bearkat-Professionals/Software-Engineering-Project
Similar issues
-
Backend issue lists report in-patch warnings and out-of-patch errors as not publishablePossibly taken @RaphaelFakhri claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
mozilla/code-review#3794 ·
Maintainers usually reply within 1 day
-
[oblt-aw][autodoc] Update docs that still describe the security registry as emptyPossibly taken @github-actions claimed this today. Open
Difficulty 1/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
[Bug] adb backup script reports "Done" & exits 0 when the backup failsPossibly taken @bhattmanthan claimed this today. Openrequest-issue-assignment
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
OWASP/mastg#4034 · 5 comments ·
Maintainers usually reply within 1 day
-
agent-ui bug p2
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
correction metadata
Difficulty 1/5 Under an hour Newbie friendliness 72/100
acl-org/acl-anthology#10768 · 1 comment ·
Maintainers usually reply within 1 day