Class: Goldberg::PermissionsController

Inherits:
ApplicationController show all
Includes:
Controller
Defined in:
lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/permissions_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



28
29
30
31
32
33
34
35
36
37
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/permissions_controller.rb', line 28

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

#destroyObject



54
55
56
57
58
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/permissions_controller.rb', line 54

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

#editObject



39
40
41
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/permissions_controller.rb', line 39

def edit
  @permission = Permission.find(params[:id])
end

#indexObject



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

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

#listObject



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

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

#newObject



24
25
26
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/permissions_controller.rb', line 24

def new
  @permission = Permission.new
end

#showObject



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

def show
  @permission = Permission.find(params[:id])
  @pages = ContentPage.find_for_permission(params[:id])
  @actions = ControllerAction.find_for_permission(params[:id])
end

#updateObject



43
44
45
46
47
48
49
50
51
52
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/permissions_controller.rb', line 43

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