PagePermissions class
Adds convenience methods to all Page objects for checking permissions, i.e.
if($page->editable()) { do something } if(!$page->viewable()) { echo "sorry you can't view this"; } ...and so on...
Optional special permissions that are optional (by default, not installed):
page-publish: when installed, editable() returns false, when it would otherwise return true, on published pages, if user doesn't have page-publish permission in their roles.
page-edit-created: when installed, editable() returns false, when it would otherwise return true, if user's role has this permission and they are not the $page->createdUser. This is a permission that reduces access rather than increasing it. Note that page-edit-created does nothing if the user doesn't have page-edit permission.
page-rename: when installed, user must have this permission in their role before they can change the name of a published page. They can still change the name of an unpublished page. When not installed, this permission falls back to page-edit.
page-edit-lang-default: when installed on a multi-language site, user must have this permission in order edit multi-language fields in "default" language. This permission is also required to create or delete pages (if user already has other permissions that enable them to create or delete pages).
page-edit-lang-[language_name]: when installed on a multi-language site, user must have this permission to edit multi-language fields in the [language_name] language.
page-edit-lang-none: when installed on a multi-language site, user must have this permission to edit non-multi-language fields. They must also have it to create or delete pages (if user already has other permissions that enable that).
user-admin-all: when installed, a user must have this permission in order to edit other users of all roles (except superuser of course). When installed, the regular user-admin permission only acts as a pre-requisite for editing users, and enables only listing users, and editing users that have only the 'guest' role. The user-admin-all essentially grants the same thing as user-admin permission does on a system that has no user-admin-all permission installed. That's what it does, but why is it here? The entire purpose is to support user-admin-[role] permissions, as described in the next item below:
user-admin-[role_name]: when installed on a site that also has user-admin-all permission installed, a user must have this permission (along with user-admin permission) in order to edit users in role [role_name], or to grant that role to other guest users, or to revoke it from them. Think of this permission as granting a user administrative privileges to just a specific group of users. Note that there would be no reason to combine this permission with the user-admin-all permission, as user-admin-all permission grants admin privileges to all roles.
Click any linked item for full usage details and examples. Hookable methods are indicated with the icon. In addition to those shown below, the Page
class also inherits all the methods and properties of: WireData and Wire.
Common
Additional methods and properties
In addition to the methods and properties above, Page
API reference based on ProcessWire core version 3.0.251