From af766e5a5cc9522e5589b4011ca12abd8a7331c3 Mon Sep 17 00:00:00 2001 From: shreddedbacon Date: Thu, 4 Jul 2024 07:48:59 +1000 Subject: [PATCH] refactor: last_accessed on user noops --- services/api/src/models/user.ts | 10 +++++++++- services/api/src/typeDefs.js | 4 +++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/services/api/src/models/user.ts b/services/api/src/models/user.ts index a26338bf9b..d11869b545 100644 --- a/services/api/src/models/user.ts +++ b/services/api/src/models/user.ts @@ -183,13 +183,17 @@ export const User = (clients: { for (const user of users) { // set the lastaccessed attribute + // @TODO: no op last accessed for the time being due to raciness + // @TODO: refactor later + /* let date = null; if (user['attributes'] && user['attributes']['last_accessed']) { date = new Date(user['attributes']['last_accessed']*1000).toISOString() + user.lastAccessed = date } + */ usersWithGitlabIdFetch.push({ ...user, - lastAccessed: date, gitlabId: await fetchGitlabId(user) }); } @@ -544,6 +548,9 @@ export const User = (clients: { const userLastAccessed = async (userInput: User): Promise => { // set the last accessed as a unix timestamp on the user attributes + // @TODO: no op last accessed for the time being due to raciness + // @TODO: refactor later + /* try { const lastAccessed = {last_accessed: Math.floor(Date.now() / 1000)} await keycloakAdminClient.users.update( @@ -564,6 +571,7 @@ export const User = (clients: { logger.warn(`Error updating Keycloak user: ${err.message}`); } } + */ return true }; diff --git a/services/api/src/typeDefs.js b/services/api/src/typeDefs.js index 2f7d51bada..a96ab73f76 100644 --- a/services/api/src/typeDefs.js +++ b/services/api/src/typeDefs.js @@ -453,7 +453,9 @@ const typeDefs = gql` # This just returns the group name, id and the role the user has in that group. # This is a neat way to visualize a users specific access without having to get all members of a group groupRoles: [GroupRoleInterface] - lastAccessed: String + # @TODO: no op last accessed for the time being due to raciness + # @TODO: refactor later + # lastAccessed: String } type GroupMembership {