BigW Consortium Gitlab

Commit 502d6464 by Nick Thomas

Allow v4 API GET requests for groups to be unauthenticated

parent 99bb3dde
...@@ -2,7 +2,7 @@ module API ...@@ -2,7 +2,7 @@ module API
class Groups < Grape::API class Groups < Grape::API
include PaginationParams include PaginationParams
before { authenticate! } before { authenticate_non_get! }
helpers do helpers do
params :optional_params_ce do params :optional_params_ce do
...@@ -48,10 +48,10 @@ module API ...@@ -48,10 +48,10 @@ module API
end end
get do get do
groups = if params[:owned] groups = if params[:owned]
current_user.owned_groups current_user ? current_user.owned_groups : Group.none
elsif current_user.admin elsif current_user&.admin?
Group.all Group.all
elsif params[:all_available] elsif params[:all_available] || current_user.nil?
GroupsFinder.new(current_user).execute GroupsFinder.new(current_user).execute
else else
current_user.groups current_user.groups
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment