public class Model extends Policy
| Modifier and Type | Class and Description |
|---|---|
static class |
Model.PolicyOperations |
| Modifier and Type | Field and Description |
|---|---|
protected int |
modCount |
static java.lang.String[] |
requiredSections |
static java.util.Map<java.lang.String,java.lang.String> |
sectionNameMap |
| Constructor and Description |
|---|
Model() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
addDef(java.lang.String sec,
java.lang.String key,
java.lang.String value)
addDef adds an assertion to the model.
|
int |
getModCount() |
java.lang.String |
getNameWithDomain(java.lang.String domain,
java.lang.String name) |
java.util.Map<java.lang.String,java.lang.Integer> |
getSubjectHierarchyMap(java.util.List<java.util.List<java.lang.String>> policies) |
boolean |
hasSection(java.lang.String sec)
hasSection checks if the section exists in the model.
|
void |
loadModel(java.lang.String path)
loadModel loads the model from model CONF file.
|
void |
loadModelFromConfig(Config cfg)
loadModelFromConfig loads the model from the configuration.
|
void |
loadModelFromText(java.lang.String text)
loadModelFromText loads the model from the text.
|
static Model |
newModel()
NewModel creates an empty model.
|
static Model |
newModelFromFile(java.lang.String path)
NewModelFromString creates a model from a string which contains model text.
|
static Model |
newModelFromString(java.lang.String text)
NewModelFromString creates a model from a string which contains model text.
|
void |
printModel()
printModel prints the model to the log.
|
java.lang.String |
saveModelToText()
saveModelToText saves the model to the text.
|
void |
setLogger(Logger logger)
SetLogger sets the model's logger.
|
void |
sortPoliciesByPriority()
sort policies by priority value
|
void |
sortPoliciesBySubjectHieraichy()
sort policies by hieraichy map
|
java.lang.String |
toText() |
addPolicies, addPolicy, buildIncrementalRoleLinks, buildRoleLinks, clearPolicy, getFilteredPolicy, getPolicy, getValuesForFieldInPolicy, hasPolicies, hasPolicy, printPolicy, removeFilteredPolicy, removeFilteredPolicyReturnsEffects, removePolicies, removePolicy, savePolicyToText, updatePolicypublic static final java.util.Map<java.lang.String,java.lang.String> sectionNameMap
public static final java.lang.String[] requiredSections
protected int modCount
public int getModCount()
public boolean addDef(java.lang.String sec,
java.lang.String key,
java.lang.String value)
sec - the section, "p" or "g".key - the policy type, "p", "p2", .. or "g", "g2", ..value - the policy rule, separated by ", ".public void setLogger(Logger logger)
public static Model newModel()
public static Model newModelFromFile(java.lang.String path)
path - the path of the model file.public static Model newModelFromString(java.lang.String text)
text - the path of the file.public void loadModel(java.lang.String path)
path - the path of the model file.public void loadModelFromText(java.lang.String text)
text - the model text.public void loadModelFromConfig(Config cfg)
cfg - the model text.public boolean hasSection(java.lang.String sec)
public java.lang.String saveModelToText()
public void printModel()
public void sortPoliciesByPriority()
public void sortPoliciesBySubjectHieraichy()
public java.util.Map<java.lang.String,java.lang.Integer> getSubjectHierarchyMap(java.util.List<java.util.List<java.lang.String>> policies)
public java.lang.String getNameWithDomain(java.lang.String domain,
java.lang.String name)
public java.lang.String toText()
Copyright © 2017–2024. All rights reserved.