Class GroupPermission
- All Implemented Interfaces:
Serializable
,Guard
Permission to perform an operation on a group in a given wiki. Permission
actions include: view
, edit
, delete
.
The target of a permission is a single group or collection in a given wiki. The syntax for the target is the wiki name, followed by a colon (:) and the name of the group. “All wikis” can be specified using a wildcard (*). Group collections may also be specified using a wildcard. For groups, the wildcard may be a prefix, suffix, or all by itself. Examples of targets include:
*:*
*:TestPlanners
*:*Planners
*:Test*
mywiki:TestPlanners
mywiki:*Planners
mywiki:Test*
For a given target, certain permissions imply others:
edit
impliesview
delete
impliesedit
andview
Targets that do not include a wiki prefix never imply others.
GroupPermission accepts a special target called
<groupmember>
that means “all groups that a user is a
member of.” When included in a policy file grant
block, it
functions like a wildcard. Thus, this block:
grant signedBy "jspwiki", principal org.apache.wiki.auth.authorize.Role "Authenticated" { permission org.apache.wiki.auth.permissions.GroupPermission "*:<groupmember>", "edit";means, “allow Authenticated users to edit any groups they are members of.” The wildcard target (*) does not imply
<groupmember>
; it
must be granted explicitly.- Since:
- 2.4.17
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final GroupPermission
Convenience constant that denotesGroupPermission( "*:*, "delete" )
.static final String
Action for deleting a group or collection of groups.static final GroupPermission
Convenience constant that denotesGroupPermission( "*:*, "edit" )
.static final String
Action for editing a group or collection of groups.static final String
Special target token that denotes all groups that a Subject's Principals are members of.static final GroupPermission
Convenience constant that denotesGroupPermission( "*:*, "view" )
.static final String
Action for viewing a group or collection of groups. -
Constructor Summary
ConstructorsConstructorDescriptionGroupPermission
(String group, String actions) Creates a new GroupPermission for a specified group and set of actions. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Two PagePermission objects are considered equal if their actions (after normalization), wiki and target are equal.Returns the actions for this permission: “view”, “edit”, or “delete”.getGroup()
Returns the name of the wiki group represented by this permission.getWiki()
Returns the name of the wiki containing the group represented by this permission; may return the wildcard string.int
hashCode()
Returns the hash code for this GroupPermission.boolean
implies
(Permission permission) GroupPermissions can only imply other GroupPermissions; no other permission types are implied.toString()
Prints a human-readable representation of this permission.Methods inherited from class java.security.Permission
checkGuard, getName, newPermissionCollection
-
Field Details
-
MEMBER_TOKEN
Special target token that denotes all groups that a Subject's Principals are members of.- See Also:
-
DELETE_ACTION
Action for deleting a group or collection of groups.- See Also:
-
EDIT_ACTION
Action for editing a group or collection of groups.- See Also:
-
VIEW_ACTION
Action for viewing a group or collection of groups.- See Also:
-
DELETE
Convenience constant that denotesGroupPermission( "*:*, "delete" )
. -
EDIT
Convenience constant that denotesGroupPermission( "*:*, "edit" )
. -
VIEW
Convenience constant that denotesGroupPermission( "*:*, "view" )
.
-
-
Constructor Details
-
GroupPermission
Creates a new GroupPermission for a specified group and set of actions. Group should include a prepended wiki name followed by a colon (:). If the wiki name is not supplied or starts with a colon, the group refers to all wikis.- Parameters:
group
- the wiki groupactions
- the allowed actions for this group
-
-
Method Details
-
equals
Two PagePermission objects are considered equal if their actions (after normalization), wiki and target are equal.- Specified by:
equals
in classPermission
- Parameters:
obj
- the object to compare- Returns:
- the result of the comparison
- See Also:
-
getActions
Returns the actions for this permission: “view”, “edit”, or “delete”. The actions will always be sorted in alphabetic order, and will always appear in lower case.- Specified by:
getActions
in classPermission
- Returns:
- the actions
- See Also:
-
getGroup
Returns the name of the wiki group represented by this permission.- Returns:
- the page name
-
getWiki
Returns the name of the wiki containing the group represented by this permission; may return the wildcard string.- Returns:
- the wiki
-
hashCode
Returns the hash code for this GroupPermission.- Specified by:
hashCode
in classPermission
- Returns:
- the hash code
- See Also:
-
implies
GroupPermissions can only imply other GroupPermissions; no other permission types are implied. One GroupPermission implies another if its actions if three conditions are met:
- The other GroupPermission’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 GroupPermission’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 GroupPermission’s actions are equal to, or a subset of, those of this permission
- Specified by:
implies
in classPermission
- Parameters:
permission
- the Permission to examine- Returns:
true
if the GroupPermission implies the supplied Permission;false
otherwise- See Also:
-
toString
Prints a human-readable representation of this permission.- Overrides:
toString
in classPermission
- Returns:
- the string
- See Also:
-