scinote-web/app/permissions/result.rb

16 lines
462 B
Ruby
Raw Normal View History

2020-12-14 19:50:54 +08:00
# frozen_string_literal: true
Canaid::Permissions.register_for(Result) do
can :read_result do |user, result|
can_read_experiment?(user, result.my_module.experiment)
end
can :manage_result do |user, result|
can_manage_module?(user, result.my_module) && result.active? && result.unlocked?(result)
end
2021-01-20 16:00:45 +08:00
can :delete_result do |user, result|
can_manage_module?(user, result.my_module) && result.archived? && result.unlocked?(result)
end
2020-12-14 19:50:54 +08:00
end