Skip to main content

Role

The Role entity, mapped to the role table.

Tablerole
Tenant-scopedNo — global table
Columns6
Relationships2
Sourcebackend/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​

FieldTypeColumnNullNotes
roleIdIntegerrole_id—primary key, generated
roleNameStringrole_name——
tenantIdIntegertenant_idYesOwning tenant, or null for a blueprint row.
systembooleanis_system—True for a clone of a standard role.
blueprintbooleanis_blueprint—True for the global template rows that provisioning clones.
descriptionStringdescriptionYes—

Relationships​

FieldKindTargetJoin columnRequired
parentRole@ManyToOneRoleparent_role_id—
permissions@ManyToManyPermission——

Referenced by​

EntityFieldKind
RoleparentRole@ManyToOne
Userrole@ManyToOne
UseradditionalRoles@ManyToMany

Neighbourhood​

Repository​

RoleRepository​

Declared over Role with id type Integer. Source: backend/src/main/java/com/motorph/payroll/repository/RoleRepository.java

MethodReturnsNotes
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)booleanderived
existsByRoleNameIgnoreCaseAndRoleIdNot(String roleName, Integer roleId)booleanderived
existsByParentRole_RoleId(Integer roleId)booleanderived
existsByPermissions_PermissionId(Integer permissionId)booleanderived

Reached by​

These controllers hold — directly or through a service they depend on — a repository over Role.

ControllerBase pathEndpointsModule
AuthController/api/auth5Auth & Identity
JobOfferController/api/job-offers6Recruitment
PermissionController/api/permissions5Auth & Identity
PublicSignupController/api/public/signup2Billing & Platform
RoleController/api/roles6Auth & Identity
UserController/api/users5Auth & Identity
TenantAdminController/api/admin/tenants7Billing & 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/.