Acquire.Identity._aclrules module

class ACLRules(rule=None, rules=None, default_rule=None, default_operation=<ACLRuleOperation.MAX: 'max'>)[source]

Bases: object

This class holds a combination of ACL rules. These are parsed in order to get the ACL for a resource.

By default, this is a simple inherit rule (meaning that it will inherit whatever comes from upstream)

append(aclrule, operation=None, ensure_owner=False)[source]

Append a rule onto the set of rules. This will resolve any conflicts in the rules. If ‘ensure_owner’ is True, then this will ensure that there is at least one user who has unambiguous ownership of the resource controlled by these ACL rules

static create(rule, user_guid=None, user_guids=None, group_guid=None, group_guids=None, default_rule=None)[source]

Create and return the ACLRules that gives ‘rule’ to everyone specified (or to everyone, if this is not specified)

static from_data(data)[source]

Construct these rules from the passed json-serialised dictionary

static inherit(user_guid=None, user_guids=None, group_guid=None, group_guids=None, default_rule=None)[source]

Create and return the ACLRules that sets inherit to everyone specified (or to everyone, if this is not specified)

insert(idx, aclrule, operation=None, ensure_owner=False)[source]

Insert the passed rule at index ‘idx’, specifying the operation used to combine this rule with what has gone before (defaults to self._default_operation)

is_simple_inherit()[source]

Return whether or not this set of rules is a simple ‘inherit all’

static owner(user_guid=None, user_guids=None, group_guid=None, group_guids=None, default_rule=None)[source]

Create and return the ACLRules that gives ownership to everyone specified (or to everyone, if this is not specified)

prepend(aclrule, operation=None, ensure_owner=False)[source]

Prepend a rule onto the set of rules

static reader(user_guid=None, user_guids=None, group_guid=None, group_guids=None, default_rule=None)[source]

Create and return the ACLRules that gives readership to everyone specified (or to everyone, if this is not specified)

resolve(must_resolve=True, identifiers=None, upstream=None, unresolved=False)[source]

Resolve the rule based on the passed identifiers. This will resolve the rules in order the final ACLRule has been generated. If ‘must_resolve’ is True, then this is guaranteed to return a fully-resolved simple ACLRule. Anything unresolved is looked up from ‘upstream’, or set equal to ‘unresolved’

rules()[source]

Return the list of ACL rules that will be applied in order (including the default rule, if set)

set_default_operation(default_operation)[source]

Set the default operation used to combine together rules

set_default_rule(aclrule)[source]

Set the default rule if nothing else matches (optionally also specifying the default operation to combine rules)

to_data()[source]

Return a json-serialisable dictionary of these rules

static writer(user_guid=None, user_guids=None, group_guid=None, group_guids=None, default_rule=None)[source]

Create and return the ACLRules that gives writership to everyone specified (or to everyone, if this is not specified)

class ACLUserRules[source]

Bases: object

This class holds rules that apply to individual users

add_user_rule(user_guid, rule)[source]

Add a rule for the used with passed ‘user_guid’

static executer(user_guid=None, user_guids=None)[source]

Simple shorthand to create the rule that the specified user is the executer of the resource

static from_data(data)[source]

Return the rules constructed from the passed json-deserialised object

static owner(user_guid=None, user_guids=None)[source]

Simple shorthand to create the rule that the specified user is the owner of the resource

static reader(user_guid=None, user_guids=None)[source]

Simple shorthand to create the rule that the specified user is the reader of the resource

resolve(must_resolve=True, identifiers=None, upstream=None, unresolved=False)[source]

Resolve the rule for the user with specified user_guid. This returns None if there are no rules for this user

to_data()[source]

Return a json-serialisable representation of these rules

static writer(user_guid=None, user_guids=None)[source]

Simple shorthand to create the rule that the specified user is the writer of the resource

class ACLGroupRules[source]

Bases: object

This class holds rules that apply to individual groups

add_group_rule(group_guid, rule)[source]

Add a rule for the used with passed ‘group_guid’

static from_data(data)[source]

Return the rules constructed from the passed json-deserialised object

resolve(identifiers=None, must_resolve=True, upstream=None, unresolved=False)[source]

Resolve the rule for the user with specified group_guid. This returns None if there are no rules for this group

to_data()[source]

Return a json-serialisable representation of these rules