slackapi / bolt-python

A framework to build Slack apps using Python
https://slack.dev/bolt-python/
MIT License
1.02k stars 236 forks source link

Add bot|user_scopes to context.authorize_result set by SingleTeamAuthorization #1104

Closed seratch closed 6 days ago

seratch commented 1 week ago

This pull request improves the built-in SingleTeamAuthorization middleware to attach bot|user_scopes to Request#Context#AuthorizeResult as MultiTeamsAuthorization does.

Why does this matter? This property is useful specifically when you want to know the issued OAuth token, which is associated with an incoming Slack event request, has sufficient scopes for newly added feature in a Slack app. Here is an example: https://github.com/seratch/ChatGPT-in-Slack/blob/341f50ad00f853009f3c50ff6c3133d6fd0b3dd7/app/bolt_listeners.py#L1053-L1065

Category (place an x in each of the [ ])

Requirements (place an x in each [ ])

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.

codecov[bot] commented 1 week ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 91.79%. Comparing base (ce27780) to head (866b562).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1104 +/- ## ========================================== + Coverage 91.77% 91.79% +0.01% ========================================== Files 186 186 Lines 6407 6408 +1 ========================================== + Hits 5880 5882 +2 + Misses 527 526 -1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

seratch commented 6 days ago

Thanks for the reviews!