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

refactor: last_accessed on user noops #3762

Merged
merged 1 commit into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion services/api/src/models/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
});
}
Expand Down Expand Up @@ -544,6 +548,9 @@ export const User = (clients: {

const userLastAccessed = async (userInput: User): Promise<Boolean> => {
// 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(
Expand All @@ -564,6 +571,7 @@ export const User = (clients: {
logger.warn(`Error updating Keycloak user: ${err.message}`);
}
}
*/
return true
};

Expand Down
4 changes: 3 additions & 1 deletion services/api/src/typeDefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down