Module: Slack::Web::Api::Endpoints::AdminRoles

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

Instance Method Summary collapse

Instance Method Details

#admin_roles_addAssignments(options = {}) ⇒ Object

Adds members to the specified role with the specified scopes

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :entity_ids (array)

    List of the entity IDs for which roles will be assigned. These can be Org IDs, Team IDs or Channel IDs.

  • :role_id (string)

    ID of the role to which users will be assigned.

  • :user_ids (array)

    List of IDs from the users to be added to the given role.

Raises:

  • (ArgumentError)

See Also:



20
21
22
23
24
25
# File 'lib/slack/web/api/endpoints/admin_roles.rb', line 20

def admin_roles_addAssignments(options = {})
  raise ArgumentError, 'Required arguments :entity_ids missing' if options[:entity_ids].nil?
  raise ArgumentError, 'Required arguments :role_id missing' if options[:role_id].nil?
  raise ArgumentError, 'Required arguments :user_ids missing' if options[:user_ids].nil?
  post('admin.roles.addAssignments', options)
end

#admin_roles_listAssignments(options = {}) ⇒ Object

Lists assignments for all roles across entities. Options to scope results by any combination of roles or entities

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.

  • :entity_ids (array)

    The entities for which the roles apply.

  • :limit (integer)

    The maximum number of items to return. Must be between 1 - 200 both inclusive.

  • :role_ids (array)

    collection of role ids to scope results by.

  • :sort_dir (string)

    Sort direction. Default is descending on date_create, can be either ASC or DESC.

See Also:



42
43
44
45
46
47
48
49
50
# File 'lib/slack/web/api/endpoints/admin_roles.rb', line 42

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

#admin_roles_removeAssignments(options = {}) ⇒ Object

Removes a set of users from a role for the given scopes and entities

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :entity_ids (array)

    List of the entity IDs for which roles will be revoked. These can be Org IDs, Team IDs or Channel IDs.

  • :role_id (string)

    ID of the role to which users will be assigned.

  • :user_ids (array)

    List of IDs of the users whose roles will be revoked.

Raises:

  • (ArgumentError)

See Also:



63
64
65
66
67
68
# File 'lib/slack/web/api/endpoints/admin_roles.rb', line 63

def admin_roles_removeAssignments(options = {})
  raise ArgumentError, 'Required arguments :entity_ids missing' if options[:entity_ids].nil?
  raise ArgumentError, 'Required arguments :role_id missing' if options[:role_id].nil?
  raise ArgumentError, 'Required arguments :user_ids missing' if options[:user_ids].nil?
  post('admin.roles.removeAssignments', options)
end