Sha256: 7040470530b7f60f87babb5a9674b7b90186f0417c9744d60626fab3a45506a9
Contents?: true
Size: 1.23 KB
Versions: 3
Compression:
Stored size: 1.23 KB
Contents
class Admin::UsersController < Admin::BaseController def list index render :action => 'index' end def index if current_user.profile.label == 'admin' @users = User.find :all else redirect_to :action => 'edit' end end def new @user = User.new(params[:user]) setup_profiles if request.post? and @user.save flash[:notice] = _('User was successfully created.') redirect_to :action => 'list' end end def edit if current_user.profile.label == 'admin' @user = User.find_by_id(params[:id]) else if params[:id] and params[:id] != current_user[:id] flash[:error] = _("Error, you are not allowed to perform this action") redirect_to :action => 'index' end @user = User.find_by_id(current_user.id) end setup_profiles @user.attributes = params[:user] if request.post? and @user.save flash[:notice] = _('User was successfully updated.') redirect_to :action => 'list' end end def destroy @user = User.find(params[:id]) if request.post? @user.destroy if User.count > 1 redirect_to :action => 'list' end end def setup_profiles @profiles = Profile.find(:all, :order => 'id') end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
typo-5.1.1 | app/controllers/admin/users_controller.rb |
typo-5.1.2 | app/controllers/admin/users_controller.rb |
typo-5.1 | app/controllers/admin/users_controller.rb |