public class FilteredAdapter extends java.lang.Object implements FilteredAdapter
| Modifier and Type | Class and Description |
|---|---|
static class |
FilteredAdapter.Filter
the filter class.
|
| Constructor and Description |
|---|
FilteredAdapter(java.lang.String filepath) |
| Modifier and Type | Method and Description |
|---|---|
void |
addPolicy(java.lang.String sec,
java.lang.String ptype,
java.util.List<java.lang.String> rule)
addPolicy adds a policy rule to the storage.
|
boolean |
isFiltered()
IsFiltered returns true if the loaded policy has been filtered.
|
void |
loadFilteredPolicy(Model model,
java.lang.Object filter)
loadFilteredPolicy loads only policy rules that match the filter.
|
void |
loadPolicy(Model model)
loadPolicy loads all policy rules from the storage.
|
void |
removeFilteredPolicy(java.lang.String sec,
java.lang.String ptype,
int fieldIndex,
java.lang.String... fieldValues)
removeFilteredPolicy removes policy rules that match the filter from the storage.
|
void |
removePolicy(java.lang.String sec,
java.lang.String ptype,
java.util.List<java.lang.String> rule)
removePolicy removes a policy rule from the storage.
|
void |
savePolicy(Model model)
savePolicy saves all policy rules to the storage.
|
public void loadFilteredPolicy(Model model, java.lang.Object filter) throws CasbinAdapterException
loadFilteredPolicy in interface FilteredAdaptermodel - the model.filter - the filter used to specify which type of policy should be loaded.CasbinAdapterException - if the file path or the type of the filter is incorrect.public boolean isFiltered()
FilteredAdapterisFiltered in interface FilteredAdapterpublic void loadPolicy(Model model)
loadPolicy in interface Adaptermodel - the model.public void savePolicy(Model model)
savePolicy in interface Adaptermodel - the model.public void addPolicy(java.lang.String sec,
java.lang.String ptype,
java.util.List<java.lang.String> rule)
public void removePolicy(java.lang.String sec,
java.lang.String ptype,
java.util.List<java.lang.String> rule)
removePolicy in interface Adaptersec - the section, "p" or "g".ptype - the policy type, "p", "p2", .. or "g", "g2", ..rule - the rule, like (sub, obj, act).public void removeFilteredPolicy(java.lang.String sec,
java.lang.String ptype,
int fieldIndex,
java.lang.String... fieldValues)
removeFilteredPolicy in interface Adaptersec - 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.Copyright © 2017–2022. All rights reserved.