Class: Maestrano::Account::GroupUsersController

Inherits:
Rails::WebHookController
  • Object
show all
Defined in:
app/controllers/maestrano/account/group_users_controller.rb

Instance Method Summary collapse

Instance Method Details

#destroyObject

DELETE /maestrano/account/groups/cld-1/users/usr-1/tenant Remove a user from a group



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/controllers/maestrano/account/group_users_controller.rb', line 4

def destroy
  # Set the right uid based on Maestrano.param('sso.creation_mode')
  user_uid = Maestrano.mask_user(params[:id], params[:group_id])
  group_uid = params[:group_id]

  # Get the entities
  user = Maestrano::Connector::Rails::User.find_by(uid: user_uid, tenant: params[:tenant] || 'default')
  organization = Maestrano::Connector::Rails::Organization.find_by(uid: group_uid, tenant: params[:tenant] || 'default')

  Maestrano::Connector::Rails::ConnectorLogger.log('info', organization, "remove user from group, user_uid=\"#{user_uid}\", group_uid=\"#{group_uid}\"")

  # Remove the user from the organization
  organization.remove_member(user)

  render json: {success: true}
end