Use load_and_authorize_resource in versions controlller

This commit is contained in:
Nishanth Vijayan 2016-08-15 14:21:33 +05:30
parent 71c8dd4127
commit 58a3913735
2 changed files with 9 additions and 16 deletions

View file

@ -178,9 +178,8 @@ class Ability
role.resource_type == 'Conference' && (conf_ids_for_organizer.include? role.resource_id)
end
can [:index, :revert_object, :revert_attribute], PaperTrail::Version do |version|
version.item_type == 'User' || (conf_ids_for_organizer.include? version.conference_id)
end
can [:index, :revert_object, :revert_attribute], PaperTrail::Version, item_type: 'User'
can [:index, :revert_object, :revert_attribute], PaperTrail::Version, conference_id: conf_ids_for_organizer
end
def signed_in_with_cfp_role(user)