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.

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.

  • :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.

  • :channel_ids (string)

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

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_getExpiration(options = {}) ⇒ Object

Fetches the expiration timestamp for a guest

Options Hash (options):

  • :user_id (Object)

    The ID of the guest user to get the expiration for.

  • :target_team (Object)

    If an org token is passed in and this team is on the org, it will operate on the workspace level on the specified team. Otherwise it will operate on the org or team in context.

See Also:



39
40
41
# File 'lib/slack/web/api/endpoints/admin_users.rb', line 39

def admin_users_getExpiration(options = {})
  post('admin.users.getExpiration', options)
end

#admin_users_invite(options = {}) ⇒ Object

Invite a user to a workspace.

Options Hash (options):

  • :team_id (Object)

    The ID (T1234) of the workspace.

  • :email (string)

    The email address of the person to invite.

  • :channel_ids (string)

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

  • :custom_message (string)

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

  • :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. Resending can only be done via the UI and has no expiration. (default: false).

  • :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).

  • :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.

  • :email_password_policy_enabled (boolean)

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

Raises:

  • (ArgumentError)

See Also:



68
69
70
71
72
73
# File 'lib/slack/web/api/endpoints/admin_users.rb', line 68

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

#admin_users_list(options = {}) ⇒ Object

List users on a workspace

Options Hash (options):

  • :team_id (Object)

    The ID (T1234) of a workspace. Filters results to just the specified workspace.

  • :cursor (string)

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

  • :is_active (boolean)

    If true, only active users will be returned. If false, only deactivated users will be returned. Default is true.

  • :include_deactivated_user_workspaces (boolean)

    Only applies with org token and no team_id. If true, return workspaces for a user even if they may be deactivated on them. If false, return workspaces for a user only when user is active on them. Default is false.

  • :only_guests (boolean)

    If true, returns only guests and their expiration dates that belong to the team_id.

  • :limit (integer)

    Limit for how many users to be retrieved per page.

See Also:



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

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.

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:



111
112
113
114
115
# File 'lib/slack/web/api/endpoints/admin_users.rb', line 111

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 regular user or owner to be a workspace admin.

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:



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

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

Options Hash (options):

  • :team_id (Object)

    The ID (T1234) of the workspace.

  • :user_id (string)

    The ID of the user to set an expiration for.

  • :expiration_ts (integer)

    Epoch timestamp in seconds when guest account should be disabled.

Raises:

  • (ArgumentError)

See Also:



143
144
145
146
147
# File 'lib/slack/web/api/endpoints/admin_users.rb', line 143

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

#admin_users_setOwner(options = {}) ⇒ Object

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

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:



158
159
160
161
162
# File 'lib/slack/web/api/endpoints/admin_users.rb', line 158

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.

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:



173
174
175
176
177
# File 'lib/slack/web/api/endpoints/admin_users.rb', line 173

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