-
Estimated Work Hours for SZ-5: Role-Based Authorization (AuthZ)
Task Description Estimated Time 1. Access Control Mapping Review all controller endpoints and assign appropriate access roles (e.g., ADMIN,DEVELOPER) based on business logic.1–1.5h 2. Implement @PreAuthorizeRulesAdd @PreAuthorizeannotations on service/controller methods to enforce role-based access control.1–1.5h 3. Extend or Validate CustomJwtAuthenticationConverterConfirm that realm roles or authorities are correctly extracted and prefixed with ROLE_for compatibility.0.5h 4. Enable Method Security Ensure method-level authorization is active via @EnableMethodSecurityin the security config.0.25h 5. Unit Tests Write unit tests that simulate JWTs with different role claims and verify access to endpoints accordingly. 2–3h 6. Integration Tests (Optional) Perform end-to-end tests using a full Spring context ( @SpringBootTest) for role validation.1.5–2h 7. Documentation & PR Write descriptive commit message and PR, including how roles are mapped and tested. 0.5h Estimated Total:
~6–9 hours -
Sztab System Roles
This document lists all predefined system roles and their intended responsibilities in the Sztab project.
Role Description ADMINFull system control (users, roles, settings) PROJECT_MANAGERManages projects, deadlines, and assignments DEVELOPERImplements features, fixes issues QA_ENGINEERValidates software functionality, files bugs DOCUMENT_WRITERMaintains project documentation OBSERVERRead-only access to all modules CUSTOMER_SUPPORTViews reported bugs, adds comments, triages tickets UX_DESIGNERParticipates in issue reviews related to user experience SCRUM_MASTERUnblocks teams, drives stand-ups, ensures sprint goals RELEASE_MANAGERCoordinates releases, tags, versioning, and documentation -
Role Hierarchy
While roles are technically flat in the system, the following implied hierarchy reflects how roles relate in terms of responsibility and access:
ADMIN ├── PROJECT_MANAGER │ ├── DEVELOPER │ ├── QA_ENGINEER │ ├── DOCUMENT_WRITER │ ├── UX_DESIGNER │ └── SCRUM_MASTER ├── RELEASE_MANAGER ├── CUSTOMER_SUPPORT └── OBSERVERInterpretation and Usage
- ADMIN can perform all actions in the system.
- PROJECT_MANAGER coordinates the core delivery team, including developers, testers, and writers.
- RELEASE_MANAGER, CUSTOMER_SUPPORT, and OBSERVER are lateral roles with distinct access patterns such as release pipelines, support dashboards, or audits.
- This hierarchy is not enforced by default, but you can encode it in Spring Security using
RoleHierarchyImplif needed for transitive role permissions.
-
I think the best approach is to have access permissions to resources and functionality. Then we could create roles on demand when necessary. Each role could be created with selected permissions. This would give us most flexibility.
I understand that "Admin" (or super admin) role must be predefined or hardcoded but other that that all other roles should be configurable. We can of course ship the package with a set of pre-created roles.
On top of the listed roles, there might also be roles like "community user", "customer", etc....
-
I agree that using permission-based access control with configurable roles would offer greater flexibility. For now, I’ve gone with Spring Security’s built-in role-based approach to secure the MVP endpoints using @PreAuthorize("hasRole(...)"), which is quick to implement and easy to test.
That said, I suggest we follow this phased path: 1. Use static roles (e.g., ADMIN, DEVELOPER) for MVP and seed them at startup. 2. In a follow-up phase, introduce a Permission model and define roles dynamically in the database. 3. Shift controller-level checks from hasRole(...) to hasAuthority(...), based on assigned permissions.
For example, instead of granting access based solely on roles like PROJECT_MANAGER, we could define permissions like ASSIGN_ISSUE, CLOSE_ISSUE, etc., and assign them to roles in the database. This would allow us to create roles like “community user” or “customer” later without changing code.
Let me know if this phased approach sounds good. I’ll proceed with the static model for now and open a follow-up item to track the dynamic permission system.
-
Please see https://tigase.dev/sztab/~issues/15
If you prefer, I can drop the static role layer altogether and go directly to a fully dynamic RBAC setup now.
It will take more time and introduce some early complexity (e.g., role/permission modeling, UI exposure, etc.), but I’m happy to go that route if you’d rather not build on the static layer at all.
Let me know your preference — I’m good either way.
— Rk
-
If it is possible to change roles into permissions later without turning everything upside down then go with predefined static roles now. I would prefer to see basics functionality working sooner than later. Just make sure we have all our typical roles we use now, so we can replace OneDev with Sztab. I am also assuming that it will not be too time consuming to add more static roles if needed.
As I said, I would like to see roles like
- "CUSTOMER" - access to specific projects assigned to the customer. Can open issues, comment on them, reassign, change status. Cannot see certain fields like time tracking. Cannot see the code.
- "CUSTOMER_WITH_CODE" - as above but with code access
- "COMMUNITY USER" - read only access to all open source projects + plus opening and discussing issues in any open source project
@andrzej.wojcik @wojtek anything to add?
| Type |
New Feature
|
| Priority |
Normal
|
| Assignee | |
| Version |
none
|
| Sprints |
n/a
|
| Customer |
n/a
|
Goal
Implement fine-grained role-based authorization (AuthZ) for the Sztab project. Ensure that only users with appropriate roles (e.g., ADMIN, DEVELOPER) can access specific REST endpoints.
Scope
@PreAuthorizeor@Securedannotations to controller methods/api/users/**,/api/projects/**, etc.CustomJwtAuthenticationConverterto extract roles from JWT claimsNot in Scope
Related