about summary refs log tree commit diff
path: root/app/policies
diff options
context:
space:
mode:
authorFire Demon <firedemon@creature.cafe>2020-07-25 23:23:09 -0500
committerFire Demon <firedemon@creature.cafe>2020-08-30 05:45:15 -0500
commitc4dd1074fcdeba84c812feec70d757bae0456fdd (patch)
treebf1f7f78bd811e3dd227380d27813a3ae8fddf7a /app/policies
parent70763ef0ea6cb6b997ac144d8b4d855b16fb838c (diff)
[Feature, Privacy] Add API support for per-domain post privacy (account)
Diffstat (limited to 'app/policies')
-rw-r--r--app/policies/account_domain_permission_policy.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/app/policies/account_domain_permission_policy.rb b/app/policies/account_domain_permission_policy.rb
new file mode 100644
index 000000000..b50857f9f
--- /dev/null
+++ b/app/policies/account_domain_permission_policy.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AccountDomainPermissionPolicy < ApplicationPolicy
+  def update?
+    owned?
+  end
+
+  def destroy?
+    owned?
+  end
+
+  private
+
+  def owned?
+    record.account_id == current_account&.id
+  end
+end