Class PagePermission
- All Implemented Interfaces:
Serializable,Guard
Permission to perform an operation on a single page or collection of pages in
a given wiki. Permission actions include: view,
edit (edit the text of a wiki page), comment,
upload, modify (edit text and upload
attachments), delete
and rename.
The target of a permission is a single page or collection in a given wiki. The syntax for the target is the wiki name, followed by a colon (:) and the name of the page. "All wikis" can be specified using a wildcard (*). Page collections may also be specified using a wildcard. For pages, the wildcard may be a prefix, suffix, or all by itself. Examples of targets include:
*:*
*:JanneJalkanen
*:Jalkanen
*:Janne*
mywiki:JanneJalkanen
mywiki:*Jalkanen
mywiki:Janne*
For a given target, certain permissions imply others:
deleteandrenameimplyeditmodifyimplieseditanduploadeditimpliescommentandviewcommentanduploadimplyview
Targets that do not include a wiki prefix never imply others.
- Since:
- 2.3
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PagePermissionA static instance of the comment permission.static final StringAction name for the comment permission.static final PagePermissionA static instance of the delete permission.static final StringAction name for the delete permission.static final PagePermissionA static instance of the edit permission.static final StringAction name for the edit permission.static final PagePermissionA static instance of the modify permission.static final StringAction name for the modify permission.static final PagePermissionA static instance of the rename permission.static final StringAction name for the rename permission.static final PagePermissionA static instance of the upload permission.static final StringAction name for the upload permission.static final PagePermissionA static instance of the view permission.static final StringAction name for the view permission. -
Constructor Summary
ConstructorsConstructorDescriptionPagePermission(String page, String actions) Creates a new PagePermission for a specified page name and set of actions.PagePermission(Page page, String actions) Creates a new PagePermission for a specified page and set of actions. -
Method Summary
Modifier and TypeMethodDescriptionbooleanTwo PagePermission objects are considered equal if their actions (after normalization), wiki and target are equal.Returns the actions for this permission: "view", "edit", "comment", "modify", "upload" or "delete".getPage()Returns the name of the wiki page represented by this permission.getWiki()Returns the name of the wiki containing the page represented by this permission; may return the wildcard string.inthashCode()Returns the hash code for this PagePermission.booleanimplies(Permission permission) PagePermission can only imply other PagePermissions; no other permission types are implied.Returns a newAllPermissionCollection.toString()Prints a human-readable representation of this permission.Methods inherited from class java.security.Permission
checkGuard, getName
-
Field Details
-
COMMENT_ACTION
Action name for the comment permission.- See Also:
-
DELETE_ACTION
Action name for the delete permission.- See Also:
-
EDIT_ACTION
Action name for the edit permission.- See Also:
-
MODIFY_ACTION
Action name for the modify permission.- See Also:
-
RENAME_ACTION
Action name for the rename permission.- See Also:
-
UPLOAD_ACTION
Action name for the upload permission.- See Also:
-
VIEW_ACTION
Action name for the view permission.- See Also:
-
COMMENT
A static instance of the comment permission. -
DELETE
A static instance of the delete permission. -
EDIT
A static instance of the edit permission. -
RENAME
A static instance of the rename permission. -
MODIFY
A static instance of the modify permission. -
UPLOAD
A static instance of the upload permission. -
VIEW
A static instance of the view permission.
-
-
Constructor Details
-
PagePermission
Creates a new PagePermission for a specified page name and set of actions. Page should include a prepended wiki name followed by a colon (:). If the wiki name is not supplied or starts with a colon, the page refers to no wiki in particular, and will never imply any other PagePermission.- Parameters:
page- the wiki pageactions- the allowed actions for this page
-
PagePermission
Creates a new PagePermission for a specified page and set of actions.- Parameters:
page- The wikipage.actions- A set of actions; a comma-separated list of actions.
-
-
Method Details
-
equals
Two PagePermission objects are considered equal if their actions (after normalization), wiki and target are equal.- Specified by:
equalsin classPermission- Parameters:
obj-- Returns:
-
getActions
Returns the actions for this permission: "view", "edit", "comment", "modify", "upload" or "delete". The actions will always be sorted in alphabetic order, and will always appear in lower case.- Specified by:
getActionsin classPermission- Returns:
-
getPage
Returns the name of the wiki page represented by this permission.- Returns:
- the page name
-
getWiki
Returns the name of the wiki containing the page represented by this permission; may return the wildcard string.- Returns:
- the wiki
-
hashCode
Returns the hash code for this PagePermission.- Specified by:
hashCodein classPermission- Returns:
-
implies
PagePermission can only imply other PagePermissions; no other permission types are implied. One PagePermission implies another if its actions if three conditions are met:
- The other PagePermission's wiki is equal to, or a subset of, that of this permission. This permission's wiki is considered a superset of the other if it contains a matching prefix plus a wildcard, or a wildcard followed by a matching suffix.
- The other PagePermission's target is equal to, or a subset of, the target specified by this permission. This permission's target is considered a superset of the other if it contains a matching prefix plus a wildcard, or a wildcard followed by a matching suffix.
- All of other PagePermission's actions are equal to, or a subset of, those of this permission
- Specified by:
impliesin classPermission- Parameters:
permission-- Returns:
- See Also:
-
newPermissionCollection
Returns a newAllPermissionCollection.- Overrides:
newPermissionCollectionin classPermission- Returns:
- See Also:
-
toString
Prints a human-readable representation of this permission.- Overrides:
toStringin classPermission- Returns:
- Something human-readable
- See Also:
-