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

Ms2/signin merge users #360

Merged
merged 66 commits into from
Dec 16, 2024
Merged

Ms2/signin merge users #360

merged 66 commits into from
Dec 16, 2024

Conversation

FelipeTrost
Copy link
Contributor

@FelipeTrost FelipeTrost commented Aug 12, 2024

Summary

Allow processes created by a guest user to be transferred to an already existing authenticated user.

Details

Flow for transferring processes.

  • Guest user goes to signIn page
  • Sign in page computes referenceToken that stores the guestId and passes it to the client component
  • The referenceToken is used in the callbackUrl of the authentication flow
  • In the ms AuthOptions signin callback, if the account (sign in method of the user) is a new one in the ms, then the guest user just gets updated to a normal user, otherwise nothing happens.
  • After the signIn callback the user is redirected to the callbackUrl, if the processes where already transferred, this page redirects, otherwise this page asks the user if he wants to transfer his processes

Update to getProcesses

get processes takes in an (spaceId, ability), instead of (userId , ability).

This change was needed, because the function was redundant and was
implemented in a way that caused it to fail.
It is redundant to use a userId and an ability, because both tell you
for which user we're supposed to get the processes.
And it fails because, it returns the processes where the creator was the
user, this is wrong, because it doesn't take into consideration
abilities.

For me is better that the function takes in a spaceId, and returns all
processes for a spaceId, and if you want to get the processes for a user
you can provide his ability.

FelipeTrost and others added 30 commits June 21, 2024 12:00
This change was needed, because the function was redundant and was
implemented in a way that caused it to fail.
It is redundant to use a userId and an ability, because both tell you
for which user we're supposed to get the processes.
And it fails because, it returns the processes where the creator was the
user, this is wrong, because it doesn't take into consideration
abilities.

For me is better that the function takes in a spaceId, and returns all
processes for a spaceId, and if you want to get the processes for a user
you can provide his ability.
@FelipeTrost FelipeTrost marked this pull request as ready for review November 26, 2024 18:09

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

src/management-system-v2/app/transfer-processes/page.tsx Outdated Show resolved Hide resolved
updateFolderMetaData,
updateProcess,
} from '@/lib/data/DTOs';
import { deleteUser, getUserById } from '@/lib/data/legacy/iam/users';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are the DB methods still TODO?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The DB method of deleteUser

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, they're already implemented, the import was just wrong.
I updated it.

This comment has been minimized.

Copy link

github-actions bot commented Dec 9, 2024

CLOUDRUN ACTIONS

✅ Successfully created Preview Deployment.

https://pr-360---ms-server-staging-c4f6qdpj7q-ew.a.run.app

@OhKai OhKai merged commit 93517e2 into main Dec 16, 2024
15 checks passed
@OhKai OhKai deleted the ms2/signin-merge-users branch December 16, 2024 07:10
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