summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/controllers/admin/users_controller.rb52
-rw-r--r--app/models/project_team.rb4
-rw-r--r--app/views/admin/users/_form.html.haml20
-rw-r--r--app/views/admin/users/edit.html.haml2
-rw-r--r--app/views/admin/users/index.html.haml6
-rw-r--r--app/views/admin/users/show.html.haml48
6 files changed, 66 insertions, 66 deletions
diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb
index fefd2594880..62b9fe08091 100644
--- a/app/controllers/admin/users_controller.rb
+++ b/app/controllers/admin/users_controller.rb
@@ -1,27 +1,27 @@
class Admin::UsersController < Admin::ApplicationController
- before_filter :admin_user, only: [:show, :edit, :update, :destroy]
+ before_filter :user, only: [:show, :edit, :update, :destroy]
def index
- @admin_users = User.scoped
- @admin_users = @admin_users.filter(params[:filter])
- @admin_users = @admin_users.search(params[:name]) if params[:name].present?
- @admin_users = @admin_users.alphabetically.page(params[:page])
+ @users = User.scoped
+ @users = @users.filter(params[:filter])
+ @users = @users.search(params[:name]) if params[:name].present?
+ @users = @users.alphabetically.page(params[:page])
end
def show
- @projects = admin_user.authorized_projects
+ @projects = user.authorized_projects
end
def new
- @admin_user = User.new.with_defaults
+ @user = User.new.with_defaults
end
def edit
- admin_user
+ user
end
def block
- if admin_user.block
+ if user.block
redirect_to :back, alert: "Successfully blocked"
else
redirect_to :back, alert: "Error occured. User was not blocked"
@@ -29,7 +29,7 @@ class Admin::UsersController < Admin::ApplicationController
end
def unblock
- if admin_user.activate
+ if user.activate
redirect_to :back, alert: "Successfully unblocked"
else
redirect_to :back, alert: "Error occured. User was not unblocked"
@@ -44,17 +44,17 @@ class Admin::UsersController < Admin::ApplicationController
password_expires_at: Time.now
}
- @admin_user = User.new(params[:user].merge(opts), as: :admin)
- @admin_user.admin = (admin && admin.to_i > 0)
- @admin_user.created_by_id = current_user.id
+ @user = User.new(params[:user].merge(opts), as: :admin)
+ @user.admin = (admin && admin.to_i > 0)
+ @user.created_by_id = current_user.id
respond_to do |format|
- if @admin_user.save
- format.html { redirect_to [:admin, @admin_user], notice: 'User was successfully created.' }
- format.json { render json: @admin_user, status: :created, location: @admin_user }
+ if @user.save
+ format.html { redirect_to [:admin, @user], notice: 'User was successfully created.' }
+ format.json { render json: @user, status: :created, location: @user }
else
format.html { render "new" }
- format.json { render json: @admin_user.errors, status: :unprocessable_entity }
+ format.json { render json: @user.errors, status: :unprocessable_entity }
end
end
end
@@ -67,26 +67,26 @@ class Admin::UsersController < Admin::ApplicationController
params[:user].delete(:password_confirmation)
end
- admin_user.admin = (admin && admin.to_i > 0)
+ user.admin = (admin && admin.to_i > 0)
respond_to do |format|
- if admin_user.update_attributes(params[:user], as: :admin)
- format.html { redirect_to [:admin, admin_user], notice: 'User was successfully updated.' }
+ if user.update_attributes(params[:user], as: :admin)
+ format.html { redirect_to [:admin, user], notice: 'User was successfully updated.' }
format.json { head :ok }
else
# restore username to keep form action url.
- admin_user.username = params[:id]
+ user.username = params[:id]
format.html { render "edit" }
- format.json { render json: admin_user.errors, status: :unprocessable_entity }
+ format.json { render json: user.errors, status: :unprocessable_entity }
end
end
end
def destroy
- if admin_user.personal_projects.count > 0
+ if user.personal_projects.count > 0
redirect_to admin_users_path, alert: "User is a project owner and can't be removed." and return
end
- admin_user.destroy
+ user.destroy
respond_to do |format|
format.html { redirect_to admin_users_path }
@@ -96,7 +96,7 @@ class Admin::UsersController < Admin::ApplicationController
protected
- def admin_user
- @admin_user ||= User.find_by_username!(params[:id])
+ def user
+ @user ||= User.find_by_username!(params[:id])
end
end
diff --git a/app/models/project_team.rb b/app/models/project_team.rb
index 09b866376b1..c797c36882f 100644
--- a/app/models/project_team.rb
+++ b/app/models/project_team.rb
@@ -21,7 +21,7 @@ class ProjectTeam
end
end
- def find user_id
+ def find(user_id)
user = project.users.find_by_id(user_id)
if group
@@ -31,7 +31,7 @@ class ProjectTeam
user
end
- def get_tm user_id
+ def find_tm(user_id)
project.users_projects.find_by_user_id(user_id)
end
diff --git a/app/views/admin/users/_form.html.haml b/app/views/admin/users/_form.html.haml
index fdf37965091..4f7f05c84f1 100644
--- a/app/views/admin/users/_form.html.haml
+++ b/app/views/admin/users/_form.html.haml
@@ -1,9 +1,9 @@
.user_new
- = form_for [:admin, @admin_user] do |f|
- -if @admin_user.errors.any?
+ = form_for [:admin, @user] do |f|
+ -if @user.errors.any?
#error_explanation
%ul.unstyled.alert.alert-error
- - @admin_user.errors.full_messages.each do |msg|
+ - @user.errors.full_messages.each do |msg|
%li= msg
%fieldset
@@ -24,7 +24,7 @@
= f.text_field :email, required: true, autocomplete: "off"
%span.help-inline * required
- - if @admin_user.new_record?
+ - if @user.new_record?
%fieldset
%legend Password
.clearfix
@@ -65,14 +65,14 @@
%strong.cred Administrator
.input= f.check_box :admin
.span4
- - unless @admin_user.new_record?
+ - unless @user.new_record?
.alert.alert-error
- - if @admin_user.blocked?
+ - if @user.blocked?
%p This user is blocked and is not able to login to GitLab
- = link_to 'Unblock User', unblock_admin_user_path(@admin_user), method: :put, class: "btn btn-small"
+ = link_to 'Unblock User', unblock_admin_user_path(@user), method: :put, class: "btn btn-small"
- else
%p Blocked users will be removed from all projects &amp; will not be able to login to GitLab.
- = link_to 'Block User', block_admin_user_path(@admin_user), confirm: 'USER WILL BE BLOCKED! Are you sure?', method: :put, class: "btn btn-small btn-remove"
+ = link_to 'Block User', block_admin_user_path(@user), confirm: 'USER WILL BE BLOCKED! Are you sure?', method: :put, class: "btn btn-small btn-remove"
%fieldset
%legend Profile
.clearfix
@@ -86,9 +86,9 @@
.input= f.text_field :twitter
.actions
- - if @admin_user.new_record?
+ - if @user.new_record?
= f.submit 'Create user', class: "btn btn-create"
= link_to 'Cancel', admin_users_path, class: "btn btn-cancel"
- else
= f.submit 'Save changes', class: "btn btn-save"
- = link_to 'Cancel', admin_user_path(@admin_user), class: "btn btn-cancel"
+ = link_to 'Cancel', admin_user_path(@user), class: "btn btn-cancel"
diff --git a/app/views/admin/users/edit.html.haml b/app/views/admin/users/edit.html.haml
index f8ff77b8f53..0e31a0ba332 100644
--- a/app/views/admin/users/edit.html.haml
+++ b/app/views/admin/users/edit.html.haml
@@ -1,5 +1,5 @@
%h3.page_title
- #{@admin_user.name} &rarr;
+ #{@user.name} &rarr;
%i.icon-edit
Edit user
%hr
diff --git a/app/views/admin/users/index.html.haml b/app/views/admin/users/index.html.haml
index 3657f660c9b..0f74e8f68f4 100644
--- a/app/views/admin/users/index.html.haml
+++ b/app/views/admin/users/index.html.haml
@@ -33,9 +33,9 @@
.span9
.ui-box
%h5.title
- Users (#{@admin_users.total_count})
+ Users (#{@users.total_count})
%ul.well-list
- - @admin_users.each do |user|
+ - @users.each do |user|
%li
- if user.blocked?
%i.icon-lock.cred
@@ -58,4 +58,4 @@
- else
= link_to 'Block', block_admin_user_path(user), confirm: 'USER WILL BE BLOCKED! Are you sure?', method: :put, class: "btn btn-small btn-remove"
= link_to 'Destroy', [:admin, user], confirm: "USER #{user.name} WILL BE REMOVED! Are you sure?", method: :delete, class: "btn btn-small btn-remove"
- = paginate @admin_users, theme: "gitlab"
+ = paginate @users, theme: "gitlab"
diff --git a/app/views/admin/users/show.html.haml b/app/views/admin/users/show.html.haml
index d0d2cc7ff4d..eaa7ebc3f49 100644
--- a/app/views/admin/users/show.html.haml
+++ b/app/views/admin/users/show.html.haml
@@ -1,21 +1,21 @@
%h3.page_title
User:
- = @admin_user.name
- - if @admin_user.blocked?
+ = @user.name
+ - if @user.blocked?
%span.cred (Blocked)
- - if @admin_user.admin
+ - if @user.admin
%span.cred (Admin)
.pull-right
- = link_to edit_admin_user_path(@admin_user), class: "btn grouped btn-small" do
+ = link_to edit_admin_user_path(@user), class: "btn grouped btn-small" do
%i.icon-edit
Edit
- - unless @admin_user == current_user
- - if @admin_user.blocked?
- = link_to 'Unblock', unblock_admin_user_path(@admin_user), method: :put, class: "btn grouped btn-small success"
+ - unless @user == current_user
+ - if @user.blocked?
+ = link_to 'Unblock', unblock_admin_user_path(@user), method: :put, class: "btn grouped btn-small success"
- else
- = link_to 'Block', block_admin_user_path(@admin_user), confirm: 'USER WILL BE BLOCKED! Are you sure?', method: :put, class: "btn grouped btn-small btn-remove"
- = link_to 'Destroy', [:admin, @admin_user], confirm: "USER #{@admin_user.name} WILL BE REMOVED! Are you sure?", method: :delete, class: "btn grouped btn-small btn-remove"
+ = link_to 'Block', block_admin_user_path(@user), confirm: 'USER WILL BE BLOCKED! Are you sure?', method: :put, class: "btn grouped btn-small btn-remove"
+ = link_to 'Destroy', [:admin, @user], confirm: "USER #{@user.name} WILL BE REMOVED! Are you sure?", method: :delete, class: "btn grouped btn-small btn-remove"
%hr
.row
@@ -24,50 +24,50 @@
%h5.title
Account:
.pull-right
- = image_tag gravatar_icon(@admin_user.email, 32), class: "avatar s32"
+ = image_tag gravatar_icon(@user.email, 32), class: "avatar s32"
%ul.well-list
%li
%span.light Name:
- %strong= @admin_user.name
+ %strong= @user.name
%li
%span.light Username:
%strong
- = @admin_user.username
+ = @user.username
%li
%span.light Email:
%strong
- = mail_to @admin_user.email
+ = mail_to @user.email
%li
%span.light Member since:
%strong
- = @admin_user.created_at.stamp("Nov 12, 2031")
+ = @user.created_at.stamp("Nov 12, 2031")
%li
%span.light Last sign-in at:
%strong
- - if @admin_user.last_sign_in_at
- = @admin_user.last_sign_in_at.stamp("Nov 12, 2031")
+ - if @user.last_sign_in_at
+ = @user.last_sign_in_at.stamp("Nov 12, 2031")
- else
never
- - if @admin_user.ldap_user?
+ - if @user.ldap_user?
%li
%span.light LDAP uid:
%strong
- = @admin_user.extern_uid
+ = @user.extern_uid
- - if @admin_user.created_by
+ - if @user.created_by
%li
%span.light Created by:
%strong
- = link_to @admin_user.created_by.name, [:admin, @admin_user.created_by]
+ = link_to @user.created_by.name, [:admin, @user.created_by]
- - if @admin_user.users_groups.present?
+ - if @user.users_groups.present?
.ui-box
%h5.title Groups:
%ul.well-list
- - @admin_user.users_groups.each do |user_group|
+ - @user.users_groups.each do |user_group|
- group = user_group.group
%li
%strong= link_to group.name, admin_group_path(group)
@@ -79,7 +79,7 @@
%h5.title Projects (#{@projects.count})
%ul.well-list
- @projects.sort_by(&:name_with_namespace).each do |project|
- - tm = project.team.get_tm(@admin_user.id)
+ - tm = project.team.find_tm(@user.id)
%li
= link_to admin_project_path(project), class: dom_class(project) do
- if project.namespace
@@ -91,5 +91,5 @@
- if tm
.pull-right
%span.light= tm.human_access
- = link_to admin_project_member_path(project, tm.user), confirm: remove_from_project_team_message(project, @admin_user), method: :delete, class: "btn btn-small btn-remove" do
+ = link_to admin_project_member_path(project, tm.user), confirm: remove_from_project_team_message(project, @user), method: :delete, class: "btn btn-small btn-remove" do
%i.icon-remove