File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,8 @@ class Slack < OmniAuth::Strategies::OAuth2
53
53
extra do
54
54
hash = {
55
55
raw_info : raw_info ,
56
- web_hook_info : web_hook_info
56
+ web_hook_info : web_hook_info ,
57
+ bot_info : bot_info
57
58
}
58
59
59
60
unless skip_info?
@@ -87,12 +88,24 @@ def web_hook_info
87
88
access_token . params [ 'incoming_webhook' ]
88
89
end
89
90
91
+ def bot_info
92
+ return { } unless bot_allowed?
93
+ access_token . params [ 'bot' ]
94
+ end
95
+
90
96
def incoming_webhook_allowed?
91
97
return false unless options [ 'scope' ]
92
98
webhooks_scopes = [ 'incoming-webhook' ]
93
99
scopes = options [ 'scope' ] . split ( ',' )
94
100
( scopes & webhooks_scopes ) . any?
95
101
end
102
+
103
+ def bot_allowed?
104
+ return false unless options [ 'scope' ]
105
+ bot_scopes = [ 'bot' ]
106
+ scopes = options [ 'scope' ] . split ( ',' )
107
+ ( scopes & bot_scopes ) . any?
108
+ end
96
109
end
97
110
end
98
111
end
Original file line number Diff line number Diff line change @@ -134,7 +134,7 @@ class SkipInfoTest < StrategyTestCase
134
134
@options = { skip_info : true }
135
135
strategy . stubs ( :raw_info ) . returns ( { } )
136
136
strategy . stubs ( :webhook_info ) . returns ( { } )
137
- assert_equal %w[ raw_info web_hook_info ] , strategy . extra . keys . map ( &:to_s )
137
+ assert_equal %w[ raw_info web_hook_info bot_info ] , strategy . extra . keys . map ( &:to_s )
138
138
end
139
139
140
140
end
You can’t perform that action at this time.
0 commit comments