Feature #23307 » 0001-Add-auth_source-to-the-users-API-response.patch
| app/views/users/show.api.rsb | ||
|---|---|---|
|
api.api_key @user.api_key if User.current.admin? || (User.current == @user)
|
||
|
api.status @user.status if User.current.admin?
|
||
|
api.auth_source do
|
||
|
api.id @user.auth_source.id
|
||
|
api.name @user.auth_source.name
|
||
|
end if User.current.admin? && @user.auth_source.present?
|
||
|
render_api_custom_values @user.visible_custom_field_values, api
|
||
|
api.array :groups do |groups|
|
||
| test/integration/api_test/users_test.rb | ||
|---|---|---|
|
assert_select 'user admin', 0
|
||
|
end
|
||
|
test "GET /users/:id should return auth_source for administrators" do
|
||
|
user = User.find(2)
|
||
|
user.update(:auth_source_id => 1)
|
||
|
get '/users/2.xml', :headers => credentials('admin')
|
||
|
assert_response :success
|
||
|
assert_select 'user auth_source id', :text => user.auth_source.id.to_s
|
||
|
assert_select 'user auth_source name', :text => user.auth_source.name
|
||
|
end
|
||
|
test "POST /users.xml with valid parameters should create the user" do
|
||
|
assert_difference('User.count') do
|
||
|
post '/users.xml',
|
||
- « Previous
- 1
- 2
- Next »