public class CoreEnforcer
extends java.lang.Object
| 构造器和说明 |
|---|
CoreEnforcer() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
buildRoleLinks()
buildRoleLinks manually rebuild the
role inheritance relations.
|
void |
clearPolicy()
clearPolicy clears all policy.
|
void |
enableAutoBuildRoleLinks(boolean autoBuildRoleLinks)
enableAutoBuildRoleLinks controls whether to save a policy rule
automatically to the adapter when it is added or removed.
|
void |
enableAutoSave(boolean autoSave)
enableAutoSave controls whether to save a policy rule automatically to
the adapter when it is added or removed.
|
void |
enableEnforce(boolean enable)
enableEnforce changes the enforcing state of Casbin, when Casbin is
disabled, all access will be allowed by the enforce() function.
|
void |
enableLog(boolean enable)
enableLog changes whether to print Casbin log to the standard output.
|
boolean |
enforce(java.lang.Object... rvals)
enforce decides whether a "subject" can access a "object" with
the operation "action", input parameters are usually: (sub, obj, act).
|
Adapter |
getAdapter()
getAdapter gets the current adapter.
|
Model |
getModel()
getModel gets the current model.
|
boolean |
isAutoNotifyDispatcher() |
boolean |
isAutoNotifyWatcher() |
boolean |
isFiltered()
isFiltered returns true if the loaded policy has been filtered.
|
void |
loadFilteredPolicy(java.lang.Object filter)
loadFilteredPolicy reloads a filtered policy from file/database.
|
void |
loadModel()
loadModel reloads the model from the model CONF file.
|
void |
loadPolicy()
loadPolicy reloads the policy from file/database.
|
static Model |
newModel()
newModel creates a model.
|
static Model |
newModel(java.lang.String text)
newModel creates a model.
|
static Model |
newModel(java.lang.String modelPath,
java.lang.String unused)
newModel creates a model.
|
void |
resetExpressionEvaluator()
Invalidate cache of compiled model matcher expression.
|
void |
savePolicy()
savePolicy saves the current policy (usually after changed with
Casbin API) back to file/database.
|
void |
setAdapter(Adapter adapter)
setAdapter sets the current adapter.
|
void |
setAutoNotifyDispatcher(boolean autoNotifyDispatcher) |
void |
setAutoNotifyWatcher(boolean autoNotifyWatcher) |
void |
setDispatcher(Dispatcher dispatcher)
setDispatcher sets the current dispatcher.
|
void |
setEffector(Effector eft)
setEffector sets the current effector.
|
void |
setModel(Model model)
setModel sets the current model.
|
void |
setRoleManager(RoleManager rm)
SetRoleManager sets the current role manager.
|
void |
setWatcher(Watcher watcher)
setWatcher sets the current watcher.
|
boolean |
validateEnforce(java.lang.Object... rvals) |
public static Model newModel()
public static Model newModel(java.lang.String text)
text - the model text.public static Model newModel(java.lang.String modelPath, java.lang.String unused)
modelPath - the path of the model file.unused - unused parameter, just for differentiating with
newModel(String text).public void loadModel()
public Model getModel()
public void setModel(Model model)
model - the model.public Adapter getAdapter()
public void setAdapter(Adapter adapter)
adapter - the adapter.public void setWatcher(Watcher watcher)
watcher - the watcher.public void setDispatcher(Dispatcher dispatcher)
dispatcher - jCasbin dispatcherpublic void setRoleManager(RoleManager rm)
rm - the role manager.public void setEffector(Effector eft)
eft - the effector.public void clearPolicy()
public void loadPolicy()
public void loadFilteredPolicy(java.lang.Object filter)
filter - the filter used to specify which type of policy should be loaded.public boolean isFiltered()
public void savePolicy()
public void enableEnforce(boolean enable)
enable - whether to enable the enforcer.public void enableLog(boolean enable)
enable - whether to enable Casbin's log.public void enableAutoSave(boolean autoSave)
autoSave - whether to enable the AutoSave feature.public void enableAutoBuildRoleLinks(boolean autoBuildRoleLinks)
autoBuildRoleLinks - whether to automatically build the role links.public void buildRoleLinks()
public boolean enforce(java.lang.Object... rvals)
rvals - the request needs to be mediated, usually an array
of strings, can be class instances if ABAC is used.public boolean validateEnforce(java.lang.Object... rvals)
public void resetExpressionEvaluator()
public boolean isAutoNotifyWatcher()
public void setAutoNotifyWatcher(boolean autoNotifyWatcher)
public boolean isAutoNotifyDispatcher()
public void setAutoNotifyDispatcher(boolean autoNotifyDispatcher)
Copyright © 2017-2021. All Rights Reserved.