rework users page, add role assignment
This commit is contained in:
parent
9998e00ae3
commit
80d48ed7d8
13 changed files with 118 additions and 72 deletions
|
|
@ -1,6 +1,6 @@
|
|||
module Admin
|
||||
class UsersController < ApplicationController
|
||||
load_and_authorize_resource :user
|
||||
load_and_authorize_resource
|
||||
|
||||
def index
|
||||
@users = User.all
|
||||
|
|
@ -11,16 +11,28 @@ module Admin
|
|||
# Variable @show_attributes holds the attributes that are visible for the 'show' action
|
||||
# If you want to change the attributes that are shown in the 'show' action of users
|
||||
# add/remove the attributes in the following string array
|
||||
@show_attributes = %w(name email affiliation biography registered attended created_at
|
||||
@show_attributes = %w(name email affiliation biography registered attended roles created_at
|
||||
updated_at sign_in_count current_sign_in_at last_sign_in_at
|
||||
current_sign_in_ip last_sign_in_ip)
|
||||
end
|
||||
|
||||
def update
|
||||
params[:user].delete :roles_attributes if params[:user]
|
||||
@user.update_attributes!(params[:user])
|
||||
redirect_to admin_users_path, notice: "Updated #{@user.email}"
|
||||
end
|
||||
|
||||
def add_role
|
||||
role = params[:user][:roles_attributes][:"0"]
|
||||
@user.add_role role['name'].parameterize.underscore.to_sym, Conference.find(role['resource_id'])
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.js
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def edit
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
class ConferenceRegistrationController < ApplicationController
|
||||
before_filter :verify_user
|
||||
authorize_resource class: false
|
||||
load_and_authorize_resource :conference, find_by: :short_title
|
||||
authorize_resource :conference_registration, class: Registration
|
||||
|
||||
def register
|
||||
@workshops = @conference.events.where('require_registration = ? AND state LIKE ?',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue