2018-12-25 04:48:26 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class ReleasePolicy < BasePolicy
|
|
|
|
delegate { @subject.project }
|
2021-07-01 20:07:53 -04:00
|
|
|
|
|
|
|
condition(:protected_tag) do
|
|
|
|
access = ::Gitlab::UserAccess.new(@user, container: @subject.project)
|
|
|
|
|
|
|
|
!access.can_create_tag?(@subject.tag)
|
|
|
|
end
|
|
|
|
|
2021-07-27 17:09:42 -04:00
|
|
|
rule { protected_tag }.policy do
|
2021-07-01 20:07:53 -04:00
|
|
|
prevent :create_release
|
|
|
|
prevent :update_release
|
|
|
|
prevent :destroy_release
|
|
|
|
end
|
2018-12-25 04:48:26 -05:00
|
|
|
end
|