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

#177 Add organizations user events #185

Merged
merged 2 commits into from
Mar 1, 2024
Merged

Conversation

rtufisi
Copy link
Collaborator

@rtufisi rtufisi commented Feb 27, 2024

No description provided.

Copy link
Member

@xgp xgp left a comment

Choose a reason for hiding this comment

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

Looks good. A few comments about imports and using snake_case for event details.

README.md Outdated
@@ -26,6 +26,7 @@ The extensions herein are used in the [Phase Two](https://phasetwo.io) cloud off
- [Resources](#resources)
- [Mappers](#mappers)
- [Admin Events](#admin-events)
- [User Events](#user-events)
Copy link
Member

Choose a reason for hiding this comment

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

This is getting big for the README. Can you create a page docs/events.md and put both the admin and user events in that page? Then you can link from the section below.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

@@ -16,6 +13,10 @@
import org.keycloak.models.RealmModel;
import org.keycloak.provider.ProviderEvent;

import java.util.Map;
Copy link
Member

Choose a reason for hiding this comment

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

Need to run mvn fmt:format before commit to keep imports consistent

@@ -61,6 +62,10 @@ private void addUser(AuthenticationFlowContext context) {
org.getName(), context.getUser().getUsername());
org.grantMembership(context.getUser());
// TODO default roles from config??
context.getEvent()
.user(context.getUser())
.detail("joinedOrganization", org.getId())
Copy link
Member

Choose a reason for hiding this comment

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

Keys are snake_case in details. Change to joined_organization

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

event.clone()
.event(CUSTOM_REQUIRED_ACTION)
.user(user)
.detail("orgId", i.getOrganization().getId())
Copy link
Member

Choose a reason for hiding this comment

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

snake_case

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

// todo future tell the inviter they rejected
event.clone()
.event(CUSTOM_REQUIRED_ACTION)
.detail("orgId", i.getOrganization().getId())
Copy link
Member

Choose a reason for hiding this comment

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

snake_case

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

event
.event(UPDATE_PROFILE)
.user(user)
.detail("removedActiveOrganizationId", activeOrganizationUtil.getActiveOrganization().getId())
Copy link
Member

Choose a reason for hiding this comment

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

snake_case

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

event
.event(UPDATE_PROFILE)
.user(user)
.detail("newActiveOrganizationId", body.getId())
Copy link
Member

Choose a reason for hiding this comment

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

snake_case

@xgp xgp merged commit a656022 into p2-inc:main Mar 1, 2024
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.

None yet

2 participants