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 DELETE /maestrano/account/groups/cld-1/users/usr-1/tenant Remove a user from a group



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

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 = User.find_by_provider_and_uid_and_tenant('maestrano', user_uid, params[:tenant])
  organization = Organization.find_by_provider_and_uid_and_tenant('maestrano', group_uid, params[:tenant])
  
  # Remove the user from the organization
  organization.remove_member(user)
  
  render json: {success: true}
end