Feature #23307 » 0001-Add-auth_source-to-the-users-API-response.patch
app/views/users/show.api.rsb | ||
---|---|---|
10 | 10 |
api.api_key @user.api_key if User.current.admin? || (User.current == @user) |
11 | 11 |
api.status @user.status if User.current.admin? |
12 | 12 | |
13 |
api.auth_source do |
|
14 |
api.id @user.auth_source.id |
|
15 |
api.name @user.auth_source.name |
|
16 |
end if User.current.admin? && @user.auth_source.present? |
|
17 | ||
13 | 18 |
render_api_custom_values @user.visible_custom_field_values, api |
14 | 19 | |
15 | 20 |
api.array :groups do |groups| |
test/integration/api_test/users_test.rb | ||
---|---|---|
133 | 133 |
assert_select 'user admin', 0 |
134 | 134 |
end |
135 | 135 | |
136 |
test "GET /users/:id should return auth_source for administrators" do |
|
137 |
user = User.find(2) |
|
138 |
user.update(:auth_source_id => 1) |
|
139 |
get '/users/2.xml', :headers => credentials('admin') |
|
140 |
assert_response :success |
|
141 |
assert_select 'user auth_source id', :text => user.auth_source.id.to_s |
|
142 |
assert_select 'user auth_source name', :text => user.auth_source.name |
|
143 |
end |
|
144 | ||
136 | 145 |
test "POST /users.xml with valid parameters should create the user" do |
137 | 146 |
assert_difference('User.count') do |
138 | 147 |
post '/users.xml', |
- « Previous
- 1
- 2
- Next »