mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fixing a bug that prevented editing Slack messages and having the commands resent to the Slack engine.
This commit is contained in:
parent
42bd553b98
commit
0ece2a8f0c
1 changed files with 13 additions and 4 deletions
|
@ -181,11 +181,20 @@ def start(token,
|
|||
if 'aliases' in groups[group]:
|
||||
aliases.update(groups[group]['aliases'])
|
||||
|
||||
if 'user' not in _m:
|
||||
if 'message' in _m and 'user' in _m['message']:
|
||||
log.debug('Message was edited, '
|
||||
'so we look for user in '
|
||||
'the original message.')
|
||||
_user = _m['message']['user']
|
||||
else:
|
||||
_user = _m['user']
|
||||
|
||||
# Ensure the user is allowed to run commands
|
||||
if valid_users:
|
||||
log.debug('{0} {1}'.format(all_users, _m['user']))
|
||||
if _m['user'] not in valid_users and all_users.get(_m['user'], None) not in valid_users:
|
||||
channel.send_message('{0} not authorized to run Salt commands'.format(all_users[_m['user']]))
|
||||
log.debug('{0} {1}'.format(all_users, _user))
|
||||
if _user not in valid_users and all_users.get(_user, None) not in valid_users:
|
||||
channel.send_message('{0} not authorized to run Salt commands'.format(all_users[_user]))
|
||||
return
|
||||
|
||||
# Trim the ! from the front
|
||||
|
@ -219,7 +228,7 @@ def start(token,
|
|||
# Ensure the command is allowed
|
||||
if valid_commands:
|
||||
if cmd not in valid_commands:
|
||||
channel.send_message('{0} is not allowed to use command {1}.'.format(all_users[_m['user']], cmd))
|
||||
channel.send_message('{0} is not allowed to use command {1}.'.format(all_users[_user], cmd))
|
||||
return
|
||||
|
||||
# Parse args and kwargs
|
||||
|
|
Loading…
Add table
Reference in a new issue