Class: Admin::IdentitiesController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/admin/identities_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject


9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/admin/identities_controller.rb', line 9

def create
  @identity = Identity.new(identity_params)
  @identity.user_id = user.id

  if @identity.save
    redirect_to admin_user_identities_path(@user), notice: 'User identity was successfully created.'
  else
    render :new
  end
end

#destroyObject


36
37
38
39
40
41
42
43
# File 'app/controllers/admin/identities_controller.rb', line 36

def destroy
  if @identity.destroy
    RepairLdapBlockedUserService.new(@user).execute
    redirect_to admin_user_identities_path(@user), notice: 'User identity was successfully removed.'
  else
    redirect_to admin_user_identities_path(@user), alert: 'Failed to remove user identity.'
  end
end

#editObject


24
25
# File 'app/controllers/admin/identities_controller.rb', line 24

def edit
end

#indexObject


20
21
22
# File 'app/controllers/admin/identities_controller.rb', line 20

def index
  @identities = @user.identities
end

#newObject


5
6
7
# File 'app/controllers/admin/identities_controller.rb', line 5

def new
  @identity = Identity.new
end

#updateObject


27
28
29
30
31
32
33
34
# File 'app/controllers/admin/identities_controller.rb', line 27

def update
  if @identity.update_attributes(identity_params)
    RepairLdapBlockedUserService.new(@user).execute
    redirect_to admin_user_identities_path(@user), notice: 'User identity was successfully updated.'
  else
    render :edit
  end
end