Module: Hydra::RoleManagement::RolesBehavior

Extended by:
ActiveSupport::Concern
Included in:
RolesController
Defined in:
app/controllers/concerns/hydra/role_management/roles_behavior.rb

Overview

Module defining Controller actions for creating and managing Roles

Instance Method Summary collapse

Instance Method Details

#createObject



23
24
25
26
27
28
29
30
31
# File 'app/controllers/concerns/hydra/role_management/roles_behavior.rb', line 23

def create
  @role = Role.new(role_params)
  if @role.save
    redirect_to role_management.edit_role_path(@role),
                notice: 'Role was successfully created.'
  else
    render action: 'new'
  end
end

#destroyObject



43
44
45
46
47
48
49
50
# File 'app/controllers/concerns/hydra/role_management/roles_behavior.rb', line 43

def destroy
  if @role.destroy
    redirect_to role_management.roles_path,
                notice: 'Role was successfully deleted.'
  else
    redirect_to role_management.roles_path
  end
end

#editObject



21
# File 'app/controllers/concerns/hydra/role_management/roles_behavior.rb', line 21

def edit; end

#indexObject



13
# File 'app/controllers/concerns/hydra/role_management/roles_behavior.rb', line 13

def index; end

#newObject



19
# File 'app/controllers/concerns/hydra/role_management/roles_behavior.rb', line 19

def new; end

#showObject



15
16
17
# File 'app/controllers/concerns/hydra/role_management/roles_behavior.rb', line 15

def show
  redirect_to role_management.edit_role_path(@role) if can? :edit, @role
end

#updateObject



33
34
35
36
37
38
39
40
41
# File 'app/controllers/concerns/hydra/role_management/roles_behavior.rb', line 33

def update
  @role = Role.find(params[:id])
  if @role.update(role_params)
    redirect_to role_management.edit_role_path(@role),
                notice: 'Role was successfully updated.'
  else
    render action: 'edit'
  end
end