Added editing of global_role of user.
This commit is contained in:
parent
02ac46019a
commit
a810c0fc3a
|
@ -17,9 +17,13 @@ class UsersController < ApplicationController
|
|||
|
||||
def new
|
||||
@user = User.new
|
||||
@global_roles = Role.by_acter(User).by_target(:system) + Role.by_acter(:all).by_target(:system)
|
||||
@global_roles.map! {|role| [role.name, role.id]}
|
||||
end
|
||||
|
||||
def edit
|
||||
@global_roles = Role.by_acter(User).by_target(:system) + Role.by_acter(:all).by_target(:system)
|
||||
@global_roles.map! {|role| [role.name, role.id]}
|
||||
end
|
||||
|
||||
def create
|
||||
|
@ -34,6 +38,7 @@ class UsersController < ApplicationController
|
|||
end
|
||||
|
||||
def update
|
||||
puts params[:user].inspect
|
||||
if @user.update_attributes(params[:user])
|
||||
flash[:notice] = t('flash.user.saved')
|
||||
redirect_to users_path
|
||||
|
|
|
@ -30,7 +30,7 @@ class User < ActiveRecord::Base
|
|||
errors.add(:uname, I18n.t('flash.user.group_uname_exists')) if Group.exists? :uname => uname
|
||||
}
|
||||
|
||||
attr_accessible :email, :password, :password_confirmation, :remember_me, :login, :name, :ssh_key, :uname
|
||||
attr_accessible :email, :password, :password_confirmation, :remember_me, :login, :name, :ssh_key, :uname, :global_role_id
|
||||
attr_readonly :uname
|
||||
attr_accessor :login
|
||||
|
||||
|
|
|
@ -7,6 +7,9 @@
|
|||
.group
|
||||
= f.label :email, t("activerecord.attributes.user.email"), :class => :label
|
||||
= f.text_field :email, :class => 'text_field'
|
||||
.group
|
||||
= f.label :global_role_id, t("activerecord.attributes.user.global_role"), :class => :label
|
||||
= f.select :global_role_id, options_for_select(@global_roles, @user.global_role_id)
|
||||
.group
|
||||
= f.label :ssh_key, t("activerecord.attributes.user.ssh_key"), :class => :label
|
||||
= f.text_area :ssh_key, :class => 'text_area'
|
||||
|
|
|
@ -21,6 +21,11 @@
|
|||
= t("activerecord.attributes.user.email")
|
||||
\:
|
||||
= @user.email
|
||||
%p
|
||||
%b
|
||||
= t("activerecord.attributes.user.global_role")
|
||||
\:
|
||||
= @user.global_role.name
|
||||
%p
|
||||
%b
|
||||
= t("activerecord.attributes.user.created_at")
|
||||
|
|
Loading…
Reference in New Issue