public class KeyValuePermission extends Object implements org.apache.shiro.authz.Permission
Constructor and Description |
---|
KeyValuePermission(String key)
Creates a new KeyValuePermission with the specified key and an empty list of values.
|
KeyValuePermission(String key,
List<String> values)
Deprecated.
|
KeyValuePermission(String key,
Set<String> values)
Creates a new KeyValuePermission with the specified key and corresponding list of values.
|
Modifier and Type | Method and Description |
---|---|
void |
addValue(String value)
Adds an additional value to the existing values.
|
String |
getKey() |
Set<String> |
getValues() |
boolean |
implies(org.apache.shiro.authz.Permission p)
Returns
true if this current instance implies all the functionality and/or
resource access described by the specified Permission argurment, false
otherwise. |
String |
toString()
Creates a string representation of this key/value permission object.
|
public KeyValuePermission(String key)
key
- the key to be used for this permissionpublic KeyValuePermission(String key, List<String> values)
key
- the key to be used for this permissionvalues
- the list of values to be used for this permissionIllegalArgumentException
- if the key is null - a valid key is requiredpublic KeyValuePermission(String key, Set<String> values)
key
- the key to be used for this permissionvalues
- the list of values to be used for this permissionIllegalArgumentException
- if the key is null - a valid key is requiredpublic String getKey()
public void addValue(String value)
value
- new value to be added to the existing values for this key/value pairpublic boolean implies(org.apache.shiro.authz.Permission p)
true
if this current instance implies all the functionality and/or
resource access described by the specified Permission
argurment, false
otherwise.
That is, this current instance must be exactly equal to or a superset of the
functionality and/or resource access described by the given Permission
argument. Yet
another way of saying this would be:
If "permission1 implies permission2", i.e. permission1.implies(permission2)
, then any Subject granted permission1
would have ability greater than or equal
to that defined by permission2
.
For KeyValuePermission objects this is determined as follows:
If the keys of each permission are equal and if the values from this object implies the values from the passed in permission, then this permission will imply the passed in permission.
implies
in interface org.apache.shiro.authz.Permission
p
- permission to checked to see if this permission implies ptrue
if this current instance implies all the functionality and/or
resource access described by the specified Permission
argument, false
otherwise.This work is licensed under a Creative Commons Attribution 4.0 International License.