|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.wles.blm.BLMRuleManager
Manages operations on rules. Rules are used to control a subject's access to a resource.
Rules can either GRANT, DENY, or DELEGATE rights on resources. Both privilege
and role access can be managed via rules. Rules have the following format:
effect(action(s), resource(s), subject(s) [,delegator]) if constraint;
where effect may be GRANT, DENY, DELEGATE
, action may be one or more privileges or roles,
resource can be one or more resources, and subjects can be one or more users, groups, or roles.
The constraint is a series of boolean operations over attribute values which can be used to further
limit the applicability of the rule. You may make use of the wles.util.RuleParser
to construct and parse rules
using Java objects rather then directly dealing with the above format.
Use a BLMContextManager
to obtain an instance of a
BLMRuleManager
.
BLMContextManager
,
RuleParser
Field Summary | |
static java.lang.String |
EFFECT_TYPE_ALL
Specifies rules with any effect. |
static java.lang.String |
EFFECT_TYPE_DELEGATE
Specifies rules with a DELEGATE effect. |
static java.lang.String |
EFFECT_TYPE_DENY
Specifies rules with a DENY effect. |
static java.lang.String |
EFFECT_TYPE_GRANT
Specifies rules with a GRANT effect. |
static java.lang.String |
FILTER_OPERATOR_AND
Specifies a filter search operator of AND. |
static java.lang.String |
FILTER_OPERATOR_OR
Specifies a filter search operator of OR. |
static int |
ORDER_BY_DELEGATOR
|
static int |
ORDER_BY_EFFECT
Specifies the order type of queryPolicy method. |
static int |
ORDER_BY_PRIVILEGE
|
static int |
ORDER_BY_RESOURCE
|
static int |
ORDER_BY_ROLE
|
static int |
ORDER_BY_SUBJECT
|
static java.lang.String |
RULE_COMPOUND
|
static java.lang.String |
RULE_FLAT
Specifies the result type of queryPolicy method. |
Method Summary | |
void |
createRule(java.lang.String text)
Create rule from rule text. |
void |
deleteQuery(QueryDescription queryDescription)
To delete a saved Policy Inquiry query. |
java.lang.String |
filter(RuleTypeEnum ruleType,
java.lang.String effectType,
java.lang.String[] actions,
java.lang.String[] resources,
java.lang.String[] subjects,
java.lang.String[] delegators,
java.lang.String conditionPattern,
java.lang.String filterSearchOperator)
Finds rules according to the selection criteria. |
boolean |
findRule(java.lang.String cID,
java.lang.String ruleText)
Searches for a rule in a rule collection. |
int |
getCount(java.lang.String cID)
Gets the size of a rule collection. |
java.lang.String[] |
getReport(java.lang.String cID)
Returns a report on a rule collection. |
java.lang.String[] |
getReport(java.lang.String cID,
int iStart,
int iCount)
Returns a report on a subset of a rule collection. |
QueryDescription[] |
listQueries(RuleTypeEnum ruleType,
java.lang.String owner,
int start,
int numRecords)
Returns an array of QueryDescription of the saved Policy queries. |
void |
modifyRule(java.lang.String oldRuleText,
java.lang.String newRuleText)
Modifies a rule by rule text. |
java.lang.String |
queryPolicy(PolicyQuery policyQuery)
Returns a string that is an ID pointing to the collection of rules retrieved. |
PolicyQuery |
readQuery(QueryDescription queryDescription)
Returns a PolicyQuery of the the content of a saved Policy Inquiry query. |
void |
release(java.lang.String cID)
Releases a rule collection. |
void |
removeRule(java.lang.String ruleText)
Removes a rule by rule text. |
void |
saveQuery(QueryDescription queryDescription,
PolicyQuery policyQuery,
boolean overwrite)
To create (save) a Policy query if the query does not exist. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String EFFECT_TYPE_ALL
public static final java.lang.String EFFECT_TYPE_DELEGATE
public static final java.lang.String EFFECT_TYPE_DENY
public static final java.lang.String EFFECT_TYPE_GRANT
public static final java.lang.String FILTER_OPERATOR_AND
public static final java.lang.String FILTER_OPERATOR_OR
public static final int ORDER_BY_DELEGATOR
public static final int ORDER_BY_EFFECT
public static final int ORDER_BY_PRIVILEGE
public static final int ORDER_BY_RESOURCE
public static final int ORDER_BY_ROLE
public static final int ORDER_BY_SUBJECT
public static final java.lang.String RULE_COMPOUND
public static final java.lang.String RULE_FLAT
Method Detail |
public void createRule(java.lang.String text) throws BLMException, RuleParser.ParsingException
text
- text of the Rule
BLMException
RuleParser.ParsingException
RuleParser.ParsedRule.generateRuleText()
public void deleteQuery(QueryDescription queryDescription) throws BLMException
queryDescription
- a description of Policy query, please see
QueryDescription for detailed inforamtion
BLMException
public java.lang.String filter(RuleTypeEnum ruleType, java.lang.String effectType, java.lang.String[] actions, java.lang.String[] resources, java.lang.String[] subjects, java.lang.String[] delegators, java.lang.String conditionPattern, java.lang.String filterSearchOperator) throws BLMException
ruleType
- rule type, one of: RuleTypeEnum.Policy, RuleTypeEnum.RoleMapping
effectType
- one of: EFFECT_TYPE_GRANT, EFFECT_TYPE_DENY, EFFECT_TYPE_DELEGATE, EFFECT_TYPE_ALL
actions
- array of privilege or role names as strings. An empty or null
array is allowed and will match any action.resources
- array of resources as strings. An empty or null
array is allowed and will match any resource.subjects
- array of subjects as strings. An empty or null
array is allowed and will match any subject.delegators
- array of delegators as strings (cannot be more than one for AND search). An empty or null
array is allowed and will match any delegator.conditionPattern
- condition String. Unlike the other fields in the filter method, the condition filed supports pattern matching, with the use of the * character. An empty or null
value is allowed, and will match any condition.filterSearchOperator
- one of: FILTER_OPERATOR_OR, FILTER_OPERATOR_AND
BLMException
getReport(String cID)
,
getReport(String cID, int iStart, int iCount)
,
getCount(String CID)
,
release(String cID)
,
findRule(String cID, String name)
,
EFFECT_TYPE_GRANT
,
EFFECT_TYPE_DENY
,
EFFECT_TYPE_DELEGATE
,
FILTER_OPERATOR_OR
,
FILTER_OPERATOR_AND
public boolean findRule(java.lang.String cID, java.lang.String ruleText) throws BLMException, RuleParser.ParsingException
cID
- collection ID of the rule collectionruleText
- text of rule
BLMException
RuleParser.ParsingException
RuleParser.ParsedRule.generateRuleText()
public int getCount(java.lang.String cID) throws BLMException
cID
- ID of the collection
BLMException
public java.lang.String[] getReport(java.lang.String cID) throws BLMException
cID
- ID of the collection
BLMException
RuleParser.parseRule(String ruleText)
public java.lang.String[] getReport(java.lang.String cID, int iStart, int iCount) throws BLMException
cID
- ID of the collectioniStart
- index of the start of the subsetiCount
- size of the subset
BLMException
RuleParser.parseRule(String ruleText)
public QueryDescription[] listQueries(RuleTypeEnum ruleType, java.lang.String owner, int start, int numRecords) throws BLMException
ruleType
- an enumeration representing the type of query, can be
RuleTypeEnum.Policy or RuleTypeEnum.RoleMapping, see
RuleTypeEnum for detailed information.owner
- a String representing the owner of the query, like //user/wles/asiadmin/.start
- skipping this int number of records in the returned result.numRecords
- int number of records requested. A zero (0) represents all records.
BLMException
- if no record found, it will throw a BLMException which message is
"No saved policy inquiry query is found"QueryDescription
public void modifyRule(java.lang.String oldRuleText, java.lang.String newRuleText) throws BLMException, RuleParser.ParsingException
oldRuleText
- the old rulenewRuleText
- the new rule
BLMException
RuleParser.ParsingException
RuleParser.ParsedRule.generateRuleText()
public java.lang.String queryPolicy(PolicyQuery policyQuery) throws BLMException
policyQuery
- a query which includes all criteria. Please see class
PolicyQuery for detailed information.
BLMException
PolicyQuery
public PolicyQuery readQuery(QueryDescription queryDescription) throws BLMException
queryDescription
- a QueryDescription which includes owner and query name.
BLMException
PolicyQuery
,
QueryDescription
public void release(java.lang.String cID) throws BLMException
null
collection id will cause all held collections to be released.
cID
- ID of the collection
BLMException
public void removeRule(java.lang.String ruleText) throws BLMException, RuleParser.ParsingException
ruleText
- the rule text for the rule remove
BLMException
RuleParser.ParsingException
RuleParser.ParsedRule.generateRuleText()
public void saveQuery(QueryDescription queryDescription, PolicyQuery policyQuery, boolean overwrite) throws BLMException
queryDescription
- a description of Policy query. Please see
QueryDescription for detailed inforamtion.policyQuery
- a PolicyQuery which representing the query data.
Please see PolicyQuery for detailed inforamtion.overwrite
- true/false to overwrite the query if it already exists.
BLMException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |