public class Policy
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
java.util.Map<java.lang.String,java.util.Map<java.lang.String,Assertion>> |
model |
| Constructor and Description |
|---|
Policy() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
addPolicy(java.lang.String sec,
java.lang.String ptype,
java.util.List<java.lang.String> rule)
addPolicy adds a policy rule to the model.
|
void |
buildRoleLinks(RoleManager rm)
buildRoleLinks initializes the roles in RBAC.
|
void |
clearPolicy()
clearPolicy clears all current policy.
|
java.util.List<java.util.List<java.lang.String>> |
getFilteredPolicy(java.lang.String sec,
java.lang.String ptype,
int fieldIndex,
java.lang.String... fieldValues)
getFilteredPolicy gets rules based on field filters from a policy.
|
java.util.List<java.util.List<java.lang.String>> |
getPolicy(java.lang.String sec,
java.lang.String ptype)
getPolicy gets all rules in a policy.
|
java.util.List<java.lang.String> |
getValuesForFieldInPolicy(java.lang.String sec,
java.lang.String ptype,
int fieldIndex)
getValuesForFieldInPolicy gets all values for a field for all rules in a policy, duplicated values are removed.
|
boolean |
hasPolicy(java.lang.String sec,
java.lang.String ptype,
java.util.List<java.lang.String> rule)
hasPolicy determines whether a model has the specified policy rule.
|
void |
printPolicy()
printPolicy prints the policy to log.
|
boolean |
removeFilteredPolicy(java.lang.String sec,
java.lang.String ptype,
int fieldIndex,
java.lang.String... fieldValues)
removeFilteredPolicy removes policy rules based on field filters from the model.
|
boolean |
removePolicy(java.lang.String sec,
java.lang.String ptype,
java.util.List<java.lang.String> rule)
removePolicy removes a policy rule from the model.
|
public java.util.Map<java.lang.String,java.util.Map<java.lang.String,Assertion>> model
public void buildRoleLinks(RoleManager rm)
rm - the role manager.public void printPolicy()
public void clearPolicy()
public java.util.List<java.util.List<java.lang.String>> getPolicy(java.lang.String sec,
java.lang.String ptype)
sec - the section, "p" or "g".ptype - the policy type, "p", "p2", .. or "g", "g2", ..public java.util.List<java.util.List<java.lang.String>> getFilteredPolicy(java.lang.String sec,
java.lang.String ptype,
int fieldIndex,
java.lang.String... fieldValues)
sec - the section, "p" or "g".ptype - the policy type, "p", "p2", .. or "g", "g2", ..fieldIndex - the policy rule's start index to be matched.fieldValues - the field values to be matched, value ""
means not to match this field.public boolean hasPolicy(java.lang.String sec,
java.lang.String ptype,
java.util.List<java.lang.String> rule)
sec - the section, "p" or "g".ptype - the policy type, "p", "p2", .. or "g", "g2", ..rule - the policy rule.public boolean addPolicy(java.lang.String sec,
java.lang.String ptype,
java.util.List<java.lang.String> rule)
sec - the section, "p" or "g".ptype - the policy type, "p", "p2", .. or "g", "g2", ..rule - the policy rule.public boolean removePolicy(java.lang.String sec,
java.lang.String ptype,
java.util.List<java.lang.String> rule)
sec - the section, "p" or "g".ptype - the policy type, "p", "p2", .. or "g", "g2", ..rule - the policy rule.public boolean removeFilteredPolicy(java.lang.String sec,
java.lang.String ptype,
int fieldIndex,
java.lang.String... fieldValues)
sec - the section, "p" or "g".ptype - the policy type, "p", "p2", .. or "g", "g2", ..fieldIndex - the policy rule's start index to be matched.fieldValues - the field values to be matched, value ""
means not to match this field.public java.util.List<java.lang.String> getValuesForFieldInPolicy(java.lang.String sec,
java.lang.String ptype,
int fieldIndex)
sec - the section, "p" or "g".ptype - the policy type, "p", "p2", .. or "g", "g2", ..fieldIndex - the policy rule's index.Copyright © 2017-2019. All Rights Reserved.