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

Adding keycloak migration for permission matrix #2352

Merged
merged 7 commits into from
Dec 2, 2024

Conversation

sumesh-aot
Copy link
Member

@sumesh-aot sumesh-aot commented Nov 14, 2024

Issue Tracking

JIRA: https://aottech.atlassian.net/browse/FWF-3720
Issue Type: BUG/ FEATURE

Changes

  • Adding script to support migration

Screenshots (if applicable)

Screenshot 2024-11-19 at 2 04 22 PM

Checklist

  • Updated changelog
  • Added meaningful title for pull request

@sumesh-aot sumesh-aot requested review from a team as code owners November 14, 2024 22:51
auslin-aot

This comment was marked as duplicate.

Copy link
Contributor

@auslin-aot auslin-aot left a comment

Choose a reason for hiding this comment

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

During partial import, this migration realm creates new roles & overrides the groups. But the user-group mapping is removed.

@sumesh-aot
Copy link
Member Author

During partial import, this migration realm creates new roles & overrides the groups. But the user-group mapping is removed.

Thanks @auslin-aot , I will change it to use script instead as there seems no direct way to do this with import.

@sumesh-aot
Copy link
Member Author

During partial import, this migration realm creates new roles & overrides the groups. But the user-group mapping is removed.

Please review the changes

@sumesh-aot sumesh-aot requested a review from a team November 20, 2024 05:37

groups_to_role_mappings = {
"formsflow/formsflow-admin": [
"manage_users",
Copy link
Contributor

Choose a reason for hiding this comment

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

formsflow-admin group is not given as the default group in the previous release so while getting get_group_id() it fails

# Get client and group IDs
client_id = get_client_id(token, "forms-flow-web")
client_roles = get_client_roles(token, client_id)
update_client_roles(token, client_id, roles_to_update)
Copy link
Contributor

Choose a reason for hiding this comment

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

client_roles here will have old roles (formsflow-designer,..) and will not satisfy the if condition client_role['name'] == role_to_lookup on line 161. So roles will be empty. Can you please check.
image

Copy link
Member Author

Choose a reason for hiding this comment

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

This code basically, matches the client roles which needs to be added to the group and then assign it to the group, so for older roles it doesn't need to get into the if loop as those role assignment exists on the group. Do you see issues with this approach ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes. Here client_roles will have only old roles(on update_client_roles() - new roles added to the client). So when I executed the script, roles were added to the client, but the new roles were not added to the group(since new roles are not there in client_roles, so not get in the if loop). Executing the script again new roles are added to the group.
image

@sumesh-aot
Copy link
Member Author

sumesh-aot commented Nov 21, 2024

Script output when the client doesnt have permission
Screenshot 2024-11-21 at 10 39 34 AM

@sumesh-aot
Copy link
Member Author

Script output once the permission is added
Screenshot 2024-11-21 at 10 40 58 AM

Copy link

sonarcloud bot commented Nov 22, 2024

@arun-s-aot
Copy link
Contributor

Merging thihs PR for now. Any multitenancy related or pending edga cases can be sorted out in a new PR @sumesh-aot

cc @auslin-aot

@arun-s-aot arun-s-aot merged commit 5787099 into AOT-Technologies:develop Dec 2, 2024
5 checks passed
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.

4 participants