Class: Ci::PipelinePolicy

Inherits:
BasePolicy
  • Object
show all
Defined in:
app/policies/ci/pipeline_policy.rb

Direct Known Subclasses

PipelineSchedulePolicy

Instance Method Summary collapse

Instance Method Details

#ref_protected?(user, project, tag, ref) ⇒ Boolean

Returns:

  • (Boolean)

44
45
46
47
48
49
50
51
52
# File 'app/policies/ci/pipeline_policy.rb', line 44

def ref_protected?(user, project, tag, ref)
  access = ::Gitlab::UserAccess.new(user, container: project)

  if tag
    !access.can_create_tag?(ref)
  else
    !access.can_update_branch?(ref)
  end
end