def _parse_acl(acl, user, group):
 comps = acl.split(':')
 vals = {}
 vals['type'] = 'acl'
 if (comps[0] == 'default'):
  vals['type'] = 'default'
  comps.pop(0)
 if ((comps[0] == 'user') and (not comps[1])):
  comps[1] = user
 elif ((comps[0] == 'group') and (not comps[1])):
  comps[1] = group
 vals[comps[0]] = comps[1]
 octal = 0
 vals['permissions'] = {}
 if ('r' in comps[2]):
  octal += 4
  vals['permissions']['read'] = True
 else:
  vals['permissions']['read'] = False
 if ('w' in comps[2]):
  octal += 2
  vals['permissions']['write'] = True
 else:
  vals['permissions']['write'] = False
 if ('x' in comps[2]):
  octal += 1
  vals['permissions']['execute'] = True
 else:
  vals['permissions']['execute'] = False
 vals['octal'] = octal
 return vals

def _parse_acl ( acl , user , group ) : comps = acl . split ( ':' ) vals = { } vals [ 'type' ] = 'acl' if ( comps [ 0 ] == 'default' ) : vals [ 'type' ] = 'default' comps . pop ( 0 ) if ( ( comps [ 0 ] == 'user' ) and ( not comps [ 1 ] ) ) : comps [ 1 ] = user elif ( ( comps [ 0 ] == 'group' ) and ( not comps [ 1 ] ) ) : comps [ 1 ] = group vals [ comps [ 0 ] ] = comps [ 1 ] octal = 0 vals [ 'permissions' ] = { } if ( 'r' in comps [ 2 ] ) : octal += 4 vals [ 'permissions' ] [ 'read' ] = True else : vals [ 'permissions' ] [ 'read' ] = False if ( 'w' in comps [ 2 ] ) : octal += 2 vals [ 'permissions' ] [ 'write' ] = True else : vals [ 'permissions' ] [ 'write' ] = False if ( 'x' in comps [ 2 ] ) : octal += 1 vals [ 'permissions' ] [ 'execute' ] = True else : vals [ 'permissions' ] [ 'execute' ] = False vals [ 'octal' ] = octal return vals
parse a single acl rule .