Merge pull request #1641 from cpitchford/bugfix_events_put_permission_action_filter
Bugfix events put permission action filter
This commit is contained in:
commit
0b2602db27
@ -211,7 +211,7 @@ class EventsBackend(BaseBackend):
|
|||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
def put_permission(self, action, principal, statement_id):
|
def put_permission(self, action, principal, statement_id):
|
||||||
if action is None or action != 'PutEvents':
|
if action is None or action != 'events:PutEvents':
|
||||||
raise JsonRESTError('InvalidParameterValue', 'Action must be PutEvents')
|
raise JsonRESTError('InvalidParameterValue', 'Action must be PutEvents')
|
||||||
|
|
||||||
if principal is None or self.ACCOUNT_ID.match(principal) is None:
|
if principal is None or self.ACCOUNT_ID.match(principal) is None:
|
||||||
@ -236,7 +236,7 @@ class EventsBackend(BaseBackend):
|
|||||||
'Sid': statement_id,
|
'Sid': statement_id,
|
||||||
'Effect': 'Allow',
|
'Effect': 'Allow',
|
||||||
'Principal': {'AWS': 'arn:aws:iam::{0}:root'.format(data['principal'])},
|
'Principal': {'AWS': 'arn:aws:iam::{0}:root'.format(data['principal'])},
|
||||||
'Action': 'events:{0}'.format(data['action']),
|
'Action': data['action'],
|
||||||
'Resource': arn
|
'Resource': arn
|
||||||
})
|
})
|
||||||
policy = {'Version': '2012-10-17', 'Statement': statements}
|
policy = {'Version': '2012-10-17', 'Statement': statements}
|
||||||
|
@ -178,8 +178,8 @@ def test_remove_targets():
|
|||||||
def test_permissions():
|
def test_permissions():
|
||||||
client = boto3.client('events', 'eu-central-1')
|
client = boto3.client('events', 'eu-central-1')
|
||||||
|
|
||||||
client.put_permission(Action='PutEvents', Principal='111111111111', StatementId='Account1')
|
client.put_permission(Action='events:PutEvents', Principal='111111111111', StatementId='Account1')
|
||||||
client.put_permission(Action='PutEvents', Principal='222222222222', StatementId='Account2')
|
client.put_permission(Action='events:PutEvents', Principal='222222222222', StatementId='Account2')
|
||||||
|
|
||||||
resp = client.describe_event_bus()
|
resp = client.describe_event_bus()
|
||||||
resp_policy = json.loads(resp['Policy'])
|
resp_policy = json.loads(resp['Policy'])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user