Skip to content

Commit

Permalink
#36 Admin role grants access
Browse files Browse the repository at this point in the history
  • Loading branch information
picman committed Sep 26, 2024
1 parent f2426d7 commit a9ccbc2
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions app/controllers/redmine_oauth_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,12 @@ def oauth_callback
roles = roles[key]
end
roles = roles.to_a
if roles.blank? || roles.exclude?('user')
@admin = roles.include?('admin')
if roles.blank? || (roles.exclude?('user') && !@admin)
Rails.logger.info 'Authentication failed due to a missing role in the token'
params[:username] = email
invalid_credentials
raise StandardError, l(:notice_account_invalid_credentials)
else
@admin = roles.to_a.include?('admin')
end
end

Expand Down

0 comments on commit a9ccbc2

Please sign in to comment.