aboutsummaryrefslogtreecommitdiffstats
path: root/app/policies/access_point_policy.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/policies/access_point_policy.rb')
-rw-r--r--app/policies/access_point_policy.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/app/policies/access_point_policy.rb b/app/policies/access_point_policy.rb
new file mode 100644
index 000000000..4e017eae4
--- /dev/null
+++ b/app/policies/access_point_policy.rb
@@ -0,0 +1,19 @@
+class AccessPointPolicy < ApplicationPolicy
+ class Scope < Scope
+ def resolve
+ scope
+ end
+ end
+
+ def create?
+ user.has_permission?('access_points.create') # organisation match via referential is checked in the view
+ end
+
+ def update?
+ organisation_match? && user.has_permission?('access_points.edit')
+ end
+
+ def destroy?
+ organisation_match? && user.has_permission?('access_points.destroy')
+ end
+end