class Casbin::Persist::Adapter
the interface for Casbin
adapters.
Public Instance Methods
add_policy(_sec, _ptype, _rule)
click to toggle source
adds a policy rule to the storage.
# File lib/casbin-ruby/persist/adapter.rb, line 14 def add_policy(_sec, _ptype, _rule); end
load_policy(_model)
click to toggle source
loads all policy rules from the storage.
# File lib/casbin-ruby/persist/adapter.rb, line 8 def load_policy(_model); end
remove_filtered_policy(_sec, _ptype, _field_index, *_field_values)
click to toggle source
removes policy rules that match the filter from the storage. This is part of the Auto-Save feature.
# File lib/casbin-ruby/persist/adapter.rb, line 21 def remove_filtered_policy(_sec, _ptype, _field_index, *_field_values); end
remove_policy(_sec, _ptype, _rule)
click to toggle source
removes a policy rule from the storage.
# File lib/casbin-ruby/persist/adapter.rb, line 17 def remove_policy(_sec, _ptype, _rule); end
save_policy(_model)
click to toggle source
saves all policy rules to the storage.
# File lib/casbin-ruby/persist/adapter.rb, line 11 def save_policy(_model); end
Protected Instance Methods
load_policy_line(line, model)
click to toggle source
loads a text line as a policy rule to model.
# File lib/casbin-ruby/persist/adapter.rb, line 26 def load_policy_line(line, model) return if line == '' || line[0] == '#' tokens = line.split(', ') key = tokens[0] sec = key[0] return unless model.model.key?(sec) return unless model.model[sec].key?(key) model.model[sec][key].policy << tokens[1..tokens.size] end