diff options
| author | Robert | 2017-07-05 11:54:33 +0200 | 
|---|---|---|
| committer | Robert | 2017-07-05 11:59:06 +0200 | 
| commit | e53aa88c442bd0057c4e0ae66e2684d62d3193ed (patch) | |
| tree | 1ba7c8c082dde92ba215659fde9293e231e7c7df /app/policies/referential_policy.rb | |
| parent | 841bd65847066e92bf5a4d6de112fed1ada73c1c (diff) | |
| download | chouette-core-e53aa88c442bd0057c4e0ae66e2684d62d3193ed.tar.bz2 | |
Refs: #3478@1h;
   -  All permissions tied to `!archived?`
   -  Tests adapted
   -  Policies refactored
   ?  Is `create?` permission bound to `organisation_match?`
Diffstat (limited to 'app/policies/referential_policy.rb')
| -rw-r--r-- | app/policies/referential_policy.rb | 20 | 
1 files changed, 10 insertions, 10 deletions
diff --git a/app/policies/referential_policy.rb b/app/policies/referential_policy.rb index 371cae218..7f8c9e939 100644 --- a/app/policies/referential_policy.rb +++ b/app/policies/referential_policy.rb @@ -10,20 +10,25 @@ class ReferentialPolicy < ApplicationPolicy    end    def destroy? -    organisation_match? && user.has_permission?('referentials.destroy') +    !archived? && organisation_match? && user.has_permission?('referentials.destroy')    end    def update? -    organisation_match? && user.has_permission?('referentials.edit') +    !archived? && organisation_match? && user.has_permission?('referentials.edit')    end + +  def clone? +    !archived? && organisation_match? && create? +  end +    def archive? -    edit? +    !archived? && update?    end -  def clone? -    organisation_match? && create? +  def unarchive? +    archived? && update?    end    def common_lines? @@ -31,11 +36,6 @@ class ReferentialPolicy < ApplicationPolicy      true    end -  def show? -    true -  end - -  def unarchive? ; archive? end  end  | 
