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

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

  • :is_active (boolean)

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

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



77
78
79
80
81
82
83
84
85
# File 'lib/slack/web/api/endpoints/admin_users.rb', line 77

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:



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

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:



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

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)

    Epoch timestamp in seconds 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:



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

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:



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

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:



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

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