PermissionTemplateAssignmentGuard
class PermissionTemplateAssignmentGuard (View source)
Gates perm_templ assignment on user create/update API paths.
Without this gate, any caller with user_add_new could create a new ueberuser
by supplying perm_templ equal to the Administrator template id, and any
caller with user_edit_own could self-elevate via PUT /users/{self}. Mirrors
the web UI policy: a caller may only choose a template that stays within the
authority they already hold, and retemplating their own account additionally
requires user_edit_others; everyone else gets the supplied value rejected
or, when omitted, a safe minimal-template default in place of the repository's
historical fallback to template id 1 (Administrator).
Methods
Apply the gate to a create/update input array.
Details
static string|null
apply(PermissionService $permissionService, int|null $defaultUserTemplateId, int $callerId, array $input, int|null $targetUserId)
Apply the gate to a create/update input array.