Package org.apache.wiki.auth.permissions
Class WikiPermission
java.lang.Object
java.security.Permission
org.apache.wiki.auth.permissions.WikiPermission
- All Implemented Interfaces:
Serializable,Guard
public final class WikiPermission extends Permission implements Serializable
Permission to perform an global wiki operation, such as self-registering
or creating new pages. Permission actions include: createGroups,
createPages, editPreferences,
editProfile and login.
The target is a given wiki. The syntax for the target is the wiki name. "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.
Certain permissions imply others. Currently,
createGroups implies createPages.
- Since:
- 2.3
- See Also:
- Serialized Form
-
Field Summary
Fields Modifier and Type Field Description static WikiPermissionCREATE_GROUPSA static instance of the createGroups permission.static StringCREATE_GROUPS_ACTIONName of the action for createGroups permission.protected static intCREATE_GROUPS_MASKstatic WikiPermissionCREATE_PAGESA static instance of the createPages permission.static StringCREATE_PAGES_ACTIONName of the action for createPages permission.protected static intCREATE_PAGES_MASKstatic WikiPermissionEDIT_PREFERENCESA static instance of the editPreferences permission.static StringEDIT_PREFERENCES_ACTIONName of the action for editPreferences permission.protected static intEDIT_PREFERENCES_MASKstatic WikiPermissionEDIT_PROFILEA static instance of the editProfile permission.static StringEDIT_PROFILE_ACTIONName of the action for editProfile permission.protected static intEDIT_PROFILE_MASKstatic WikiPermissionLOGINA static instance of the login permission.static StringLOGIN_ACTIONName of the action for login permission.protected static intLOGIN_MASKstatic StringWILDCARDValue for a generic wildcard. -
Constructor Summary
Constructors Constructor Description WikiPermission(String wiki, String actions)Creates a new WikiPermission for a specified set of actions. -
Method Summary
Modifier and Type Method Description protected static intcreateMask(String actions)Private method that creates a binary mask based on the actions specified.booleanequals(Object obj)Two WikiPermission objects are considered equal if their wikis and actions (after normalization) are equal.StringgetActions()Returns the actions for this permission: "createGroups", "createPages", "editPreferences", "editProfile", or "login".StringgetWiki()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 WikiPermission.protected static intimpliedMask(int mask)Creates an "implied mask" based on the actions originally assigned: for example,createGroupsimpliescreatePages.booleanimplies(Permission permission)WikiPermission can only imply other WikiPermissions; no other permission types are implied.PermissionCollectionnewPermissionCollection()Returns a newAllPermissionCollection.StringtoString()Prints a human-readable representation of this permission.Methods inherited from class java.security.Permission
checkGuard, getName
-
Field Details
-
CREATE_GROUPS_ACTION
Name of the action for createGroups permission.- See Also:
- Constant Field Values
-
CREATE_PAGES_ACTION
Name of the action for createPages permission.- See Also:
- Constant Field Values
-
LOGIN_ACTION
Name of the action for login permission.- See Also:
- Constant Field Values
-
EDIT_PREFERENCES_ACTION
Name of the action for editPreferences permission.- See Also:
- Constant Field Values
-
EDIT_PROFILE_ACTION
Name of the action for editProfile permission.- See Also:
- Constant Field Values
-
WILDCARD
Value for a generic wildcard.- See Also:
- Constant Field Values
-
CREATE_GROUPS_MASK
- See Also:
- Constant Field Values
-
CREATE_PAGES_MASK
- See Also:
- Constant Field Values
-
EDIT_PREFERENCES_MASK
- See Also:
- Constant Field Values
-
EDIT_PROFILE_MASK
- See Also:
- Constant Field Values
-
LOGIN_MASK
- See Also:
- Constant Field Values
-
CREATE_GROUPS
A static instance of the createGroups permission. -
CREATE_PAGES
A static instance of the createPages permission. -
LOGIN
A static instance of the login permission. -
EDIT_PREFERENCES
A static instance of the editPreferences permission. -
EDIT_PROFILE
A static instance of the editProfile permission.
-
-
Constructor Details
-
WikiPermission
Creates a new WikiPermission for a specified set of actions.- Parameters:
actions- the actions for this permissionwiki- The name of the wiki the permission belongs to.
-
-
Method Details
-
equals
Two WikiPermission objects are considered equal if their wikis and actions (after normalization) are equal.- Specified by:
equalsin classPermission- Parameters:
obj- the object to test- Returns:
- the result
- See Also:
Object.equals(java.lang.Object)
-
getActions
Returns the actions for this permission: "createGroups", "createPages", "editPreferences", "editProfile", or "login". The actions will always be sorted in alphabetic order, and will always appear in lower case.- Specified by:
getActionsin classPermission- Returns:
- the actions
- See Also:
Permission.getActions()
-
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 WikiPermission.- Specified by:
hashCodein classPermission- Returns:
-
implies
WikiPermission can only imply other WikiPermissions; no other permission types are implied. One WikiPermission implies another if all of the other WikiPermission's actions are equal to, or a subset of, those for this permission.- Specified by:
impliesin classPermission- Parameters:
permission- the permission which may (or may not) be implied by this instance- Returns:
trueif the permission is implied,falseotherwise- See Also:
Permission.implies(java.security.Permission)
-
newPermissionCollection
Returns a newAllPermissionCollection.- Overrides:
newPermissionCollectionin classPermission- Returns:
-
toString
Prints a human-readable representation of this permission.- Overrides:
toStringin classPermission- Returns:
-
impliedMask
Creates an "implied mask" based on the actions originally assigned: for example,createGroupsimpliescreatePages.- Parameters:
mask- the initial mask- Returns:
- the implied mask
-
createMask
Private method that creates a binary mask based on the actions specified. This is used byimplies(Permission).- Parameters:
actions- the permission actions, separated by commas- Returns:
- binary mask representing the permissions
-