Class: Goldberg::RolesController

Inherits:
ApplicationController show all
Includes:
Controller
Defined in:
lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/roles_controller.rb

Instance Method Summary collapse

Methods included from Controller

included

Methods included from Six::Import::Controller::ClassMethods

#copy, #six_local_auto_login

Methods inherited from ActionController::Base

#active_scaffold_render_secure_download, #assign_names_with_active_scaffold, #render_with_active_scaffold, #search_generic_view_paths?

Instance Method Details

#createObject



31
32
33
34
35
36
37
38
39
40
41
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/roles_controller.rb', line 31

def create
  @role = Role.new(params[:role])
  if @role.save
    Role.rebuild_cache
    flash[:notice] = 'Role was successfully created.'
    redirect_to :action => 'list'
  else
    foreign
    render :action => 'new'
  end
end

#destroyObject



61
62
63
64
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/roles_controller.rb', line 61

def destroy
  Role.find(params[:id]).destroy
  redirect_to :action => 'list'
end

#editObject



43
44
45
46
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/roles_controller.rb', line 43

def edit
  @role = Role.find(params[:id])
  foreign
end

#indexObject



9
10
11
12
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/roles_controller.rb', line 9

def index
  list
  render :action => 'list'
end

#listObject



14
15
16
17
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/roles_controller.rb', line 14

def list
  @roles = Role.find(:all,
                     :order => 'name')
end

#newObject



26
27
28
29
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/roles_controller.rb', line 26

def new
  @role = Role.new
  foreign()
end

#showObject



19
20
21
22
23
24
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/roles_controller.rb', line 19

def show
  @role = Role.find(params[:id])
  @rps = RolesPermission.find_for_role(@role.id)
  @roles = @role.get_parents
  foreign
end

#updateObject



48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/roles_controller.rb', line 48

def update
  @role = Role.find(params[:id])
  if @role.update_attributes(params[:role])
    Role.rebuild_cache
    @role = Role.find(params[:id])
    flash[:notice] = 'Role was successfully updated.'
    redirect_to :action => 'show', :id => @role.id
  else
    foreign
    render :action => 'edit'
  end
end