Class: SlackWebApi::OauthScope

Inherits:
Object
  • Object
show all
Defined in:
lib/slack_web_api/models/oauth_scope.rb

Overview

OAuth 2 scopes supported by the API

Constant Summary collapse

OAUTH_SCOPE =
[
  # admin

  ADMIN = 'admin'.freeze,

  # admin.apps:read

  ADMIN_APPSREAD = 'admin.apps:read'.freeze,

  # admin.apps:write

  ADMIN_APPSWRITE = 'admin.apps:write'.freeze,

  # admin.conversations:read

  ADMIN_CONVERSATIONSREAD = 'admin.conversations:read'.freeze,

  # admin.conversations:write

  ADMIN_CONVERSATIONSWRITE = 'admin.conversations:write'.freeze,

  # admin.invites:read

  ADMIN_INVITESREAD = 'admin.invites:read'.freeze,

  # admin.invites:write

  ADMIN_INVITESWRITE = 'admin.invites:write'.freeze,

  # admin.teams:read

  ADMIN_TEAMSREAD = 'admin.teams:read'.freeze,

  # admin.teams:write

  ADMIN_TEAMSWRITE = 'admin.teams:write'.freeze,

  # admin.usergroups:read

  ADMIN_USERGROUPSREAD = 'admin.usergroups:read'.freeze,

  # admin.usergroups:write

  ADMIN_USERGROUPSWRITE = 'admin.usergroups:write'.freeze,

  # admin.users:read

  ADMIN_USERSREAD = 'admin.users:read'.freeze,

  # admin.users:write

  ADMIN_USERSWRITE = 'admin.users:write'.freeze,

  # authorizations:read

  AUTHORIZATIONSREAD = 'authorizations:read'.freeze,

  # Bot user scope

  BOT = 'bot'.freeze,

  # calls:read

  CALLSREAD = 'calls:read'.freeze,

  # calls:write

  CALLSWRITE = 'calls:write'.freeze,

  # channels:history

  CHANNELSHISTORY = 'channels:history'.freeze,

  # channels:manage

  CHANNELSMANAGE = 'channels:manage'.freeze,

  # channels:read

  CHANNELSREAD = 'channels:read'.freeze,

  # channels:write

  CHANNELSWRITE = 'channels:write'.freeze,

  # chat:write

  CHATWRITE = 'chat:write'.freeze,

  # Author messages as a bot

  CHATWRITEBOT = 'chat:write:bot'.freeze,

  # Author messages as a user

  CHATWRITEUSER = 'chat:write:user'.freeze,

  # conversations:history

  CONVERSATIONSHISTORY = 'conversations:history'.freeze,

  # conversations:read

  CONVERSATIONSREAD = 'conversations:read'.freeze,

  # conversations:write

  CONVERSATIONSWRITE = 'conversations:write'.freeze,

  # dnd:read

  DNDREAD = 'dnd:read'.freeze,

  # dnd:write

  DNDWRITE = 'dnd:write'.freeze,

  # emoji:read

  EMOJIREAD = 'emoji:read'.freeze,

  # files:read

  FILESREAD = 'files:read'.freeze,

  # files:write:user

  FILESWRITEUSER = 'files:write:user'.freeze,

  # groups:history

  GROUPSHISTORY = 'groups:history'.freeze,

  # groups:read

  GROUPSREAD = 'groups:read'.freeze,

  # groups:write

  GROUPSWRITE = 'groups:write'.freeze,

  # identity.basic

  IDENTITY_BASIC = 'identity.basic'.freeze,

  # im:history

  IMHISTORY = 'im:history'.freeze,

  # im:read

  IMREAD = 'im:read'.freeze,

  # im:write

  IMWRITE = 'im:write'.freeze,

  # links:write

  LINKSWRITE = 'links:write'.freeze,

  # mpim:history

  MPIMHISTORY = 'mpim:history'.freeze,

  # mpim:read

  MPIMREAD = 'mpim:read'.freeze,

  # mpim:write

  MPIMWRITE = 'mpim:write'.freeze,

  # No scope required

  NONE = 'none'.freeze,

  # pins:read

  PINSREAD = 'pins:read'.freeze,

  # pins:write

  PINSWRITE = 'pins:write'.freeze,

  # reactions:read

  REACTIONSREAD = 'reactions:read'.freeze,

  # reactions:write

  REACTIONSWRITE = 'reactions:write'.freeze,

  # reminders:read

  REMINDERSREAD = 'reminders:read'.freeze,

  # reminders:write

  REMINDERSWRITE = 'reminders:write'.freeze,

  # remote_files:read

  REMOTE_FILESREAD = 'remote_files:read'.freeze,

  # remote_files:share

  REMOTE_FILESSHARE = 'remote_files:share'.freeze,

  # remote_files:write

  REMOTE_FILESWRITE = 'remote_files:write'.freeze,

  # rtm:stream

  RTMSTREAM = 'rtm:stream'.freeze,

  # search:read

  SEARCHREAD = 'search:read'.freeze,

  # stars:read

  STARSREAD = 'stars:read'.freeze,

  # stars:write

  STARSWRITE = 'stars:write'.freeze,

  # team:read

  TEAMREAD = 'team:read'.freeze,

  # tokens.basic

  TOKENS_BASIC = 'tokens.basic'.freeze,

  # usergroups:read

  USERGROUPSREAD = 'usergroups:read'.freeze,

  # usergroups:write

  USERGROUPSWRITE = 'usergroups:write'.freeze,

  # users.profile:read

  USERS_PROFILEREAD = 'users.profile:read'.freeze,

  # users.profile:write

  USERS_PROFILEWRITE = 'users.profile:write'.freeze,

  # users:read

  USERSREAD = 'users:read'.freeze,

  # users:read.email

  USERSREAD_EMAIL = 'users:read.email'.freeze,

  # users:write

  USERSWRITE = 'users:write'.freeze,

  # workflow.steps:execute

  WORKFLOW_STEPSEXECUTE = 'workflow.steps:execute'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = ADMIN) ⇒ Object



218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
# File 'lib/slack_web_api/models/oauth_scope.rb', line 218

def self.from_value(value, default_value = ADMIN)
  return default_value if value.nil?

  str = value.to_s.strip

  case str.downcase
  when 'admin' then ADMIN
  when 'admin_appsread' then ADMIN_APPSREAD
  when 'admin_appswrite' then ADMIN_APPSWRITE
  when 'admin_conversationsread' then ADMIN_CONVERSATIONSREAD
  when 'admin_conversationswrite' then ADMIN_CONVERSATIONSWRITE
  when 'admin_invitesread' then ADMIN_INVITESREAD
  when 'admin_inviteswrite' then ADMIN_INVITESWRITE
  when 'admin_teamsread' then ADMIN_TEAMSREAD
  when 'admin_teamswrite' then ADMIN_TEAMSWRITE
  when 'admin_usergroupsread' then ADMIN_USERGROUPSREAD
  when 'admin_usergroupswrite' then ADMIN_USERGROUPSWRITE
  when 'admin_usersread' then ADMIN_USERSREAD
  when 'admin_userswrite' then ADMIN_USERSWRITE
  when 'authorizationsread' then AUTHORIZATIONSREAD
  when 'bot' then BOT
  when 'callsread' then CALLSREAD
  when 'callswrite' then CALLSWRITE
  when 'channelshistory' then CHANNELSHISTORY
  when 'channelsmanage' then CHANNELSMANAGE
  when 'channelsread' then CHANNELSREAD
  when 'channelswrite' then CHANNELSWRITE
  when 'chatwrite' then CHATWRITE
  when 'chatwritebot' then CHATWRITEBOT
  when 'chatwriteuser' then CHATWRITEUSER
  when 'conversationshistory' then CONVERSATIONSHISTORY
  when 'conversationsread' then CONVERSATIONSREAD
  when 'conversationswrite' then CONVERSATIONSWRITE
  when 'dndread' then DNDREAD
  when 'dndwrite' then DNDWRITE
  when 'emojiread' then EMOJIREAD
  when 'filesread' then FILESREAD
  when 'fileswriteuser' then FILESWRITEUSER
  when 'groupshistory' then GROUPSHISTORY
  when 'groupsread' then GROUPSREAD
  when 'groupswrite' then GROUPSWRITE
  when 'identity_basic' then IDENTITY_BASIC
  when 'imhistory' then IMHISTORY
  when 'imread' then IMREAD
  when 'imwrite' then IMWRITE
  when 'linkswrite' then LINKSWRITE
  when 'mpimhistory' then MPIMHISTORY
  when 'mpimread' then MPIMREAD
  when 'mpimwrite' then MPIMWRITE
  when 'none' then NONE
  when 'pinsread' then PINSREAD
  when 'pinswrite' then PINSWRITE
  when 'reactionsread' then REACTIONSREAD
  when 'reactionswrite' then REACTIONSWRITE
  when 'remindersread' then REMINDERSREAD
  when 'reminderswrite' then REMINDERSWRITE
  when 'remote_filesread' then REMOTE_FILESREAD
  when 'remote_filesshare' then REMOTE_FILESSHARE
  when 'remote_fileswrite' then REMOTE_FILESWRITE
  when 'rtmstream' then RTMSTREAM
  when 'searchread' then SEARCHREAD
  when 'starsread' then STARSREAD
  when 'starswrite' then STARSWRITE
  when 'teamread' then TEAMREAD
  when 'tokens_basic' then TOKENS_BASIC
  when 'usergroupsread' then USERGROUPSREAD
  when 'usergroupswrite' then USERGROUPSWRITE
  when 'users_profileread' then USERS_PROFILEREAD
  when 'users_profilewrite' then USERS_PROFILEWRITE
  when 'usersread' then USERSREAD
  when 'usersread_email' then USERSREAD_EMAIL
  when 'userswrite' then USERSWRITE
  when 'workflow_stepsexecute' then WORKFLOW_STEPSEXECUTE
  else
    default_value
  end
end

.validate(value) ⇒ Object



212
213
214
215
216
# File 'lib/slack_web_api/models/oauth_scope.rb', line 212

def self.validate(value)
  return false if value.nil?

  OAUTH_SCOPE.include?(value)
end