aboutsummaryrefslogtreecommitdiffstats
path: root/app/policies/application_policy.rb
diff options
context:
space:
mode:
authorVlatka Pavisic2017-02-06 11:42:12 +0100
committerVlatka Pavisic2017-02-07 11:25:29 +0100
commitd94b1271d147fdb5bbd1e616e116173198e858db (patch)
treee1b5631e72e009ffd80fdf4e47159b2b11cd899e /app/policies/application_policy.rb
parent9c3095c20aaef122212ed71ce8818e3a18b13308 (diff)
downloadchouette-core-d94b1271d147fdb5bbd1e616e116173198e858db.tar.bz2
Refs #2476 : Disable modification and deletion of resources from another referential; in progress
Diffstat (limited to 'app/policies/application_policy.rb')
-rw-r--r--app/policies/application_policy.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/policies/application_policy.rb b/app/policies/application_policy.rb
index 2a0bbc521..07138b38e 100644
--- a/app/policies/application_policy.rb
+++ b/app/policies/application_policy.rb
@@ -38,6 +38,10 @@ class ApplicationPolicy
Pundit.policy_scope!(user, record.class)
end
+ def organisation_match?(via_referential: false)
+ eval("user.organisation == record#{'.referential' if via_referential}.organisation")
+ end
+
class Scope
attr_reader :user, :scope