public final class GroupPermission
extends java.security.Permission
implements java.io.Serializable
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
implies view
delete
implies edit
and
view
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 com.ecyrd.jspwiki.auth.authorize.Role "Authenticated" { permission com.ecyrd.jspwiki.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.Modifier and Type | Field and Description |
---|---|
static GroupPermission |
DELETE
Convenience constant that denotes
GroupPermission( "*:*, "delete" ) . |
static java.lang.String |
DELETE_ACTION
Action for deleting a group or collection of groups.
|
static GroupPermission |
EDIT
Convenience constant that denotes
GroupPermission( "*:*, "edit" ) . |
static java.lang.String |
EDIT_ACTION
Action for editing a group or collection of groups.
|
static java.lang.String |
MEMBER_TOKEN
Special target token that denotes all groups that a Subject's Principals are members of.
|
static GroupPermission |
VIEW
Convenience constant that denotes
GroupPermission( "*:*, "view" ) . |
static java.lang.String |
VIEW_ACTION
Action for viewing a group or collection of groups.
|
Modifier | Constructor and Description |
---|---|
protected |
GroupPermission()
For serialization purposes
|
|
GroupPermission(java.lang.String group,
java.lang.String actions)
Creates a new GroupPermission for a specified group and set of actions.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj)
Two PagePermission objects are considered equal if their actions (after
normalization), wiki and target are equal.
|
java.lang.String |
getActions()
Returns the actions for this permission: “view”, “edit”, or “delete”.
|
java.lang.String |
getGroup()
Returns the name of the wiki group represented by this permission.
|
java.lang.String |
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(java.security.Permission permission)
GroupPermissions can only imply other GroupPermissions; no other
permission types are implied.
|
java.lang.String |
toString()
Prints a human-readable representation of this permission.
|
public static final java.lang.String MEMBER_TOKEN
public static final java.lang.String DELETE_ACTION
public static final java.lang.String EDIT_ACTION
public static final java.lang.String VIEW_ACTION
public static final GroupPermission DELETE
GroupPermission( "*:*, "delete" )
.public static final GroupPermission EDIT
GroupPermission( "*:*, "edit" )
.public static final GroupPermission VIEW
GroupPermission( "*:*, "view" )
.protected GroupPermission()
public GroupPermission(java.lang.String group, java.lang.String actions)
group
- the wiki groupactions
- the allowed actions for this grouppublic boolean equals(java.lang.Object obj)
equals
in class java.security.Permission
obj
- the object to compareObject.equals(java.lang.Object)
public java.lang.String getActions()
getActions
in class java.security.Permission
Permission.getActions()
public java.lang.String getGroup()
public java.lang.String getWiki()
@CheckReturnValue public int hashCode()
hashCode
in class java.security.Permission
Object.hashCode()
public boolean implies(java.security.Permission permission)
GroupPermissions can only imply other GroupPermissions; no other permission types are implied. One GroupPermission implies another if its actions if three conditions are met:
implies
in class java.security.Permission
permission
- the Permission to examinetrue
if the GroupPermission implies the
supplied Permission; false
otherwisePermission.implies(java.security.Permission)
@CheckReturnValue @Nonnull public java.lang.String toString()
toString
in class java.security.Permission
Object.toString()
stSoftware Copyright © 2001-2014 stSoftware All Rights Reserved.