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.

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

Parameters:

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

    a customizable set of options

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.

Parameters:

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

    a customizable set of options

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

Parameters:

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

    a customizable set of options

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.

  • :include_admins (boolean)

    If true, only admin users will be returned (excludes owners). Returns all admins and owners when combined with include_owners. Cannot be used together with only_guests.

  • :include_owners (boolean)

    If true, only owner users will be returned. Cannot be used together with only_guests.

  • :limit (integer)

    Limit for how many users to be retrieved per page.

See Also:



96
97
98
99
100
101
102
103
104
# File 'lib/slack/web/api/endpoints/admin_users.rb', line 96

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:



115
116
117
118
119
# File 'lib/slack/web/api/endpoints/admin_users.rb', line 115

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 or org admin.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :team_id (Object)

    The ID of the workspace or organization.

  • :user_id (string)

    The ID of the user to designate as an admin.

Raises:

  • (ArgumentError)

See Also:



130
131
132
133
134
# File 'lib/slack/web/api/endpoints/admin_users.rb', line 130

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

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



147
148
149
150
151
# File 'lib/slack/web/api/endpoints/admin_users.rb', line 147

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 or org owner.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :team_id (Object)

    The ID of the workspace or organization.

  • :user_id (Object)

    ID of the user to promote to owner.

Raises:

  • (ArgumentError)

See Also:



162
163
164
165
166
# File 'lib/slack/web/api/endpoints/admin_users.rb', line 162

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 of the workspace or organization.

  • :user_id (string)

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

Raises:

  • (ArgumentError)

See Also:



177
178
179
180
181
# File 'lib/slack/web/api/endpoints/admin_users.rb', line 177

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