Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(iam): Merge multiple principals correctly #983

Merged
merged 6 commits into from
Oct 23, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions packages/@aws-cdk/aws-iam/test/test.policy-document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,5 +210,12 @@ export = {
const p = new PolicyDocument().addStatement(new PolicyStatement().addPrincipal(new Anyone()));
test.deepEqual(resolve(p), { Statement: [{ Effect: 'Allow', Principal: '*' }], Version: '2012-10-17' });
test.done();
},

'addPrincipal prohibits mixing principal types'(test: Test) {
const s = new PolicyStatement().addAccountRootPrincipal();
test.throws(() => { s.addServicePrincipal('rds.amazonaws.com'); });
test.throws(() => { s.addFederatedPrincipal('federation', { ConditionOp: { ConditionKey: 'ConditionValue' } }); });
RomainMuller marked this conversation as resolved.
Show resolved Hide resolved
test.done();
}
};