Package org.casbin.jcasbin.persist
Interface Adapter
- All Known Subinterfaces:
BatchAdapter
,FilteredAdapter
,UpdatableAdapter
- All Known Implementing Classes:
AdapterMock
,FileAdapter
,FilteredAdapter
public interface Adapter
Adapter is the interface for Casbin adapters.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addPolicy adds a policy rule to the storage.void
loadPolicy
(Model model) loadPolicy loads all policy rules from the storage.void
removeFilteredPolicy
(String sec, String ptype, int fieldIndex, String... fieldValues) removeFilteredPolicy removes policy rules that match the filter from the storage.void
removePolicy
(String sec, String ptype, List<String> rule) removePolicy removes a policy rule from the storage.void
savePolicy
(Model model) savePolicy saves all policy rules to the storage.
-
Method Details
-
loadPolicy
loadPolicy loads all policy rules from the storage.- Parameters:
model
- the model.
-
savePolicy
savePolicy saves all policy rules to the storage.- Parameters:
model
- the model.
-
addPolicy
addPolicy adds a policy rule to the storage. This is part of the Auto-Save feature.- Parameters:
sec
- the section, "p" or "g".ptype
- the policy type, "p", "p2", .. or "g", "g2", ..rule
- the rule, like (sub, obj, act).
-
removePolicy
removePolicy removes a policy rule from the storage. This is part of the Auto-Save feature.- Parameters:
sec
- the section, "p" or "g".ptype
- the policy type, "p", "p2", .. or "g", "g2", ..rule
- the rule, like (sub, obj, act).
-
removeFilteredPolicy
removeFilteredPolicy removes policy rules that match the filter from the storage. This is part of the Auto-Save feature.- Parameters:
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.
-