mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 17:33:54 +00:00
Merge pull request #26083 from TheScriptSage/develop
Add '*' case to api_acl.
This commit is contained in:
commit
c7f614eb8b
@ -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:
|
||||||
|
Loading…
Reference in New Issue
Block a user