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

Show user permissions and user audit trail #602

Merged
merged 28 commits into from
Mar 11, 2025

Conversation

ashleysmithTTD
Copy link
Contributor

@ashleysmithTTD ashleysmithTTD commented Mar 8, 2025

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

...user,
isSuperUser: userIsSuperUser,
};
};
Copy link
Contributor Author

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');
Copy link
Contributor Author

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

Copy link
Contributor

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) {
Copy link
Contributor Author

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>
)}
Copy link
Contributor Author

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>
);
}
Copy link
Contributor Author

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>
);
Copy link
Contributor Author

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 () => {
Copy link
Contributor

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) {
Copy link
Contributor

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?

import { RouteErrorBoundary } from '../utils/RouteErrorBoundary';
import { PortalRoute } from './routeUtils';

const loader = () => {
const userList = GetAllUsers();
return defer({ userList });
const participantsList = GetAllParticipants();
Copy link
Contributor

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.

@ashleysmithTTD ashleysmithTTD merged commit d3fe694 into main Mar 11, 2025
3 checks passed
@ashleysmithTTD ashleysmithTTD deleted the ans-UID2-5008-show-user-permissions-and-audits branch March 11, 2025 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants