176 lines
9.4 KiB
Python
176 lines
9.4 KiB
Python
from __future__ import annotations
|
|
|
|
PERMISSIONS = {
|
|
"system.settings.view": "View System Settings",
|
|
"system.settings.edit": "Edit System Settings",
|
|
"system.settings.manage": "Manage System Settings",
|
|
"users.view": "View Users",
|
|
"users.manage": "Create and Edit Users",
|
|
"rbac.view": "View Roles and Permissions",
|
|
"rbac.manage": "Manage Roles and Permissions",
|
|
"audit.view": "View Audit Logs",
|
|
"alerts.view_self": "View Own Alerts",
|
|
"alerts.manage": "Create and Manage Alerts",
|
|
"users.invite": "Invite Users",
|
|
"users.reset_password": "Reset User Passwords",
|
|
"services.view": "View Services",
|
|
"services.create": "Create Services",
|
|
"services.edit": "Edit Services",
|
|
"services.deactivate": "Deactivate Services",
|
|
"services.cross_branch": "Manage Services Across Branches",
|
|
"services.cross_tenant": "Manage Services Across Tenants",
|
|
"services.catalogue.manage": "Manage System Service Catalogue",
|
|
"services.selection.manage": "Enable or Disable Firm Services",
|
|
"services.aqmm.view": "View Engagement AQMM Workflow",
|
|
"services.aqmm.manage": "Manage Engagement AQMM Workflow",
|
|
"services.aqmm.approve": "Approve Engagement AQMM Workflow",
|
|
"service_tasks.view": "View Service Task Templates",
|
|
"service_tasks.create": "Create Service Task Templates",
|
|
"service_tasks.edit": "Edit Service Task Templates",
|
|
"service_tasks.deactivate": "Deactivate Service Task Templates",
|
|
"clients.view": "View Clients",
|
|
"clients.create": "Create Clients",
|
|
"clients.import": "Import Clients from Excel",
|
|
"clients.edit": "Edit Clients",
|
|
"clients.deactivate": "Deactivate Clients",
|
|
"clients.activate": "Activate Clients",
|
|
"clients.archive": "Archive Clients",
|
|
"clients.restore": "Restore Clients",
|
|
"clients.assign_partner": "Assign Partner to Clients",
|
|
"clients.cross_branch": "Manage Clients Across Branches",
|
|
"clients.cross_tenant": "Manage Clients Across Tenants",
|
|
"clients.export": "Export Clients",
|
|
"clients.audit_log.view": "View Client Audit Logs",
|
|
"clients.view.own_only": "View Only Own Clients",
|
|
|
|
"employees.dashboard.view": "View HR Dashboard and Reports",
|
|
"employees.view": "View Employees",
|
|
"employees.create": "Create Employees",
|
|
"employees.edit": "Edit Employees",
|
|
"employees.status": "Change Employee Status",
|
|
"employees.cross_branch": "Manage Employees Across Branches",
|
|
"employees.cross_tenant": "Manage Employees Across Tenants",
|
|
"employees.ess.view": "View Employee Self Service Portal",
|
|
"employees.ess.profile.edit": "Edit Own Employee Profile",
|
|
"employees.work.view_self": "View Own Engagement Work Dashboard",
|
|
"employees.work.manage": "Manage Employee Engagement Work Allocation",
|
|
"employees.progress.view": "View Engagement Progress Dashboard",
|
|
"employees.registration.request": "Request Employee Profile Linkage",
|
|
"employees.registration.approve": "Approve Employee Registration Requests",
|
|
"employees.attendance.punch": "Punch Employee Attendance",
|
|
"employees.attendance.view_self": "View Own Attendance",
|
|
"employees.attendance.view_all": "View Employee Attendance",
|
|
"employees.attendance.approve": "Approve or Manage Employee Attendance",
|
|
"employees.leave.apply": "Apply Employee Leave",
|
|
"employees.leave.view_self": "View Own Leave",
|
|
"employees.leave.view_all": "View Employee Leave Requests",
|
|
"employees.leave.approve": "Approve Employee Leave Requests",
|
|
"employees.leave_type.manage": "Manage Employee Leave Types",
|
|
"employees.leave_balance.manage": "Manage Employee Leave Balances",
|
|
"employees.document_type.manage": "Manage Employee Document Types",
|
|
"employees.documents.delete": "Archive Employee Documents",
|
|
"employees.documents.verify": "Verify Employee Documents",
|
|
"employees.documents.manage": "Upload and Manage Employee Documents",
|
|
"employees.documents.view_all": "View Employee Documents",
|
|
"employees.documents.upload_self": "Upload Own Employee Documents",
|
|
"employees.documents.view_self": "View Own Employee Documents",
|
|
"employees.onboarding.view": "View Employee Onboarding",
|
|
"employees.onboarding.manage": "Manage Employee Onboarding Checklist and Tasks",
|
|
"employees.onboarding.approve": "Complete or Approve Employee Onboarding Tasks",
|
|
"employees.offboarding.view": "View Employee Offboarding",
|
|
"employees.offboarding.manage": "Manage Employee Offboarding",
|
|
"employees.offboarding.approve": "Approve and Complete Employee Offboarding",
|
|
"employees.offboarding.request_self": "Request Own Employee Offboarding",
|
|
"employees.payroll.structure.manage": "Manage Employee Salary Structures",
|
|
"employees.payroll.run": "Run Employee Payroll",
|
|
"employees.payroll.view": "View Employee Payroll and Payslips",
|
|
"employees.payroll.view_self": "View Own Payslips",
|
|
"employees.payroll.payout": "Approve or Mark Payroll Paid",
|
|
"employees.import": "Import Employee HR Data from Excel",
|
|
"employees.import.employee": "Import Employees from Excel",
|
|
"employees.import.leave_type": "Import Employee Leave Types from Excel",
|
|
"employees.import.leave_balance": "Import Employee Leave Balances from Excel",
|
|
"employees.import.salary_structure": "Import Employee Salary Structures from Excel",
|
|
"consultants.view": "View Consultants",
|
|
"consultants.manage": "Create and Edit Consultants",
|
|
"consultants.link_clients": "Link Consultants to Clients",
|
|
"consultants.cross_branch": "Manage Consultants Across Branches",
|
|
"consultants.portal.view": "View Consultant Portal",
|
|
"consultants.managed_clients.manage": "Manage Own Consultant Portal Clients",
|
|
"consultants.workspace.manage": "Manage Own Consultant SaaS Workspace",
|
|
"consultants.service_requests.manage": "Review Consultant Service Requests",
|
|
"consultants.conversions.manage": "Approve Consultant Managed Client Conversions",
|
|
|
|
"billing.view": "View Billing Invoices",
|
|
"billing.create": "Create Billing Invoices",
|
|
"billing.edit": "Edit Billing Invoices",
|
|
"billing.approve": "Approve Billing Invoices",
|
|
"billing.post": "Post Billing Invoices",
|
|
"billing.cancel": "Cancel Billing Invoices",
|
|
"billing.payment.create": "Record Billing Payments",
|
|
"billing.payment.view": "View Billing Payments",
|
|
"billing.reports": "View Billing Reports",
|
|
"billing.cross_branch": "Manage Billing Across Branches",
|
|
"billing.cross_tenant": "Manage Billing Across Audit Firms",
|
|
"billing.view_own": "View Own Client Billing Only",
|
|
"billing_fee_structure.view": "View Billing Fee Structure",
|
|
"billing_fee_structure.import": "Import Billing Fee Structure",
|
|
"billing_fee_structure.edit": "Edit Billing Fee Structure",
|
|
"billing_fee_structure.delete": "Delete Billing Fee Structure",
|
|
"billing_invoice.generate": "Generate Billing Invoices",
|
|
"billing_invoice.bulk_generate": "Bulk Generate Billing Invoices",
|
|
|
|
"platform_billing.view": "View Platform Billing",
|
|
"platform_billing.create": "Create Platform Billing Accounts and Invoices",
|
|
"platform_billing.edit": "Edit Platform Billing Records",
|
|
"platform_billing.generate": "Generate Platform Billing Invoices",
|
|
"platform_billing.post": "Post Platform Invoices",
|
|
"platform_billing.cancel": "Cancel Platform Invoices",
|
|
"platform_billing.payment.create": "Record Platform Billing Payments",
|
|
"platform_billing.payment.view": "View Platform Billing Payments",
|
|
"platform_billing.reports": "View Platform Billing Reports",
|
|
"platform_plans.manage": "Manage Platform Billing Plans",
|
|
"platform_subscriptions.manage": "Manage Platform Subscriptions",
|
|
|
|
# Marketplace / public lead permissions
|
|
"marketplace_leads.view": "View Marketplace Leads",
|
|
"marketplace_leads.create": "Create Marketplace Leads",
|
|
"marketplace_leads.assign": "Assign Marketplace Leads to Audit Firms",
|
|
"marketplace_leads.update": "Update Marketplace Lead Status",
|
|
"marketplace_leads.convert": "Convert Marketplace Leads to Clients",
|
|
"marketplace_leads.reports": "View Marketplace Lead Reports",
|
|
"marketplace_leads.view_assigned": "View Assigned Marketplace Leads",
|
|
|
|
"documents.view": "View Engagement Documents",
|
|
"documents.upload": "Upload Engagement Documents",
|
|
"documents.download": "Download Engagement Documents",
|
|
"documents.delete": "Archive Engagement Documents",
|
|
"documents.audit.view": "View Document Access Logs",
|
|
|
|
"notice_cases.view": "View Notice and Case Management",
|
|
"notice_cases.create": "Create Notices and Cases",
|
|
"notice_cases.edit": "Edit Notices and Cases",
|
|
"notice_cases.events.manage": "Manage Notice/Case Timeline Events",
|
|
"notice_cases.hearings.manage": "Manage Notice/Case Hearings",
|
|
"notice_cases.orders.manage": "Manage Notice/Case Orders",
|
|
"notice_cases.documents.upload": "Upload Notice/Case Documents",
|
|
"notice_cases.documents.download": "Download Notice/Case Documents",
|
|
"notice_cases.documents.delete": "Archive Notice/Case Documents",
|
|
"notice_cases.cross_branch": "Manage Notices/Cases Across Branches",
|
|
"notice_cases.cross_tenant": "Manage Notices/Cases Across Tenants",
|
|
"notice_cases.view.own_only": "View Only Own Assigned Notices/Cases",
|
|
}
|
|
|
|
PERMISSION_ALIASES = {
|
|
"system.settings.manage": ["system.settings.edit"],
|
|
"system.settings.edit": ["system.settings.manage"],
|
|
}
|
|
|
|
|
|
def expand_permission_codes(code: str) -> list[str]:
|
|
codes = [code]
|
|
for alias in PERMISSION_ALIASES.get(code, []):
|
|
if alias not in codes:
|
|
codes.append(alias)
|
|
return codes
|