|
152 |
|
152 |
|
153 |
return hosts |
153 |
return hosts |
154 |
|
154 |
|
155 |
def __parse_command( self, command ): |
155 |
def __parse_command(self, command): |
156 |
if command.find( ':' ) != -1: |
156 |
data, sep, command = command.partition(':') |
157 |
data = command.split( ':' )[ 1 ] |
|
|
158 |
command = command.split( ':' )[ 0 ] |
159 |
else: |
160 |
data = [ ] |
161 |
|
162 |
options = {} |
157 |
options = {} |
163 |
if data: |
158 |
if data: |
164 |
elements = data.split( ',' ) |
159 |
elements = data.split(',') |
165 |
for elem in elements: |
160 |
for elem in elements: |
166 |
if elem.find( '=' ) != -1: |
161 |
if '=' in elem: |
167 |
key, value = elem.split( '=' ) |
162 |
key, value = elem.split('=', 1) |
168 |
options[ key.strip() ] = value.strip() |
163 |
options[key.strip()] = value.strip() |
169 |
elif elem[ 0 ] == '!': # key without value allowed if starting with ! -> key may not exist |
164 |
elif elem.startswith('!'): # key without value allowed if starting with ! -> key may not exist |
170 |
options[ elem.strip() ] = None |
165 |
options[elem.strip()] = None |
171 |
return ( command, options ) |
166 |
return command, options |
172 |
|
167 |
|
173 |
def _append( self, fromUser, ldap_object ): |
168 |
def _append( self, fromUser, ldap_object ): |
174 |
for host in self._expand_hostlist( ldap_object.get( 'umcOperationSetHost', [ '*' ] ) ): |
169 |
for host in self._expand_hostlist( ldap_object.get( 'umcOperationSetHost', [ '*' ] ) ): |
|
200 |
match = ACLs.MATCH_FULL |
195 |
match = ACLs.MATCH_FULL |
201 |
for key, value in opt_pattern.items(): |
196 |
for key, value in opt_pattern.items(): |
202 |
# a key starting with ! means it may not be available |
197 |
# a key starting with ! means it may not be available |
203 |
if key[ 0 ] == '!' and key in opts: |
198 |
if key.startswith('!') and key in opts: |
204 |
return ACLs.MATCH_NONE |
199 |
return ACLs.MATCH_NONE |
205 |
# else if key not not in opts no rule available -> OK |
200 |
# else if key not not in opts no rule available -> OK |
206 |
if not key in opts: |
201 |
if not key in opts: |
|
244 |
if flavor1 == flavor2 or flavor1 is None or flavor1 == '*': |
239 |
if flavor1 == flavor2 or flavor1 is None or flavor1 == '*': |
245 |
return ACLs.MATCH_FULL |
240 |
return ACLs.MATCH_FULL |
246 |
|
241 |
|
247 |
if flavor1[ -1 ] == '*' and flavor2.startswith( flavor1[ : -1 ] ): |
242 |
if flavor1.endswith('*') and flavor2 and flavor2.startswith(flavor1[:-1]): |
248 |
return ACLs.MATCH_PART |
243 |
return ACLs.MATCH_PART |
249 |
|
244 |
|
250 |
return ACLs.MATCH_NONE |
245 |
return ACLs.MATCH_NONE |