Skip to content

Commit

Permalink
if allowed groups is empty, attempt to retrieve them
Browse files Browse the repository at this point in the history
  • Loading branch information
nvdk committed Jun 11, 2020
1 parent 9c03280 commit e2d2bfc
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions framework/authorization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -470,9 +470,13 @@ def sort_groups groups
# Returns the allowed_groups from the request
def get_allowed_groups
allowed_groups_s = request.env["HTTP_MU_AUTH_ALLOWED_GROUPS"]
allowed_groups =
allowed_groups_s ? JSON.parse(allowed_groups_s) : []

if allowed_groups_s.nil? || allowed_groups_s.length == 0
# TODO: this isn't very clean and relies on ruby-template internals
response = query("ASK {?s ?p ?o}")
allowed_groups = JSON.parse(RequestStore.store[:mu_auth_allowed_groups])
else
allowed_groups = JSON.parse(allowed_groups_s)
end
return sort_groups(allowed_groups)
end

Expand Down

0 comments on commit e2d2bfc

Please sign in to comment.