ACI¶
Usage example¶
ACI_TARGET = ('(targetfilter ="(ou=groups)")(targetattr ="uniqueMember '
'|| member")')
ACI_ALLOW = ('(version 3.0; acl "Allow test aci";allow (read, search, '
'write)')
ACI_SUBJECT = ('(userdn="ldap:///dc=example,dc=com??sub?(ou=engineering)" '
'and userdn="ldap:///dc=example,dc=com??sub?(manager=uid='
'wbrown,ou=managers,dc=example,dc=com) || ldap:///dc=examp'
'le,dc=com??sub?(manager=uid=tbrown,ou=managers,dc=exampl'
'e,dc=com)" );)')
# Add some entry with ACI
group_dn = 'cn=testgroup,{}'.format(DEFAULT_SUFFIX)
gentry = Entry(group_dn)
gentry.setValues('objectclass', 'top', 'extensibleobject')
gentry.setValues('cn', 'testgroup')
gentry.setValues('aci', ACI_BODY)
standalone.add_s(gentry)
# Get and parse ACI
acis = standalone.aci.list()
aci = acis[0]
assert aci.acidata == {
'allow': [{'values': ['read', 'search', 'write']}],
'target': [], 'targetattr': [{'values': ['uniqueMember', 'member'],
'equal': True}],
'targattrfilters': [],
'deny': [],
'acl': [{'values': ['Allow test aci']}],
'deny_raw_bindrules': [],
'targetattrfilters': [],
'allow_raw_bindrules': [{'values': [(
'userdn="ldap:///dc=example,dc=com??sub?(ou=engineering)" and'
' userdn="ldap:///dc=example,dc=com??sub?(manager=uid=wbrown,'
'ou=managers,dc=example,dc=com) || ldap:///dc=example,dc=com'
'??sub?(manager=uid=tbrown,ou=managers,dc=example,dc=com)" ')]}],
'targetfilter': [{'values': ['(ou=groups)'], 'equal': True}],
'targetscope': [],
'version 3.0;': [],
'rawaci': complex_aci
}
# You can get a raw ACI
raw_aci = aci.getRawAci()
Additional information about ACI¶
Module documentation¶
-
class
lib389.aci.
Aci
(conn)[source]¶ An object that helps to work with agreement entry
- Parameters
conn (lib389.DirSrv) – An instance
-
format_lint
(warnings)[source]¶ Takes the array of warnings and returns a formatted string.
- Parameters
warnings (dict) – The array of warnings
- Returns
Formatted string or warnings
-
lint
(basedn, scope=2)[source]¶ Validate and check for potential aci issues.
Given a scope and basedn, this will retrieve all the aci’s below. A number of checks are then run on the aci in isolation, and in groups.
- Parameters
- Returns
A tuple of (bool, list( dict )) - Bool represents if the acis pass or fail as a whole. - The list contains a list of warnings about your acis. - The dict is structured as:
{ name: "" # DSALEXXXX severity: "" # LOW MEDIUM HIGH detail: "" # explination }