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

Ensure team and enterprise ids are set on requests #258

Merged
merged 1 commit into from Nov 12, 2019

Conversation

@jmccance
Copy link
Contributor

jmccance commented Nov 11, 2019

Seems that Requests are responsible for updating their contexts, but only some of them were updating the enterprise and team ids. This is an issue since MultiTeamsAuthorization is expecting these fields in order to find the right bot user.

This goes through all the request types that seem to have access to team id and ensures that it (and it's undocumented buddy enterprise id, if available) are always added to the request context.

@@ -23,6 +23,7 @@ public EventRequest(
this.headers = headers;
JsonObject payload = GsonFactory.createSnakeCase().fromJson(requestBody, JsonElement.class).getAsJsonObject();
this.eventType = payload.get("event").getAsJsonObject().get("type").getAsString();
this.getContext().setTeamId(payload.get("team_id").getAsString());

This comment has been minimized.

Copy link
@seratch

seratch Nov 12, 2019

Owner

We can set enterprise_id too. I'll add it after merging this PR.

This comment has been minimized.

Copy link
@jmccance

jmccance Nov 12, 2019

Author Contributor

Good call.

Copy link
Owner

seratch left a comment

Good catch! Thank you very much for your contribution again.

@seratch seratch merged commit 090ecf9 into seratch:master Nov 12, 2019
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@seratch

This comment has been minimized.

Copy link
Owner

seratch commented Nov 12, 2019

@jmccance Thanks again for your contributions! 🙏 I just released version 3.0.4 onto the Sonatype OSS repository. The jars will be synced to Maven Central very soon.

@jmccance

This comment has been minimized.

Copy link
Contributor Author

jmccance commented Nov 12, 2019

Excellent. Thanks for your quick reviews and releases!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.