from enum import StrEnum class Role(StrEnum): """User roles (specification 2.2). Public: other modules may use it for authorization.""" ADMIN = "admin" MANAGEMENT = "management" EMPLOYEE = "employee" INTERN = "intern" SUBCONTRACTOR = "subcontractor" @property def can_supervise_interns(self) -> bool: return self in (Role.MANAGEMENT, Role.EMPLOYEE) class Permission(StrEnum): USERS_MANAGE = "users.manage" CUSTOMERS_USE = "customers.use" # See the full personal identity code and remove it (others see it masked). CUSTOMERS_PERSONAL_ID_VIEW = "customers.personal_id.view" # Base data: service units, services, work types (later price list, products). CATALOG_MANAGE = "catalog.manage" # Customer jobs: everyone sees (subcontractors only jobs they are members of). JOBS_VIEW = "jobs.view" JOBS_EDIT = "jobs.edit" JOBS_ARCHIVE = "jobs.archive" # Set "invoice created" / "invoiced"; the job's biller may do it too (job rule). JOBS_INVOICE_STATUS = "jobs.invoice_status"