Class: Goldberg::RolesPermissionsController

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



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

def create
  @roles_permission = RolesPermission.new(params[:roles_permission])
  if @roles_permission.save
    flash[:notice] = 'RolesPermission was successfully created.'
    redirect_to :controller => 'roles', :action => 'show', 
    :id => @roles_permission.role_id
  else
    render :action => 'new'
  end
end

#destroyObject



58
59
60
61
62
63
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/roles_permissions_controller.rb', line 58

def destroy
  rp = RolesPermission.find(params[:id])
  role = rp.role_id
  rp.destroy
  redirect_to :controller => 'roles', :action => 'show', :id => role
end

#editObject



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

def edit
  @roles_permission = RolesPermission.find(params[:id])
end

#indexObject



9
10
11
12
# File 'lib/six-updater-web/vendor/plugins/goldberg/app/controllers/goldberg/roles_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/roles_permissions_controller.rb', line 14

def list
  @roles_permissions = RolesPermission.find(:all)
end

#newObject



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

def new
  @roles_permission = RolesPermission.new
end

#new_permission_for_roleObject



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

def new_permission_for_role
  @roles_permission = RolesPermission.new
  @roles_permission.role_id = params[:id]
  @role = Role.find(params[:id])
  @permissions = Permission.find_not_for_role(params[:id])
end

#showObject



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

def show
  @roles_permission = RolesPermission.find(params[:id])
end

#updateObject



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

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