-
Notifications
You must be signed in to change notification settings - Fork 0
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
Show user permissions and user audit trail #602
Show user permissions and user audit trail #602
Conversation
…show-user-permissions-and-audits
...user, | ||
isSuperUser: userIsSuperUser, | ||
}; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're not using this function at all, this was a mistake from the last ticket
const userList = await User.query() | ||
.where('deleted', 0) | ||
.orderBy('email') | ||
.withGraphFetched('userToParticipantRoles'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pulling all the roles the user has as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we still need to do this when we're loading all of this on loading the dialog?
@@ -3,7 +3,7 @@ import { Response } from 'express'; | |||
import { GetParticipantAuditTrail } from '../../services/auditTrailService'; | |||
import { UserParticipantRequest } from '../../services/participantsService'; | |||
|
|||
export async function handleGetAuditTrail(req: UserParticipantRequest, res: Response) { | |||
export async function handleGetParticipantAuditTrail(req: UserParticipantRequest, res: Response) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renamed to be more clear since we have a regular get audit trail now too
> | ||
<span>This user does not belong to any participant.</span> | ||
</TableNoDataPlaceholder> | ||
)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this case above should not happen but good to have just in case
<td className='role-name'>{roleName ?? 'Cannot find participant role'}</td> | ||
</tr> | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not having participantName
or roleName
should not happen but good to include just in case
</div> | ||
)} | ||
</Dialog> | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i dont think there's a reason to list out every single participant if the user is UID2Support or SuperUser
@@ -43,3 +43,8 @@ export const GetParticipantAuditTrail = async (participant: Participant) => { | |||
); | |||
return auditTrail; | |||
}; | |||
|
|||
export const GetAuditTrail = async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should be filtering this by user on the server and behind the Superuser role. I also wonder if we should maybe put this in managementService with the other stuff. Personally I like having everything that should only be accessible to Superusers in the same place to prevent someone from using those functions in another way. What do you think?
@@ -3,7 +3,7 @@ import { Response } from 'express'; | |||
import { GetParticipantAuditTrail } from '../../services/auditTrailService'; | |||
import { UserParticipantRequest } from '../../services/participantsService'; | |||
|
|||
export async function handleGetAuditTrail(req: UserParticipantRequest, res: Response) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe handleGetUserAuditTrail to make it even more clear?
src/web/screens/manageUsers.tsx
Outdated
import { RouteErrorBoundary } from '../utils/RouteErrorBoundary'; | ||
import { PortalRoute } from './routeUtils'; | ||
|
||
const loader = () => { | ||
const userList = GetAllUsers(); | ||
return defer({ userList }); | ||
const participantsList = GetAllParticipants(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should probably just load these two on demand when the dialog opens. Maybe create a different endpoint in managementRouter to get the user's participant/role info rather than loading everything and putting it together in the UI. I like keeping as much sensitive info as possible hidden on the server.
Test Plan:
-Test that viewing a UID2 support person does not show all participants
-Test that viewing a user with only Admin and Operations shows their participants. Test a user with a single participant and with multiple participants (make sure there is a dateApproved column not null when testing)
-Test that viewing a user with no audit logs works
-Test viewing your own user that probably has a lot of audit logs that scrolling and paging works