ZoneTemplateAccessPolicy
class ZoneTemplateAccessPolicy (View source)
What the acting user may do with zone templates: which template a zone may be created from, who owns a template, which record types may be stored in one, and how far the linked-zone listings reach.
Methods
No description
Check if the logged-in user has the given permission (admins always pass)
The logged-in user's edit level: "all", "own", "own_as_client" or "none".
Confirm the current user may store this record type in a zone template.
Resolve the owner column for a template. A global template (owner 0) is reserved for ueberusers; anyone else owns the template personally.
Owner column to write when a template is edited, or null to keep the stored one.
Owner the zone listings are narrowed to: null when the user may edit every zone, otherwise the user themselves.
Whether a posted template id may be applied to a zone.
Whether the user may see a template and create zones from it: a global template, their own, one shared with a group they belong to, or any template for an administrator. A missing template is never visible.
canViewTemplate() for the logged-in user.
canUseTemplate() for the logged-in user.
Check if the user is the owner of the zone template
Whether the logged-in user may edit a template and its records: a ueberuser, or a holder of zone_templ_edit who owns it or shares it through a group.
Whether the logged-in user may delete a template or change who it is shared with: a ueberuser, or the owner holding zone_templ_edit. Group members may not.
canCurrentUserEditTemplate() for a stored template; false when it does not exist.
canCurrentUserManageTemplate() for a stored template; false when it does not exist.
Details
__construct(ZoneTemplateRepositoryInterface $repository, PermissionService $permissionService, ActorInterface $actor)
No description
bool
currentUserHasPermission(string $permission)
Check if the logged-in user has the given permission (admins always pass)
string
currentUserEditPermissionLevel()
The logged-in user's edit level: "all", "own", "own_as_client" or "none".
bool
canStoreTemplateRecordType(string $type)
Confirm the current user may store this record type in a zone template.
int
resolveTemplateOwner(bool $requestedGlobal, int $userid)
Resolve the owner column for a template. A global template (owner 0) is reserved for ueberusers; anyone else owns the template personally.
int|null
resolveEditedTemplateOwner(int $zone_templ_id, bool $requestedGlobal, int $userid)
Owner column to write when a template is edited, or null to keep the stored one.
Only a ueberuser changes it, by making the template global or by taking a global template back as their own; a group member never becomes the owner.
int|null
linkedZoneOwnerFilter(int $userid)
Owner the zone listings are narrowed to: null when the user may edit every zone, otherwise the user themselves.
bool
canUseTemplate(mixed $zone_templ_id, int $userid, bool $isAdmin)
Whether a posted template id may be applied to a zone.
Follows the listing scope: no template, or a template canViewTemplate() allows.
bool
canViewTemplate(int $zone_templ_id, int $userid, bool $isAdmin)
Whether the user may see a template and create zones from it: a global template, their own, one shared with a group they belong to, or any template for an administrator. A missing template is never visible.
bool
canCurrentUserViewTemplate(int $zone_templ_id)
canViewTemplate() for the logged-in user.
bool
canCurrentUserUseTemplate(mixed $zone_templ_id)
canUseTemplate() for the logged-in user.
bool
isUserOwnerOfTemplate(int $zone_templ_id, int $userid)
Check if the user is the owner of the zone template
bool
canCurrentUserEditTemplate(int $owner, bool $sharedWithUser = false)
Whether the logged-in user may edit a template and its records: a ueberuser, or a holder of zone_templ_edit who owns it or shares it through a group.
Global templates (owner 0) are only editable by ueberusers.
bool
canCurrentUserManageTemplate(int $owner)
Whether the logged-in user may delete a template or change who it is shared with: a ueberuser, or the owner holding zone_templ_edit. Group members may not.
bool
canCurrentUserEditTemplateById(int $zone_templ_id)
canCurrentUserEditTemplate() for a stored template; false when it does not exist.
bool
canCurrentUserManageTemplateById(int $zone_templ_id)
canCurrentUserManageTemplate() for a stored template; false when it does not exist.