Skip to content

Commit

Permalink
Delete ResourcePermission when resource does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
moustachu committed Dec 7, 2023
1 parent 44435e3 commit 1445b79
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ def change
Decidim::ResourcePermission.all.each do |resource_permission|
next if resource_permission.permissions.blank?

if resource_permission.resource.blank?
resource_permission.delete
next
end

resource_permission.permissions.each do |action, authorization|
if authorization.has_key?("authorization_handlers") && authorization["authorization_handlers"].has_key?("extended_socio_demographic_authorization_handler")
resource_permission.permissions.delete(action)
Expand Down

0 comments on commit 1445b79

Please sign in to comment.