Commit fae14a7b authored by Serena Fang's avatar Serena Fang

Move expose is auditor to EE

Since auditor users are EE only,
move expose is auditor to EE file
parent 66aae34b
...@@ -8,6 +8,7 @@ module EE ...@@ -8,6 +8,7 @@ module EE
prepended do prepended do
expose :using_license_seat?, as: :using_license_seat expose :using_license_seat?, as: :using_license_seat
expose :auditor, as: :is_auditor
end end
end end
end end
......
...@@ -23,4 +23,17 @@ RSpec.describe ::EE::API::Entities::UserWithAdmin do ...@@ -23,4 +23,17 @@ RSpec.describe ::EE::API::Entities::UserWithAdmin do
end end
end end
end end
context 'is_auditor' do
it 'returns false when user is not an auditor' do
expect(subject[:is_auditor]).to be false
end
context 'when user is an auditor' do
let(:user) { create(:user, :auditor) }
it 'returns true' do
expect(subject[:is_auditor]).to be true
end
end
end
end end
...@@ -4,7 +4,6 @@ module API ...@@ -4,7 +4,6 @@ module API
module Entities module Entities
class UserWithAdmin < UserPublic class UserWithAdmin < UserPublic
expose :admin?, as: :is_admin expose :admin?, as: :is_admin
expose :auditor, as: :is_auditor
expose :note expose :note
end end
end end
......
...@@ -536,13 +536,6 @@ RSpec.describe API::Users do ...@@ -536,13 +536,6 @@ RSpec.describe API::Users do
expect(json_response.keys).not_to include 'is_admin' expect(json_response.keys).not_to include 'is_admin'
end end
it "does not return the user's `is_auditor` flag" do
get api("/users/#{user.id}", user)
expect(response).to match_response_schema('public_api/v4/user/basic')
expect(json_response.keys).not_to include 'is_auditor'
end
it "does not return the user's `highest_role`" do it "does not return the user's `highest_role`" do
get api("/users/#{user.id}", user) get api("/users/#{user.id}", user)
...@@ -589,13 +582,6 @@ RSpec.describe API::Users do ...@@ -589,13 +582,6 @@ RSpec.describe API::Users do
expect(json_response['is_admin']).to be(false) expect(json_response['is_admin']).to be(false)
end end
it 'includes the `is_auditor` field' do
get api("/users/#{user.id}", admin)
expect(response).to match_response_schema('public_api/v4/user/admin')
expect(json_response['is_auditor']).to be(false)
end
it "includes the `created_at` field for private users" do it "includes the `created_at` field for private users" do
get api("/users/#{private_user.id}", admin) get api("/users/#{private_user.id}", admin)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment