Verified Commit a3cb44e7 authored by Kaspar Vollenweider's avatar Kaspar Vollenweider 👻
Browse files

fix assignment policy and cleanup assignment and group_assignment policy

- the correct policy for update_terminated_at method
- order the policies for methods
- allow long lines for policies in rubocop
  - so that policy statements can be lined up in a more readable way
parent 87102e1c
Pipeline #23549 passed with stage
in 40 minutes and 19 seconds
......@@ -47,6 +47,7 @@ Metrics/LineLength:
Max: 100
Exclude:
- 'db/seeds.rb'
- 'app/policies/**/*'
Metrics/ClassLength:
Max: 150
Exclude:
......
......@@ -28,23 +28,17 @@ class AssignmentPolicy < ApplicationPolicy
alias_method :find_client?, :superadmin_or_department_manager?
alias_method :show_comments?, :superadmin_or_department_manager?
alias_method :show?,
:superadmin_or_department_manager_creation_or_volunteer_or_social_worker_related?
alias_method :edit?,
:superadmin_or_department_manager_creation?
alias_method :update?,
:superadmin_or_department_manager_creation?
alias_method :terminate?,
:superadmin_or_department_manager_creation_or_volunteer_related?
alias_method :update_terminated_at?,
:superadmin_or_department_manager_creation?
alias_method :verify_termination?,
:superadmin?
alias_method :submit_feedback?,
:superadmin_or_department_manager_creation_or_volunteer_related?
alias_method :last_submitted_hours_and_feedbacks?,
:superadmin_or_department_manager_creation_or_volunteer_related?
alias_method :hours_and_feedbacks_submitted?,
:superadmin_or_department_manager_or_volunteer?
alias_method :show?, :superadmin_or_department_manager_creation_or_volunteer_or_social_worker_related?
alias_method :edit?, :superadmin_or_department_manager_creation?
alias_method :update?, :superadmin_or_department_manager_creation?
alias_method :verify_termination?, :superadmin?
alias_method :submit_feedback?, :superadmin_or_department_manager_creation_or_volunteer_related?
alias_method :last_submitted_hours_and_feedbacks?, :superadmin_or_department_manager_creation_or_volunteer_related?
alias_method :terminate?, :superadmin_or_department_manager_creation_or_volunteer_related?
alias_method :update_terminated_at?, :superadmin_or_department_manager_creation_or_volunteer_related?
alias_method :hours_and_feedbacks_submitted?, :superadmin_or_department_manager_or_volunteer?
end
......@@ -5,25 +5,24 @@ class GroupAssignmentPolicy < ApplicationPolicy
end
end
alias_method :show?,
:superadmin_or_department_manager_or_volunteer_related?
# Actions related to collections
alias_method :terminated_index?, :superadmin_or_department_manager?
alias_method :hours_and_feedbacks_submitted?, :superadmin_or_department_manager_or_volunteer?
alias_method :create?, :superadmin_or_department_manager_offer?
alias_method :edit?, :superadmin_or_department_manager_offer?
alias_method :update?, :superadmin_or_department_manager_offer?
alias_method :set_end_today?, :superadmin_or_department_manager_offer?
alias_method :verify_termination?, :superadmin_or_department_manager_offer?
# Actions realted to creating a member
alias_method :create?, :superadmin_or_department_manager_offer?
alias_method :terminated_index?, :superadmin_or_department_manager?
# Actions related to editing a member
alias_method :edit?, :superadmin_or_department_manager_offer?
alias_method :update?, :superadmin_or_department_manager_offer?
alias_method :hours_and_feedbacks_submitted?,
:superadmin_or_department_manager_or_volunteer?
alias_method :last_submitted_hours_and_feedbacks?,
:superadmin_or_department_manager_or_volunteer_related?
alias_method :submit_feedback?, :superadmin_or_departments_offer_or_volunteer_related?
alias_method :update_terminated_at?, :superadmin_or_departments_offer_or_volunteer_related?
alias_method :set_end_today?, :superadmin_or_department_manager_offer?
alias_method :terminate?, :superadmin_or_departments_offer_or_volunteer_related?
alias_method :verify_termination?, :superadmin_or_department_manager_offer?
alias_method :update_terminated_at?, :superadmin_or_departments_offer_or_volunteer_related?
# Actions related to showing a member
alias_method :show?, :superadmin_or_department_manager_or_volunteer_related?
alias_method :last_submitted_hours_and_feedbacks?, :superadmin_or_department_manager_or_volunteer_related?
alias_method :show_comments?, :superadmin_or_department_manager?
alias_method :show_comments?, :superadmin_or_department_manager?
end
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment