diff options
| author | Alban Peignier | 2017-11-29 21:21:48 +0100 |
|---|---|---|
| committer | Alban Peignier | 2017-11-29 21:21:48 +0100 |
| commit | 81ed498610706eabaa6a2a6bc04d7b9ab0d1caeb (patch) | |
| tree | 9d0c91bf949ea07b21e6165b4e039350d2feb047 | |
| parent | a2288ed15fadc492c5750aaf0eab5870b542daf0 (diff) | |
| download | chouette-core-81ed498610706eabaa6a2a6bc04d7b9ab0d1caeb.tar.bz2 | |
Check user permissions in CompanyPolicy. Refs #4967
| -rw-r--r-- | app/policies/company_policy.rb | 20 |
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 |
