Project

General

Profile

« Previous | Next » 

Revision 2db78de0

Added by Ondřej Pražák over 5 years ago

Fixes #24259 - Add canned admin role

View differences:

test/controllers/api/v2/users_controller_test.rb
assert_response :success
assert_equal JSON.parse(@response.body)['roles'].map { |role| role["id"] }, roles.map { |role| role.id }, "Can't update user with valid roles #{roles}"
end
test "should create user with escalated roles as system admin" do
roles = [Role.find_by_name('Manager')]
org = FactoryBot.create(:organization)
loc = FactoryBot.create(:location)
system_admin = FactoryBot.create :user, :login => 'ca',
:role_ids => [roles(:system_admin).id],
:organization_ids => [org.id],
:location_ids => [loc.id]
as_user system_admin do
post :create, params: { :user => min_valid_attrs.clone.update(:role_ids => roles.map { |role| role.id },
:organization_ids => [org.id],
:location_ids => [loc.id]) }
assert_response :success
end
end
end

Also available in: Unified diff