public final class PagePermission extends Permission implements Serializable
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:
delete
and rename
imply edit
modify
implies edit
and upload
edit
implies comment
and view
comment
and upload
imply view
Modifier and Type | Field and Description |
---|---|
static PagePermission |
COMMENT
A static instance of the comment permission.
|
static String |
COMMENT_ACTION
Action name for the comment permission.
|
protected static int |
COMMENT_MASK |
static PagePermission |
DELETE
A static instance of the delete permission.
|
static String |
DELETE_ACTION
Action name for the delete permission.
|
protected static int |
DELETE_MASK |
static PagePermission |
EDIT
A static instance of the edit permission.
|
static String |
EDIT_ACTION
Action name for the edit permission.
|
protected static int |
EDIT_MASK |
static PagePermission |
MODIFY
A static instance of the modify permission.
|
static String |
MODIFY_ACTION
Action name for the modify permission.
|
protected static int |
MODIFY_MASK |
static PagePermission |
RENAME
A static instance of the rename permission.
|
static String |
RENAME_ACTION
Action name for the rename permission.
|
protected static int |
RENAME_MASK |
static PagePermission |
UPLOAD
A static instance of the upload permission.
|
static String |
UPLOAD_ACTION
Action name for the upload permission.
|
protected static int |
UPLOAD_MASK |
static PagePermission |
VIEW
A static instance of the view permission.
|
static String |
VIEW_ACTION
Action name for the view permission.
|
protected static int |
VIEW_MASK |
Modifier | Constructor and Description |
---|---|
protected |
PagePermission()
For serialization purposes.
|
|
PagePermission(String page,
String actions)
Creates a new PagePermission for a specified page name and set of
actions.
|
|
PagePermission(WikiPage page,
String actions)
Creates a new PagePermission for a specified page and set of actions.
|
Modifier and Type | Method and Description |
---|---|
protected static int |
createMask(String actions)
Private method that creates a binary mask based on the actions specified.
|
boolean |
equals(Object obj)
Two PagePermission objects are considered equal if their actions (after
normalization), wiki and target are equal.
|
String |
getActions()
Returns the actions for this permission: "view", "edit", "comment",
"modify", "upload" or "delete".
|
String |
getPage()
Returns the name of the wiki page represented by this permission.
|
String |
getWiki()
Returns the name of the wiki containing the page represented by
this permission; may return the wildcard string.
|
int |
hashCode()
Returns the hash code for this PagePermission.
|
protected static int |
impliedMask(int mask)
Creates an "implied mask" based on the actions originally assigned: for
example, delete implies modify, comment, upload and view.
|
boolean |
implies(Permission permission)
PagePermission can only imply other PagePermissions; no other permission
types are implied.
|
protected static boolean |
isSubset(String superSet,
String subSet)
Determines whether one target string is a logical subset of the other.
|
PermissionCollection |
newPermissionCollection()
Returns a new
AllPermissionCollection . |
String |
toString()
Prints a human-readable representation of this permission.
|
checkGuard, getName
public static final String COMMENT_ACTION
public static final String DELETE_ACTION
public static final String EDIT_ACTION
public static final String MODIFY_ACTION
public static final String RENAME_ACTION
public static final String UPLOAD_ACTION
public static final String VIEW_ACTION
protected static final int COMMENT_MASK
protected static final int DELETE_MASK
protected static final int EDIT_MASK
protected static final int MODIFY_MASK
protected static final int RENAME_MASK
protected static final int UPLOAD_MASK
protected static final int VIEW_MASK
public static final PagePermission COMMENT
public static final PagePermission DELETE
public static final PagePermission EDIT
public static final PagePermission RENAME
public static final PagePermission MODIFY
public static final PagePermission UPLOAD
public static final PagePermission VIEW
protected PagePermission()
public PagePermission(String page, String actions)
page
- the wiki pageactions
- the allowed actions for this pagepublic PagePermission(WikiPage page, String actions)
page
- The wikipage.actions
- A set of actions; a comma-separated list of actions.public boolean equals(Object obj)
equals
in class Permission
obj
- public String getActions()
getActions
in class Permission
public String getPage()
public String getWiki()
public int hashCode()
hashCode
in class Permission
public boolean implies(Permission permission)
PagePermission can only imply other PagePermissions; no other permission types are implied. One PagePermission implies another if its actions if three conditions are met:
implies
in class Permission
permission
- Permission.implies(java.security.Permission)
public PermissionCollection newPermissionCollection()
AllPermissionCollection
.newPermissionCollection
in class Permission
Permission.newPermissionCollection()
public String toString()
toString
in class Permission
Object.toString()
protected static int impliedMask(int mask)
mask
- binary mask for actionsprotected static boolean isSubset(String superSet, String subSet)
superSet
- the prospective supersetsubSet
- the prospective subsettrue
indicates that
subSet
is a subset of superSet
protected static int createMask(String actions)
implies(Permission)
.actions
- the actions for this permission, separated by commasCopyright © 2001-2019 The Apache Software Foundation. All rights reserved.