-
- Downloads
API: Memoize the current_user so that the sudo can work properly
The issue was arising when `#current_user` was called a second time
after a user was impersonated: the `User#is_admin?` check would be
performed on it and it would fail.
Signed-off-by:
Rémy Coutable <remy@rymai.me>
Showing
- changelogs/unreleased/25482-fix-api-sudo.yml 4 additions, 0 deletionschangelogs/unreleased/25482-fix-api-sudo.yml
- lib/api/helpers.rb 78 additions, 53 deletionslib/api/helpers.rb
- lib/api/users.rb 1 addition, 1 deletionlib/api/users.rb
- spec/requests/api/helpers_spec.rb 51 additions, 30 deletionsspec/requests/api/helpers_spec.rb
- spec/requests/api/users_spec.rb 15 additions, 12 deletionsspec/requests/api/users_spec.rb
Loading
Please register or sign in to comment