Sha256: e572570af0cfea025ab40c154f3267c6c74d2ed94fabf10fd698d7091d7a9d24

Contents?: true

Size: 956 Bytes

Versions: 1

Compression:

Stored size: 956 Bytes

Contents

class Maestrano::AccountHook::GroupUsersController < Maestrano::Rails::WebHookController

  # DELETE /maestrano/account/groups/cld-1/users/usr-1
  # Remove a user from a group
  def destroy
    # Set the right uid based on Maestrano.param('user_creation_mode')
    user_uid = Maestrano.mask_user(params[:id],params[:group_id]) 
    group_uid = params[:group_id]
    render text: "Yay!"
    
    # Perform association deletion steps here
    # --
    # If Maestrano.param('user_creation_mode') is set to virtual
    # then you might want to just delete/cancel/block the user
    #
    # E.g
    # user = User.find_by_provider_and_uid('maestrano',user_uid)
    # organization = Organization.find_by_provider_and_uid('maestrano',group_uid)
    # 
    # if Maestrano.param('user_creation_mode') == 'virtual'
    #  user.destroy
    # else
    #   organization.remove_user(user)
    #   user.block_access! if user.reload.organizations.empty?
    # end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
maestrano-rails-0.5.0 test/dummy/app/controllers/maestrano/account_hook/group_users_controller.rb