Skip to content

Commit

Permalink
Require admin flag for admin UPP requests (#4257)
Browse files Browse the repository at this point in the history
* Check api_user, not api_user.user, for admin flag

* Add admin flag to admin request
  • Loading branch information
zwolf authored Oct 18, 2023
1 parent 377fc00 commit b7707fb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/api/v1/project_preferences_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def find_upp_for_update_settings
end

def user_allowed?
@upp.project.owners_and_collaborators.include?(api_user.user) || api_user.user.is_admin?
@upp.project.owners_and_collaborators.include?(api_user.user) || api_user.is_admin?
end

def update_settings_response
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@

it 'lets the admin update UPP settings' do
default_request user_id: admin_user.id, scopes: scopes
settings_params[:admin] = true
run_update
expect(response.status).to eq(200)
end
Expand Down

0 comments on commit b7707fb

Please sign in to comment.