Prevent cross access of PG for different exercise
Here, we are only checking the condition based on the URL if both parameters (exercise and programming group) are given. Otherwise, we skip the check.
This commit is contained in:

committed by
Sebastian Serth

parent
3048cf2644
commit
1e06ab3fa9
@ -94,6 +94,8 @@ class ProgrammingGroupsController < ApplicationController
|
|||||||
private
|
private
|
||||||
|
|
||||||
def authorize!
|
def authorize!
|
||||||
|
raise Pundit::NotAuthorizedError if @programming_group.present? && @exercise.present? && @programming_group.exercise != @exercise
|
||||||
|
|
||||||
authorize(@programming_group || @programming_groups)
|
authorize(@programming_group || @programming_groups)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user