Merge pull request #26083 from TheScriptSage/develop

Add '*' case to api_acl.
This commit is contained in:
Seth House 2015-08-06 20:13:47 -06:00
commit c7f614eb8b

View File

@ -362,6 +362,8 @@ def salt_api_acl_tool(username, request):
- 1.1.1.2 - 1.1.1.2
foo: foo:
- 8.8.4.4 - 8.8.4.4
bar:
- '*'
:param username: Username to check against the API. :param username: Username to check against the API.
:type username: str :type username: str
@ -390,14 +392,14 @@ def salt_api_acl_tool(username, request):
users = acl.get('users', {}) users = acl.get('users', {})
if users: if users:
if username in users: if username in users:
if ip in users[username]: if ip in users[username] or '*' in users[username]:
logger.info(success_str.format(username, ip)) logger.info(success_str.format(username, ip))
return True return True
else: else:
logger.info(failure_str.format(username, ip)) logger.info(failure_str.format(username, ip))
return False return False
elif username not in users and '*' in users: elif username not in users and '*' in users:
if ip in users['*']: if ip in users['*'] or '*' in users['*']:
logger.info(success_str.format(username, ip)) logger.info(success_str.format(username, ip))
return True return True
else: else: