Feature #36303 » 36303-v3.patch
| app/views/users/index.api.rsb | ||
|---|---|---|
|
api.updated_on user.updated_on
|
||
|
api.last_login_on user.last_login_on
|
||
|
api.passwd_changed_on user.passwd_changed_on
|
||
|
api.avatar_url gravatar_url(user.mail, {rating: nil, size: nil, default: Setting.gravatar_default}) if Setting.gravatar_enabled?
|
||
|
api.twofa_scheme user.twofa_scheme
|
||
|
render_api_custom_values user.visible_custom_field_values, api
|
||
| app/views/users/show.api.rsb | ||
|---|---|---|
|
api.updated_on @user.updated_on
|
||
|
api.last_login_on @user.last_login_on
|
||
|
api.passwd_changed_on @user.passwd_changed_on
|
||
|
api.avatar_url gravatar_url(@user.mail, {rating: nil, size: nil, default: Setting.gravatar_default}) if Setting.gravatar_enabled?
|
||
|
api.twofa_scheme @user.twofa_scheme if User.current.admin? || (User.current == @user)
|
||
|
api.api_key @user.api_key if User.current.admin? || (User.current == @user)
|
||
|
api.status @user.status if User.current.admin?
|
||
| test/integration/api_test/users_test.rb | ||
|---|---|---|
|
test "GET /users.xml should return users" do
|
||
|
users = User.active.order('login')
|
||
|
users.last.update(twofa_scheme: 'totp')
|
||
|
get '/users.xml', :headers => credentials('admin')
|
||
|
Redmine::Configuration.with 'avatar_server_url' => 'https://gravatar.com' do
|
||
|
with_settings :gravatar_enabled => '1', :gravatar_default => 'mm' do
|
||
|
get '/users.xml', :headers => credentials('admin')
|
||
|
end
|
||
|
end
|
||
|
assert_response :success
|
||
|
assert_equal 'application/xml', response.media_type
|
||
| ... | ... | |
|
# No one has changed password.
|
||
|
assert_select user_element, 'passwd_changed_on', :text => ''
|
||
|
assert_select user_element, 'avatar_url', :text => %r|\Ahttps://gravatar.com/avatar/\h{32}\?default=mm|
|
||
|
if user == users.last
|
||
|
assert_select user_element, 'twofa_scheme', :text => 'totp'
|
||
| ... | ... | |
|
end
|
||
|
test "GET /users/:id.xml should return the user" do
|
||
|
get '/users/2.xml'
|
||
|
Redmine::Configuration.with 'avatar_server_url' => 'https://gravatar.com' do
|
||
|
with_settings :gravatar_enabled => '1', :gravatar_default => 'robohash' do
|
||
|
get '/users/2.xml'
|
||
|
end
|
||
|
end
|
||
|
assert_response :success
|
||
|
assert_select 'user id', :text => '2'
|
||
|
assert_select 'user updated_on', :text => Time.zone.parse('2006-07-19T20:42:15Z').iso8601
|
||
|
assert_select 'user passwd_changed_on', :text => ''
|
||
|
assert_select 'user avatar_url', :text => %r|\Ahttps://gravatar.com/avatar/\h{32}\?default=robohash|
|
||
|
end
|
||
|
test "GET /users/:id.json should return the user" do
|
||
- « Previous
- 1
- 2
- 3
- Next »