diff --git a/app/controllers/sections_controller.rb b/app/controllers/sections_controller.rb index 146391f..51cea79 100644 --- a/app/controllers/sections_controller.rb +++ b/app/controllers/sections_controller.rb @@ -21,7 +21,8 @@ #update a section of a template def admin_update @section = Section.includes(phase: :template).find(params[:id]) -puts "HERE" +puts "CONTROLLER USER: (#{current_user.can_org_admin?}) - #{current_user.inspect}" +puts "CONTROLLER ROLES: #{current_user.roles.inspect}" authorize @section puts "THERE" @section.description = params["section-desc-#{params[:id]}"] diff --git a/app/policies/section_policy.rb b/app/policies/section_policy.rb index 627d66a..f282b65 100644 --- a/app/policies/section_policy.rb +++ b/app/policies/section_policy.rb @@ -19,8 +19,9 @@ def admin_update? +puts "POLICY USER: (#{user.can_org_admin?}) - #{user.inspect}" +puts "POLICY ROLES: #{user.roles.inspect}" puts "MODIFIER? #{user.can_modify_templates?} ORGS MATCH? #{(section.phase.template.org_id == user.org_id)}" -puts "MODIFIER? #{@user.can_modify_templates?} ORGS MATCH? #{(@section.phase.template.org_id == @user.org_id)}" user.can_modify_templates? && (section.phase.template.org_id == user.org_id) end diff --git a/test/functional/sections_controller_test.rb b/test/functional/sections_controller_test.rb index fc66138..f38d68f 100644 --- a/test/functional/sections_controller_test.rb +++ b/test/functional/sections_controller_test.rb @@ -68,10 +68,8 @@ put admin_update_section_path(@phase.sections.first), {section: params} assert_unauthorized_redirect_to_root_path -puts "USER ORG: #{@user.org.abbreviation} (can org admin? #{@user.can_org_admin?})" -puts "TMPLT ORG: #{@template.org.abbreviation}" -puts "PHASE ORG: #{@phase.template.org.abbreviation}" - +puts "TEST USER (#{@user.can_org_admin?}) - #{@user.inspect}" +puts "TEST ROLES: #{@user.roles.inspect}" sign_in @user # Valid save