Adjusting logic to match intention (#17015)

Unearthed in a deep read of the code during the review of forem/forem#16997
This commit is contained in:
Jeremy Friesen 2022-03-30 16:21:58 -04:00 committed by GitHub
parent f680bc8d53
commit 010fc3bce0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -21,7 +21,7 @@ class DashboardsController < ApplicationController
fetch_and_authorize_user
target = @user
# NOTE: This is a subtle policy check happening here that we are not encapsulating
not_authorized if params[:org_id] && !@user.org_admin?(params[:org_id] || @user.any_admin?)
not_authorized if params[:org_id] && !(@user.org_admin?(params[:org_id]) || @user.any_admin?)
@organizations = @user.admin_organizations