Template::addPermissionByRole() method

Add a permission that applies to users having a specific role with pages using this template

Note that the change is not committed until you save() the template.

Usage

// basic usage
$bool = $template->addPermissionByRole($permission, $role);

// usage with all arguments
$bool = $template->addPermissionByRole($permission, $role, bool $test = false);

Arguments

NameType(s)Description
permissionPermission, int, string

Permission object, name, or id

roleRole, int, string

Role object, name or id

test (optional)bool

Specify true to only test if an update would be made, without changing anything

Return value

bool

Returns true if an update was made (or would be made), false if not


Template methods and properties

API reference based on ProcessWire core version 3.0.244

“ProcessWire is like a breath of fresh air. So powerful yet simple to build with and customise, and web editors love it too.” —Margaret Chatwin, Web developer