diff options
Diffstat (limited to 'lib/api/helpers/packages/basic_auth_helpers.rb')
-rw-r--r-- | lib/api/helpers/packages/basic_auth_helpers.rb | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/api/helpers/packages/basic_auth_helpers.rb b/lib/api/helpers/packages/basic_auth_helpers.rb index a62bb1d4991..4f301d7038a 100644 --- a/lib/api/helpers/packages/basic_auth_helpers.rb +++ b/lib/api/helpers/packages/basic_auth_helpers.rb @@ -41,16 +41,15 @@ module API end def find_authorized_group! - strong_memoize(:authorized_group) do - group = find_group(params[:id]) + group = find_group(params[:id]) - unless group && can?(current_user, :read_group, group) - next unauthorized_or! { not_found! } - end - - group + unless group && can?(current_user, :read_group, group) + return unauthorized_or! { not_found! } end + + group end + strong_memoize_attr :find_authorized_group! def authorize!(action, subject = :global, reason = nil) return if can?(current_user, action, subject) |