← Back to Activities Workflows

5.6.5 Activities Security Patterns

Activities combines tenant isolation, CakePHP policies, branch-scoped RBAC, ownership/parent rules, workflow approver resolution, validation, and narrow mass assignment. No single layer replaces the others.

Entity and collection authorization

ActivityPolicy/ActivityGroupPolicy protect individual configuration records. Their table policies protect collections and map grid scope to the index scope. AuthorizationPolicy adds domain actions for add, renew, revoke, retract, member/activity views, and reports.

Self-service is implemented through Member::canManageMember(), which supports the current member and the supported parent/minor relationship. Retraction is owner-management only; administrative revocation uses RBAC.

Approver discovery

An Activity identifies the required permission. Activity::getApproversQuery() delegates to PermissionsLoader with a branch ID, while the workflow provider/action resolves the approval participants. Never accept an arbitrary approver from the client without checking that query and workflow rules.

Input and output rules

Tenant and test rules

All permission, member, role, activity, and approval queries run inside one tenant. Cache permission results with tenant namespacing. Tests should cover self, parent/minor, unrelated member, branch-authorized administrator, wrong branch, eligible/ineligible approver, missing permission configuration, malformed IDs, and two tenants with colliding numeric IDs.