Module: Slack::Web::Api::Endpoints::AdminUsers

Included in:
Slack::Web::Api::Endpoints
Defined in:
lib/slack/web/api/endpoints/admin_users.rb

Instance Method Summary collapse

Instance Method Details

#admin_users_assign(options = {}) ⇒ Object

Add an Enterprise user to a workspace.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :team_id (Object)

    The ID (T1234) of the workspace.

  • :user_id (Object)

    The ID of the user to add to the workspace.

  • :channel_ids (string)

    Comma separated values of channel IDs to add user in the new workspace.

  • :is_restricted (boolean)

    True if user should be added to the workspace as a guest.

  • :is_ultra_restricted (boolean)

    True if user should be added to the workspace as a single-channel guest.

Raises:

  • (ArgumentError)

See Also:



24
25
26
27
28
# File 'lib/slack/web/api/endpoints/admin_users.rb', line 24

def admin_users_assign(options = {})
  raise ArgumentError, 'Required arguments :team_id missing' if options[:team_id].nil?
  raise ArgumentError, 'Required arguments :user_id missing' if options[:user_id].nil?
  post('admin.users.assign', options)
end

#admin_users_invite(options = {}) ⇒ Object

Invite a user to a workspace.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :channel_ids (string)

    A comma-separated list of channel_ids for this user to join. At least one channel is required.

  • :email (string)

    The email address of the person to invite.

  • :team_id (Object)

    The ID (T1234) of the workspace.

  • :custom_message (string)

    An optional message to send to the user in the invite email.

  • :email_password_policy_enabled (boolean)

    Allow invited user to sign in via email and password. Only available for Enterprise Grid teams via admin invite.

  • :guest_expiration_ts (string)

    Timestamp when guest account should be disabled. Only include this timestamp if you are inviting a guest user and you want their account to expire on a certain date.

  • :is_restricted (boolean)

    Is this user a multi-channel guest user? (default: false).

  • :is_ultra_restricted (boolean)

    Is this user a single channel guest user? (default: false).

  • :real_name (string)

    Full name of the user.

  • :resend (boolean)

    Allow this invite to be resent in the future if a user has not signed up yet. (default: false).

Raises:

  • (ArgumentError)

See Also:



55
56
57
58
59
60
# File 'lib/slack/web/api/endpoints/admin_users.rb', line 55

def admin_users_invite(options = {})
  raise ArgumentError, 'Required arguments :channel_ids missing' if options[:channel_ids].nil?
  raise ArgumentError, 'Required arguments :email missing' if options[:email].nil?
  raise ArgumentError, 'Required arguments :team_id missing' if options[:team_id].nil?
  post('admin.users.invite', options)
end

#admin_users_list(options = {}) ⇒ Object

List users on a workspace

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :cursor (string)

    Set cursor to next_cursor returned by the previous call to list items in the next page.

  • :limit (integer)

    Limit for how many users to be retrieved per page.

  • :team_id (Object)

    The ID (T1234) of the workspace. The team_id is required if you use an org-level token.

See Also:



73
74
75
76
77
78
79
80
81
# File 'lib/slack/web/api/endpoints/admin_users.rb', line 73

def admin_users_list(options = {})
  if block_given?
    Pagination::Cursor.new(self, :admin_users_list, options).each do |page|
      yield page
    end
  else
    post('admin.users.list', options)
  end
end

#admin_users_remove(options = {}) ⇒ Object

Remove a user from a workspace.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :team_id (Object)

    The ID (T1234) of the workspace.

  • :user_id (string)

    The ID of the user to remove.

Raises:

  • (ArgumentError)

See Also:



92
93
94
95
96
# File 'lib/slack/web/api/endpoints/admin_users.rb', line 92

def admin_users_remove(options = {})
  raise ArgumentError, 'Required arguments :team_id missing' if options[:team_id].nil?
  raise ArgumentError, 'Required arguments :user_id missing' if options[:user_id].nil?
  post('admin.users.remove', options)
end

#admin_users_setAdmin(options = {}) ⇒ Object

Set an existing guest, regular user, or owner to be an admin user.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :team_id (Object)

    The ID (T1234) of the workspace.

  • :user_id (string)

    The ID of the user to designate as an admin.

Raises:

  • (ArgumentError)

See Also:



107
108
109
110
111
# File 'lib/slack/web/api/endpoints/admin_users.rb', line 107

def admin_users_setAdmin(options = {})
  raise ArgumentError, 'Required arguments :team_id missing' if options[:team_id].nil?
  raise ArgumentError, 'Required arguments :user_id missing' if options[:user_id].nil?
  post('admin.users.setAdmin', options)
end

#admin_users_setExpiration(options = {}) ⇒ Object

Set an expiration for a guest user

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :expiration_ts (integer)

    Timestamp when guest account should be disabled.

  • :user_id (string)

    The ID of the user to set an expiration for.

  • :team_id (Object)

    The ID (T1234) of the workspace.

Raises:

  • (ArgumentError)

See Also:



124
125
126
127
128
# File 'lib/slack/web/api/endpoints/admin_users.rb', line 124

def admin_users_setExpiration(options = {})
  raise ArgumentError, 'Required arguments :expiration_ts missing' if options[:expiration_ts].nil?
  raise ArgumentError, 'Required arguments :user_id missing' if options[:user_id].nil?
  post('admin.users.setExpiration', options)
end

#admin_users_setOwner(options = {}) ⇒ Object

Set an existing guest, regular user, or admin user to be a workspace owner.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :team_id (Object)

    The ID (T1234) of the workspace.

  • :user_id (Object)

    Id of the user to promote to owner.

Raises:

  • (ArgumentError)

See Also:



139
140
141
142
143
# File 'lib/slack/web/api/endpoints/admin_users.rb', line 139

def admin_users_setOwner(options = {})
  raise ArgumentError, 'Required arguments :team_id missing' if options[:team_id].nil?
  raise ArgumentError, 'Required arguments :user_id missing' if options[:user_id].nil?
  post('admin.users.setOwner', options)
end

#admin_users_setRegular(options = {}) ⇒ Object

Set an existing guest user, admin user, or owner to be a regular user.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :team_id (Object)

    The ID (T1234) of the workspace.

  • :user_id (string)

    The ID of the user to designate as a regular user.

Raises:

  • (ArgumentError)

See Also:



154
155
156
157
158
# File 'lib/slack/web/api/endpoints/admin_users.rb', line 154

def admin_users_setRegular(options = {})
  raise ArgumentError, 'Required arguments :team_id missing' if options[:team_id].nil?
  raise ArgumentError, 'Required arguments :user_id missing' if options[:user_id].nil?
  post('admin.users.setRegular', options)
end