##// END OF EJS Templates
Add status to /users/:id API for admins (#13948)....
Jean-Baptiste Barth -
r11560:ec4dbbced5d9
parent child
Show More
@@ -7,6 +7,7 api.user do
7 api.created_on @user.created_on
7 api.created_on @user.created_on
8 api.last_login_on @user.last_login_on
8 api.last_login_on @user.last_login_on
9 api.api_key @user.api_key if User.current.admin? || (User.current == @user)
9 api.api_key @user.api_key if User.current.admin? || (User.current == @user)
10 api.status @user.status if User.current.admin?
10
11
11 render_api_custom_values @user.visible_custom_field_values, api
12 render_api_custom_values @user.visible_custom_field_values, api
12
13
@@ -120,6 +120,18 class Redmine::ApiTest::UsersTest < Redmine::ApiTest::Base
120 assert_tag 'user', :child => {:tag => 'api_key', :content => User.find(2).api_key}
120 assert_tag 'user', :child => {:tag => 'api_key', :content => User.find(2).api_key}
121 end
121 end
122
122
123 test "GET /users/:id should not return status for standard user" do
124 get '/users/3.xml', {}, credentials('jsmith')
125 assert_response :success
126 assert_no_tag 'user', :child => {:tag => 'status'}
127 end
128
129 test "GET /users/:id should return status for administrators" do
130 get '/users/2.xml', {}, credentials('admin')
131 assert_response :success
132 assert_tag 'user', :child => {:tag => 'status', :content => User.find(1).status.to_s}
133 end
134
123 context "POST /users" do
135 context "POST /users" do
124 context "with valid parameters" do
136 context "with valid parameters" do
125 setup do
137 setup do
General Comments 0
You need to be logged in to leave comments. Login now