gitlab-org--gitlab-foss/app/policies/release_policy.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

18 lines
382 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class ReleasePolicy < BasePolicy
delegate { @subject.project }
condition(:protected_tag) do
access = ::Gitlab::UserAccess.new(@user, container: @subject.project)
!access.can_create_tag?(@subject.tag)
end
rule { protected_tag }.policy do
prevent :create_release
prevent :update_release
prevent :destroy_release
end
end