aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlban Peignier2017-11-29 21:21:48 +0100
committerAlban Peignier2017-11-29 21:21:48 +0100
commit81ed498610706eabaa6a2a6bc04d7b9ab0d1caeb (patch)
tree9d0c91bf949ea07b21e6165b4e039350d2feb047
parenta2288ed15fadc492c5750aaf0eab5870b542daf0 (diff)
downloadchouette-core-81ed498610706eabaa6a2a6bc04d7b9ab0d1caeb.tar.bz2
Check user permissions in CompanyPolicy. Refs #4967
-rw-r--r--app/policies/company_policy.rb20
1 files changed, 16 insertions, 4 deletions
diff --git a/app/policies/company_policy.rb b/app/policies/company_policy.rb
index 45386aba4..b08dcec53 100644
--- a/app/policies/company_policy.rb
+++ b/app/policies/company_policy.rb
@@ -1,7 +1,19 @@
class CompanyPolicy < ApplicationPolicy
- class Scope < Scope
- def resolve
- scope
- end
+ class Scope < Scope
+ def resolve
+ scope
end
end
+
+ def create?
+ user.has_permission?('companies.create')
+ end
+
+ def destroy?
+ user.has_permission?('companies.destroy')
+ end
+
+ def update?
+ user.has_permission?('companies.update')
+ end
+end