Helpers

class nefertari_guards.base.ACLEncoderMixin

Mixin which implements ACL encoding/decoding.

Used in sqla and mongo ACLField.

classmethod stringify_acl(value)

Get valid Pyramid ACL and translate values to strings.

String cleaning and case conversion is also performed here. In case ACL is already converted it won’t change. Input ACL is also flattened to include a singler permission per AC entry.

Structure of result AC entries is:
{‘action’: ‘...’, ‘principal’: ‘...’, ‘permission’: ‘...’}

CLI

count_ace:
Count the number of documents that contain a particular ACE. Prints the count of objects with matching ACE, listed by type, in CSV format.
class nefertari_guards.scripts.count_ace.CountACECommand
Usage example:$ nefertari-guards.count_ace –config=local.ini –ace=’{“action”: “allow”, “principal”: “user1”, “permission”: “view”}’ –models=User,Story
update_ace:
Find documents that contain a particular ACE and replace that ACE with another ACE.
class nefertari_guards.scripts.update_ace.UpdateACECommand
Usage example:$ nefertari-guards.update_ace –config=local.ini –from_ace=’{“action”: “allow”, “principal”: “user1”, “permission”: “view”}’ –to_ace=’{“action”: “deny”, “principal”: “user1”, “permission”: “view”}’ –models=User,Story