Skip to content

Commit

Permalink
Fix issues
Browse files Browse the repository at this point in the history
  • Loading branch information
klaustopher committed Nov 2, 2023
1 parent 2faf755 commit c749c88
Show file tree
Hide file tree
Showing 2 changed files with 280 additions and 244 deletions.
3 changes: 2 additions & 1 deletion app/services/authorization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def permissions_for(action, raise_on_unknown: false) # rubocop:disable Metrics/P
raise UnknownPermissionError.new(action) if raise_on_unknown
end

[]
return []
end

perms
Expand All @@ -92,6 +92,7 @@ def permissions_for(action, raise_on_unknown: false) # rubocop:disable Metrics/P
# attribute of the permission), an +IllegalPermissionContextError+ is raised
def contextual_permissions(action, context, raise_on_unknown: false)
perms = permissions_for(action, raise_on_unknown:)
return [] if perms.blank?

context_perms = perms.select { |p| p.permissible_on?(context) }
raise IllegalPermissionContextError.new(action, perms, context) if context_perms.blank?
Expand Down
Loading

0 comments on commit c749c88

Please sign in to comment.