aboutsummaryrefslogtreecommitdiffstats
path: root/app/policies/acces_point_policy.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/policies/acces_point_policy.rb')
-rw-r--r--app/policies/acces_point_policy.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/app/policies/acces_point_policy.rb b/app/policies/acces_point_policy.rb
new file mode 100644
index 000000000..4f604693c
--- /dev/null
+++ b/app/policies/acces_point_policy.rb
@@ -0,0 +1,22 @@
+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 edit?
+ organisation_match?(via_referential: true) && user.has_permission?('access_points.edit')
+ end
+
+ def destroy?
+ organisation_match?(via_referential: true) && user.has_permission?('access_points.destroy')
+ end
+
+ def update? ; edit? end
+ def new? ; create? end
+end