diff options
author | blackst0ne <blackst0ne.ru@gmail.com> | 2017-04-09 13:20:57 +1100 |
---|---|---|
committer | blackst0ne <blackst0ne.ru@gmail.com> | 2017-04-09 13:20:57 +1100 |
commit | 11aff97d88e32effe5d8e16caccb9d23b9a4995a (patch) | |
tree | 610490ec6b7f4dadb9535d0614d4b1f07d85542c /app | |
parent | 3d1cade13f61115b63bf6dbda5a1f194ba54b24b (diff) | |
download | gitlab-ce-11aff97d88e32effe5d8e16caccb9d23b9a4995a.tar.gz |
Remove the User#is_admin? method
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/admin/application_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/admin/impersonations_controller.rb | 2 | ||||
-rw-r--r-- | app/helpers/visibility_level_helper.rb | 2 | ||||
-rw-r--r-- | app/models/user.rb | 4 | ||||
-rw-r--r-- | app/policies/ci/runner_policy.rb | 2 | ||||
-rw-r--r-- | app/services/users/create_service.rb | 6 | ||||
-rw-r--r-- | app/views/layouts/header/_default.html.haml | 2 |
7 files changed, 8 insertions, 12 deletions
diff --git a/app/controllers/admin/application_controller.rb b/app/controllers/admin/application_controller.rb index cf795d977ce..a4648b33cfa 100644 --- a/app/controllers/admin/application_controller.rb +++ b/app/controllers/admin/application_controller.rb @@ -6,6 +6,6 @@ class Admin::ApplicationController < ApplicationController layout 'admin' def authenticate_admin! - render_404 unless current_user.is_admin? + render_404 unless current_user.admin? end end diff --git a/app/controllers/admin/impersonations_controller.rb b/app/controllers/admin/impersonations_controller.rb index 9433da02f64..8e7adc06584 100644 --- a/app/controllers/admin/impersonations_controller.rb +++ b/app/controllers/admin/impersonations_controller.rb @@ -21,6 +21,6 @@ class Admin::ImpersonationsController < Admin::ApplicationController end def authenticate_impersonator! - render_404 unless impersonator && impersonator.is_admin? && !impersonator.blocked? + render_404 unless impersonator && impersonator.admin? && !impersonator.blocked? end end diff --git a/app/helpers/visibility_level_helper.rb b/app/helpers/visibility_level_helper.rb index 169cedeb796..b4aaf498068 100644 --- a/app/helpers/visibility_level_helper.rb +++ b/app/helpers/visibility_level_helper.rb @@ -85,7 +85,7 @@ module VisibilityLevelHelper end def restricted_visibility_levels(show_all = false) - return [] if current_user.is_admin? && !show_all + return [] if current_user.admin? && !show_all current_application_settings.restricted_visibility_levels || [] end diff --git a/app/models/user.rb b/app/models/user.rb index 87eeee204f8..31e975b8e53 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -555,10 +555,6 @@ class User < ActiveRecord::Base authorized_projects(Gitlab::Access::REPORTER).non_archived.with_issues_enabled end - def is_admin? - admin - end - def require_ssh_key? keys.count == 0 && Gitlab::ProtocolAccess.allowed?('ssh') end diff --git a/app/policies/ci/runner_policy.rb b/app/policies/ci/runner_policy.rb index 7edd383530d..416d93ffe63 100644 --- a/app/policies/ci/runner_policy.rb +++ b/app/policies/ci/runner_policy.rb @@ -3,7 +3,7 @@ module Ci def rules return unless @user - can! :assign_runner if @user.is_admin? + can! :assign_runner if @user.admin? return if @subject.is_shared? || @subject.locked? diff --git a/app/services/users/create_service.rb b/app/services/users/create_service.rb index a847a71a66a..93ca7b1141a 100644 --- a/app/services/users/create_service.rb +++ b/app/services/users/create_service.rb @@ -11,7 +11,7 @@ module Users user = User.new(build_user_params) - if current_user&.is_admin? + if current_user&.admin? if params[:reset_password] @reset_token = user.generate_reset_token params[:force_random_password] = true @@ -47,7 +47,7 @@ module Users private def can_create_user? - (current_user.nil? && current_application_settings.signup_enabled?) || current_user&.is_admin? + (current_user.nil? && current_application_settings.signup_enabled?) || current_user&.admin? end # Allowed params for creating a user (admins only) @@ -94,7 +94,7 @@ module Users end def build_user_params - if current_user&.is_admin? + if current_user&.admin? user_params = params.slice(*admin_create_params) user_params[:created_by_id] = current_user&.id diff --git a/app/views/layouts/header/_default.html.haml b/app/views/layouts/header/_default.html.haml index 17e553aeef0..a9893dea68f 100644 --- a/app/views/layouts/header/_default.html.haml +++ b/app/views/layouts/header/_default.html.haml @@ -31,7 +31,7 @@ %li.impersonation = link_to admin_impersonation_path, method: :delete, title: "Stop impersonation", aria: { label: 'Stop impersonation' }, data: { toggle: 'tooltip', placement: 'bottom', container: 'body' } do = icon('user-secret fw') - - if current_user.is_admin? + - if current_user.admin? %li = link_to admin_root_path, title: 'Admin area', aria: { label: "Admin area" }, data: {toggle: 'tooltip', placement: 'bottom', container: 'body'} do = icon('wrench fw') |