mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-15 21:56:12 +08:00
35 lines
821 B
Ruby
35 lines
821 B
Ruby
# frozen_string_literal: true
|
|
|
|
module SmartAnnotations
|
|
class PermissionEval
|
|
class << self
|
|
include Canaid::Helpers::PermissionsHelper
|
|
|
|
def check(user, type, object)
|
|
send("validate_#{type}_permissions", user, object)
|
|
end
|
|
|
|
private
|
|
|
|
def validate_prj_permissions(user, object)
|
|
can_read_project?(user, object)
|
|
end
|
|
|
|
def validate_exp_permissions(user, object)
|
|
can_read_experiment?(user, object)
|
|
end
|
|
|
|
def validate_tsk_permissions(user, object)
|
|
can_read_experiment?(user, object.experiment)
|
|
end
|
|
|
|
def validate_sam_permissions(user, object)
|
|
can_read_team?(user, object.team)
|
|
end
|
|
|
|
def validate_rep_item_permissions(user, object)
|
|
can_read_team?(user, object.repository.team)
|
|
end
|
|
end
|
|
end
|
|
end
|