Add "default" entry option back (removed in e95bcae
), update will translate entry to standard parameters so compatibility with BDS is kept
This commit is contained in:
parent
9581e24a75
commit
c93de2f930
1 changed files with 18 additions and 10 deletions
28
files/acl.py
28
files/acl.py
|
@ -127,23 +127,29 @@ def split_entry(entry):
|
||||||
''' splits entry and ensures normalized return'''
|
''' splits entry and ensures normalized return'''
|
||||||
|
|
||||||
a = entry.split(':')
|
a = entry.split(':')
|
||||||
|
|
||||||
|
d = None
|
||||||
|
if entry.lower().startswith("d"):
|
||||||
|
d = True
|
||||||
|
a.pop(0)
|
||||||
|
|
||||||
if len(a) == 2:
|
if len(a) == 2:
|
||||||
a.append(None)
|
a.append(None)
|
||||||
|
|
||||||
t, e, p = a
|
t, e, p = a
|
||||||
|
|
||||||
if t.startswith("u"):
|
if t.lower().startswith("u"):
|
||||||
t = "user"
|
t = "user"
|
||||||
elif t.startswith("g"):
|
elif t.lower().startswith("g"):
|
||||||
t = "group"
|
t = "group"
|
||||||
elif t.startswith("m"):
|
elif t.lower().startswith("m"):
|
||||||
t = "mask"
|
t = "mask"
|
||||||
elif t.startswith("o"):
|
elif t.lower().startswith("o"):
|
||||||
t = "other"
|
t = "other"
|
||||||
else:
|
else:
|
||||||
t = None
|
t = None
|
||||||
|
|
||||||
return [t, e, p]
|
return [d, t, e, p]
|
||||||
|
|
||||||
|
|
||||||
def build_entry(etype, entity, permissions=None):
|
def build_entry(etype, entity, permissions=None):
|
||||||
|
@ -269,16 +275,18 @@ def main():
|
||||||
if etype or entity or permissions:
|
if etype or entity or permissions:
|
||||||
module.fail_json(msg="'entry' MUST NOT be set when 'entity', 'etype' or 'permissions' are set.")
|
module.fail_json(msg="'entry' MUST NOT be set when 'entity', 'etype' or 'permissions' are set.")
|
||||||
|
|
||||||
if state == 'present' and entry.count(":") != 2:
|
if state == 'present' and not entry.count(":") in [2, 3]:
|
||||||
module.fail_json(msg="'entry' MUST have 3 sections divided by ':' when 'state=present'.")
|
module.fail_json(msg="'entry' MUST have 3 or 4 sections divided by ':' when 'state=present'.")
|
||||||
|
|
||||||
if state == 'absent' and entry.count(":") != 1:
|
if state == 'absent' and not entry.count(":") in [1, 2]:
|
||||||
module.fail_json(msg="'entry' MUST have 2 sections divided by ':' when 'state=absent'.")
|
module.fail_json(msg="'entry' MUST have 2 or 3 sections divided by ':' when 'state=absent'.")
|
||||||
|
|
||||||
if state == 'query':
|
if state == 'query':
|
||||||
module.fail_json(msg="'entry' MUST NOT be set when 'state=query'.")
|
module.fail_json(msg="'entry' MUST NOT be set when 'state=query'.")
|
||||||
|
|
||||||
etype, entity, permissions = split_entry(entry)
|
default_flag, etype, entity, permissions = split_entry(entry)
|
||||||
|
if default_flag != None:
|
||||||
|
default = default_flag
|
||||||
|
|
||||||
changed = False
|
changed = False
|
||||||
msg = ""
|
msg = ""
|
||||||
|
|
Loading…
Reference in a new issue