mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-06 05:04:35 +08:00
20 lines
624 B
Ruby
20 lines
624 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Recipients
|
|
class DueDateRecipients
|
|
def initialize(params)
|
|
@params = params
|
|
end
|
|
|
|
def recipients
|
|
record, permission = if @params[:experiment_id].present?
|
|
[Experiment.find_by(id: @params[:experiment_id]), ExperimentPermissions::MANAGE]
|
|
elsif @params[:project_id].present?
|
|
[Project.find_by(id: @params[:project_id]), ProjectPermissions::MANAGE]
|
|
end
|
|
return User.none unless record
|
|
|
|
record.users_with_permission(permission)
|
|
end
|
|
end
|
|
end
|