#NEWLINE# def process( dirty_line ) : #NEWLINE# #INDENT# 'This method will process lines in the permissions config file,\n    build an array of permissions from it then returns it.\n    ' #NEWLINE# perm = [ ] #NEWLINE# reg = re . compile ( '\n            \\s*             # There can be whitespaces at beginning\n            (\\w*|\\*)        # Match any alphanum or a * for username\n            \\s+             # Need a whitspace separator\n            (\\w*|\\*)        # Match any alphanum or a * for collection\n            \\s+             # Need a whitspace separator\n            "?(.*?)"?     # res_id can be surrounded by double quotes\n            \\s+             # Need a whitspace separator\n            ([CRUD]{1,4}|-) # Accept any combination of CRUD or dash\n            \\s*             # There can be whitespaces at the end\n            $               # No more than 4 groups\n            ' , re . VERBOSE ) #NEWLINE# result = reg . match ( dirty_line ) #NEWLINE# if ( result is None ) : #NEWLINE# #INDENT# raise re . error #NEWLINE# #UNINDENT# perm . append ( re . compile ( _sanitize ( result . group ( 1 ) ) ) ) #NEWLINE# perm . append ( re . compile ( _sanitize ( result . group ( 2 ) ) ) ) #NEWLINE# perm . append ( re . compile ( _sanitize ( result . group ( 3 ) ) ) ) #NEWLINE# perm . append ( [ perm_mapping [ p ] for p in result . group ( 4 ) ] ) #NEWLINE# if ( 'R' in result . group ( 4 ) ) : #NEWLINE# #INDENT# perm [ 3 ] . append ( 'ping' ) #NEWLINE# #UNINDENT# return perm