-
Notifications
You must be signed in to change notification settings - Fork 0
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 #568 from IABTechLab/ans-UID2-3901-remove-approver…
…s-table Remove approvers table
- Loading branch information
Showing
9 changed files
with
48 additions
and
167 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -287,7 +287,7 @@ The following steps describe the minimal steps required to successfully log in t | |
|
||
1. Assign yourself the `api-participant-member` role by following these steps: [Assign Role to a Particular User](./KeycloakAdvancedSetup.md#assign-role-to-a-particular-user) | ||
1. Run the Admin service locally by following [Connecting to local Admin service](#connecting-to-local-admin-service) | ||
1. Optionally give your user access to the [Admin screens/routes](#admin-screensroutes) | ||
1. Optionally give your user access to the [UID2 Support Screens/Routes](#uid2-support-screensroutes) | ||
1. Return to the UI and you should be good to go! | ||
|
||
#### Notes for Mac OSX Development: | ||
|
@@ -297,26 +297,21 @@ The following steps describe the minimal steps required to successfully log in t | |
1. If using Visual Studio Code, you may need to set `FAST_REFRESH=false` in your .env file | ||
1. Azure Data Studio is an adequate program for manipulating the SQL Server database | ||
|
||
### Admin screens/routes | ||
### UID2 Support Screens/Routes | ||
|
||
Certain screens/routes are considered admin-only. Run the following to assign yourself as an admin: | ||
Certain screens/routes are only viewable with the UID2 support role, such as the screen to manage participants. Run the following to assign yourself the UID2 support role: | ||
|
||
``` | ||
use [uid2_selfserve] | ||
declare @displayName as nvarchar(256) = '<first name> <last name>' | ||
declare @email as nvarchar(256) = '<Enter your email here>' | ||
declare @email as nvarchar(256) = '[email protected]'; | ||
declare @uid2SupportRoleId as int = 3; | ||
select * from dbo.approvers where email = @email | ||
insert into dbo.approvers (displayName, email, participantTypeId) | ||
values | ||
(@displayName, @email, 1), | ||
(@displayName, @email, 2), | ||
(@displayName, @email, 3), | ||
(@displayName, @email, 4) | ||
select * from dbo.approvers where email = @email | ||
insert into dbo.usersToParticipantRoles (userId, participantId, userRoleId) | ||
select u.id, upr.participantId, @uid2SupportRoleId | ||
from dbo.users u | ||
join dbo.usersToParticipantRoles upr on u.id = upr.userId | ||
where u.email = @email; | ||
``` | ||
|
||
You will then want to assign some API Permissions to your participant in the `Manage Participants` screen. This will allow you to use the full functionality of the `API Keys` screen. | ||
|
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { User } from '../entities/User'; | ||
import { UserRoleId } from '../entities/UserRole'; | ||
import { UserToParticipantRole } from '../entities/UserToParticipantRole'; | ||
|
||
export const getAllUid2SupportUsers = async () => { | ||
const uid2SupportUserToParticipantRoles = await UserToParticipantRole.query() | ||
.distinct('userId') | ||
.where('userRoleId', UserRoleId.UID2Support); | ||
const uid2SupportUsers = await Promise.all( | ||
uid2SupportUserToParticipantRoles.map(async (user) => { | ||
return User.query().findOne('id', user.userId); | ||
}) | ||
); | ||
return uid2SupportUsers.filter((user) => user !== undefined); | ||
}; |
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 |
---|---|---|
@@ -1,6 +1,5 @@ | ||
import { QueryBuilder } from 'objection'; | ||
|
||
import { Approver } from '../entities/Approver'; | ||
import { BusinessContact, ContactType } from '../entities/BusinessContact'; | ||
import { Participant } from '../entities/Participant'; | ||
import { User } from '../entities/User'; | ||
|
@@ -103,25 +102,3 @@ export const mockBusinessContact = (businessContact: Partial<BusinessContact> | | |
) | ||
); | ||
}; | ||
|
||
type PartialApproverOrNull = Partial<Approver> | null; | ||
export const mockApprover = (approver: PartialApproverOrNull | PartialApproverOrNull[] = {}) => { | ||
const approvers = Array.isArray(approver) ? approver : [approver]; | ||
approvers.forEach((a) => { | ||
jest.spyOn(Approver, 'query').mockReturnValueOnce( | ||
QueryBuilder.forClass(Approver).resolve( | ||
a === null | ||
? undefined | ||
: [ | ||
{ | ||
id: 1, | ||
email: '[email protected]', | ||
displayName: 'Test Admin', | ||
participantTypeId: 1, | ||
...a, | ||
}, | ||
] | ||
) | ||
); | ||
}); | ||
}; |
18 changes: 18 additions & 0 deletions
18
src/database/migrations/20241104084200_DeleteApproversTable.ts
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Knex } from 'knex'; | ||
|
||
export async function up(knex: Knex): Promise<void> { | ||
await knex.schema.dropTableIfExists('approvers'); | ||
} | ||
|
||
export async function down(knex: Knex): Promise<void> { | ||
await knex.schema.createTable('approvers', (table) => { | ||
table.increments('id').primary(); | ||
table.string('displayName', 256); | ||
table.string('email', 256).notNullable(); | ||
table | ||
.integer('participantTypeId') | ||
.references('id') | ||
.inTable('participantTypes') | ||
.onDelete('CASCADE'); | ||
}); | ||
} |
This file was deleted.
Oops, something went wrong.