Skip to content

Commit e2d2bfc

Browse files
committed
if allowed groups is empty, attempt to retrieve them
1 parent 9c03280 commit e2d2bfc

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Diff for: framework/authorization.rb

+7-3
Original file line numberDiff line numberDiff line change
@@ -470,9 +470,13 @@ def sort_groups groups
470470
# Returns the allowed_groups from the request
471471
def get_allowed_groups
472472
allowed_groups_s = request.env["HTTP_MU_AUTH_ALLOWED_GROUPS"]
473-
allowed_groups =
474-
allowed_groups_s ? JSON.parse(allowed_groups_s) : []
475-
473+
if allowed_groups_s.nil? || allowed_groups_s.length == 0
474+
# TODO: this isn't very clean and relies on ruby-template internals
475+
response = query("ASK {?s ?p ?o}")
476+
allowed_groups = JSON.parse(RequestStore.store[:mu_auth_allowed_groups])
477+
else
478+
allowed_groups = JSON.parse(allowed_groups_s)
479+
end
476480
return sort_groups(allowed_groups)
477481
end
478482

0 commit comments

Comments
 (0)