Role
The Role entity, mapped to the role table.
| Table | role |
| Tenant-scoped | No — global table |
| Columns | 6 |
| Relationships | 2 |
| Source | backend/src/main/java/com/motorph/payroll/model/Role.java |
Not tenant-scoped
This entity does not extend TenantOwned, so its rows are shared across every tenant. TenantCoverageTest allows that only for tables deliberately declared global.
Columns
| Field | Type | Column | Null | Notes |
|---|---|---|---|---|
roleId | Integer | role_id | — | primary key, generated |
roleName | String | role_name | — | — |
tenantId | Integer | tenant_id | Yes | Owning tenant, or null for a blueprint row. |
system | boolean | is_system | — | True for a clone of a standard role. |
blueprint | boolean | is_blueprint | — | True for the global template rows that provisioning clones. |
description | String | description | Yes | — |
Relationships
| Field | Kind | Target | Join column | Required |
|---|---|---|---|---|
parentRole | @ManyToOne | Role | parent_role_id | — |
permissions | @ManyToMany | Permission | — | — |
Referenced by
| Entity | Field | Kind |
|---|---|---|
| Role | parentRole | @ManyToOne |
| User | role | @ManyToOne |
| User | additionalRoles | @ManyToMany |
Neighbourhood
Repository
RoleRepository
Declared over Role with id type Integer. Source: backend/src/main/java/com/motorph/payroll/repository/RoleRepository.java
| Method | Returns | Notes |
|---|---|---|
findAllBy() | List<Role> | derived |
findWithPermissionsByRoleId(Integer roleId) | Optional<Role> | derived |
findByRoleNameIgnoreCase(String roleName) | Optional<Role> | derived |
findByTenantIdIsNullAndBlueprintTrue() | List<Role> | derived |
findByRoleNameIgnoreCaseAndTenantIdIsNullAndBlueprintFalse(String roleName) | Optional<Role> | derived |
existsByRoleNameIgnoreCase(String roleName) | boolean | derived |
existsByRoleNameIgnoreCaseAndRoleIdNot(String roleName, Integer roleId) | boolean | derived |
existsByParentRole_RoleId(Integer roleId) | boolean | derived |
existsByPermissions_PermissionId(Integer permissionId) | boolean | derived |
Reached by
These controllers hold — directly or through a service they depend on — a repository over Role.
| Controller | Base path | Endpoints | Module |
|---|---|---|---|
| AuthController | /api/auth | 5 | Auth & Identity |
| JobOfferController | /api/job-offers | 6 | Recruitment |
| PermissionController | /api/permissions | 5 | Auth & Identity |
| PublicSignupController | /api/public/signup | 2 | Billing & Platform |
| RoleController | /api/roles | 6 | Auth & Identity |
| UserController | /api/users | 5 | Auth & Identity |
| TenantAdminController | /api/admin/tenants | 7 | Billing & Platform |
Generated page
This page is rebuilt from the source on every docs build by docs-site/scripts/gen-code-wiki.mjs. Editing it has no effect — change the code, or, if what you want to say is prose, write it in docs/.