diff options
| author | cedricnjanga | 2018-02-23 13:29:07 -0800 | 
|---|---|---|
| committer | cedricnjanga | 2018-02-23 13:29:07 -0800 | 
| commit | 69b901fa1223fb78142a1e4e76d1b88d879aec61 (patch) | |
| tree | 759c4e26b2b532032752d82e2158fa0f712fa9c7 /app/policies | |
| parent | 206bf218e1b84dbe53683ec2e3f983cd30f7ded1 (diff) | |
| download | chouette-core-69b901fa1223fb78142a1e4e76d1b88d879aec61.tar.bz2 | |
Refs #5950 Fix 404 error when user wants to see CCSet from other organisation :
- remove begin_association_chain in controller
- Change collecyion to only see user organisayion CCSet and STIF CCSet
- add policy for show action
Diffstat (limited to 'app/policies')
| -rw-r--r-- | app/policies/application_policy.rb | 5 | ||||
| -rw-r--r-- | app/policies/compliance_control_set_policy.rb | 4 | 
2 files changed, 9 insertions, 0 deletions
| diff --git a/app/policies/application_policy.rb b/app/policies/application_policy.rb index c44937c9e..d14839bdf 100644 --- a/app/policies/application_policy.rb +++ b/app/policies/application_policy.rb @@ -96,6 +96,11 @@ class ApplicationPolicy    end +  def belongs_to_stif? +    record.try(:organisation).try(:code) == "STIF" +  end + +    #    #  Helpers    #  ------- diff --git a/app/policies/compliance_control_set_policy.rb b/app/policies/compliance_control_set_policy.rb index 011f6c0c7..e3fb83e38 100644 --- a/app/policies/compliance_control_set_policy.rb +++ b/app/policies/compliance_control_set_policy.rb @@ -5,6 +5,10 @@ class ComplianceControlSetPolicy < ApplicationPolicy      end    end +  def show? +    organisation_match? or belongs_to_stif? +  end +    def destroy?      user.has_permission?('compliance_control_sets.destroy')    end | 
