-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4711 from cloud-gov/fix-admin-login-4656
update role authorization checks, auth logging, and code updates
- Loading branch information
Showing
13 changed files
with
161 additions
and
284 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -252,9 +252,6 @@ describe('OrganizationService', () => { | |
}), | ||
]); | ||
|
||
const isUAAAdminStub = sinon.stub(OrganizationService, 'isUAAAdmin'); | ||
isUAAAdminStub.resolves(false); | ||
|
||
const error = await OrganizationService.inviteUserToOrganization( | ||
currentUser, | ||
orgId, | ||
|
@@ -289,9 +286,6 @@ describe('OrganizationService', () => { | |
}, | ||
}); | ||
|
||
const isUAAAdminStub = sinon.stub(OrganizationService, 'isUAAAdmin'); | ||
isUAAAdminStub.resolves(false); | ||
|
||
const error = await OrganizationService.inviteUserToOrganization( | ||
currentUser, | ||
org.id, | ||
|
@@ -325,9 +319,6 @@ describe('OrganizationService', () => { | |
}, | ||
}); | ||
|
||
const isUAAAdminStub = sinon.stub(OrganizationService, 'isUAAAdmin'); | ||
isUAAAdminStub.resolves(true); | ||
|
||
const error = await OrganizationService.inviteUserToOrganization( | ||
currentUser, | ||
org.id, | ||
|
@@ -347,9 +338,6 @@ describe('OrganizationService', () => { | |
it('adds them to the org with the provided role', async () => { | ||
const uaaEmail = '[email protected]'; | ||
|
||
const isUAAAdminStub = sinon.stub(OrganizationService, 'isUAAAdmin'); | ||
isUAAAdminStub.resolves(false); | ||
|
||
const targetUser = await createUserWithUAAIdentity(); | ||
const findOrCreateUAAUserStub = sinon.stub( | ||
OrganizationService, | ||
|
@@ -440,9 +428,6 @@ describe('OrganizationService', () => { | |
it('adds them to the org with the provided role', async () => { | ||
const uaaEmail = '[email protected]'; | ||
|
||
const isUAAAdminStub = sinon.stub(OrganizationService, 'isUAAAdmin'); | ||
isUAAAdminStub.resolves(true); | ||
|
||
const targetUser = await createUserWithUAAIdentity(); | ||
const findOrCreateUAAUserStub = sinon.stub( | ||
OrganizationService, | ||
|
@@ -475,6 +460,7 @@ describe('OrganizationService', () => { | |
org.id, | ||
userRole.id, | ||
uaaEmail, | ||
true, | ||
); | ||
|
||
sinon.assert.calledOnceWithMatch( | ||
|
@@ -536,22 +522,8 @@ describe('OrganizationService', () => { | |
}); | ||
|
||
context('when the current user is not a Pages admin in UAA', () => { | ||
it('throws an error', async () => { | ||
const currentUser = await createUserWithUAAIdentity(); | ||
const isUAAAdminStub = sinon.stub(OrganizationService, 'isUAAAdmin'); | ||
isUAAAdminStub.resolves(false); | ||
|
||
const error = await OrganizationService.createOrganization( | ||
{}, | ||
currentUser, | ||
'', | ||
false, | ||
'', | ||
).catch((e) => e); | ||
|
||
expect(error).to.be.an('Error'); | ||
expect(error.message).to.contain('must be a Pages admin in UAA'); | ||
}); | ||
// this case can't occur the only controller which calls this method | ||
// is in the admin API | ||
}); | ||
|
||
context('when the target user exists in Pages and UAA', () => { | ||
|
@@ -561,8 +533,6 @@ describe('OrganizationService', () => { | |
const uaaEmail = '[email protected]'; | ||
|
||
const targetUser = await createUserWithUAAIdentity(); | ||
const isUAAAdminStub = sinon.stub(OrganizationService, 'isUAAAdmin'); | ||
isUAAAdminStub.resolves(true); | ||
const findOrCreateUAAUserStub = sinon.stub( | ||
OrganizationService, | ||
'findOrCreateUAAUser', | ||
|
Oops, something went wrong.