Skip to content

Commit

Permalink
refactor: move lastaccessed call to initial req rather than per haspe…
Browse files Browse the repository at this point in the history
…rmission
  • Loading branch information
shreddedbacon committed Jul 2, 2024
1 parent d3166c9 commit 811c5ba
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
1 change: 1 addition & 0 deletions services/api/src/apolloServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ const apolloServer = new ApolloServer({
currentUser = await User.User(modelClients).loadUserById(keycloakGrant.access_token.content.sub);
// grab the users project ids and roles in the first request
groupRoleProjectIds = await User.User(modelClients).getAllProjectsIdsForUser(currentUser.id, keycloakUsersGroups);
await User.User(modelClients).userLastAccessed(currentUser);
}

// do a permission check to see if the user is platform admin/owner, or has permission for `viewAll` on certain resources
Expand Down
2 changes: 0 additions & 2 deletions services/api/src/util/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,6 @@ export const keycloakHasPermission = (grant, requestCache, modelClients, service
currentUser: [currentUser.id]
};

await UserModel.userLastAccessed(currentUser);

const usersAttribute = R.prop('users', attributes);
if (usersAttribute && usersAttribute.length) {
claims = {
Expand Down

0 comments on commit 811c5ba

Please sign in to comment.