Skip to content

Commit

Permalink
Remove admin_user
Browse files Browse the repository at this point in the history
In ManageIQ#17444 and related PRs
References to generic admin_user and used request_admin_user/others

This removes the method for good
  • Loading branch information
kbrock committed Aug 16, 2018
1 parent 31599e6 commit e94374b
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 19 deletions.
2 changes: 0 additions & 2 deletions app/models/miq_user_role.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,6 @@ def report_admin_user?
allows?(:identifier => MiqProductFeature::REPORT_ADMIN_FEATURE)
end

alias admin_user? report_admin_user?

def request_admin_user?
allows?(:identifier => MiqProductFeature::REQUEST_ADMIN_FEATURE)
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class User < ApplicationRecord

delegate :miq_user_role, :current_tenant, :get_filters, :has_filters?, :get_managed_filters, :get_belongsto_filters,
:to => :current_group, :allow_nil => true
delegate :super_admin_user?, :admin_user?, :self_service?, :limited_self_service?, :report_admin_user?,
delegate :super_admin_user?, :request_admin_user?, :self_service?, :limited_self_service?, :report_admin_user?,
:to => :miq_user_role, :allow_nil => true

validates_presence_of :name, :userid
Expand Down
5 changes: 1 addition & 4 deletions spec/models/miq_user_role_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -192,19 +192,16 @@
end
end

describe "#admin_user?", "#report_admin_user?" do
describe "#report_admin_user?" do
it "detects super admin" do
expect(super_admin_role).to be_admin_user
expect(super_admin_role).to be_report_admin_user
end

it "detects admin" do
expect(report_admin_role).to be_admin_user
expect(report_admin_role).to be_report_admin_user
end

it "detects non-admin" do
expect(regular_role).not_to be_admin_user
expect(regular_role).not_to be_report_admin_user
end
end
Expand Down
12 changes: 0 additions & 12 deletions spec/models/user_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,18 +143,6 @@
expect(user.super_admin_user?).to be_falsey
end
end

describe "#admin_user?" do
let(:role_name) { "administrator" }

it "should check Admin Roles" do
expect(user.admin_user?).to be_truthy
expect(user.super_admin_user?).to be_falsey

user.current_group = nil
expect(user.admin_user?).to be_falsey
end
end
end

context "#authorize_ldap" do
Expand Down

0 comments on commit e94374b

Please sign in to comment.