about summary refs log tree commit diff
path: root/app/policies
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-08-28 11:26:27 +0200
committerClaire <claire.github-309c@sitedethib.com>2022-08-28 11:31:00 +0200
commit077183a12128cf9dbc2cbbdbffbf49250e9b38df (patch)
tree7aed6cae7382ac413b0f93e7523552307fe6938d /app/policies
parent54d9a9c18a74a1ec766d8f611ad3ee11ab4c5422 (diff)
parent2a7766dcc958ad18df761de50f9da5164f1a2e8f (diff)
Merge branch 'main' into glitch-soc/merge-upstream
Conflicts:
- `app/controllers/settings/preferences_controller.rb`:
  Upstream dropping `digest` from notifications emails while we have more
  notification emails settings.
  Removed `digest` from our list while keeping our extra settings.
- `app/javascript/packs/admin.js`:
  Conflicts caused by glitch-soc's theming system.
  Applied the changes to `app/javascript/core/admin.js`.
- `app/views/settings/preferences/other/show.html.haml`:
  Upstream removed a setting close to a glitch-soc-only setting.
  Applied upstream's change.
Diffstat (limited to 'app/policies')
-rw-r--r--app/policies/canonical_email_block_policy.rb23
-rw-r--r--app/policies/ip_block_policy.rb4
2 files changed, 27 insertions, 0 deletions
diff --git a/app/policies/canonical_email_block_policy.rb b/app/policies/canonical_email_block_policy.rb
new file mode 100644
index 000000000..8d76075c9
--- /dev/null
+++ b/app/policies/canonical_email_block_policy.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+class CanonicalEmailBlockPolicy < ApplicationPolicy
+  def index?
+    role.can?(:manage_blocks)
+  end
+
+  def show?
+    role.can?(:manage_blocks)
+  end
+
+  def test?
+    role.can?(:manage_blocks)
+  end
+
+  def create?
+    role.can?(:manage_blocks)
+  end
+
+  def destroy?
+    role.can?(:manage_blocks)
+  end
+end
diff --git a/app/policies/ip_block_policy.rb b/app/policies/ip_block_policy.rb
index 1abc97ad8..2986a4fdb 100644
--- a/app/policies/ip_block_policy.rb
+++ b/app/policies/ip_block_policy.rb
@@ -9,6 +9,10 @@ class IpBlockPolicy < ApplicationPolicy
     role.can?(:manage_blocks)
   end
 
+  def update?
+    role.can?(:manage_blocks)
+  end
+
   def destroy?
     role.can?(:manage_blocks)
   end