2018-07-24 06:00:56 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-04-04 19:43:41 -04:00
|
|
|
class DeployTokenPolicy < BasePolicy
|
|
|
|
with_options scope: :subject, score: 0
|
2018-07-11 10:36:08 -04:00
|
|
|
condition(:maintainer) { @subject.project.team.maintainer?(@user) }
|
2018-04-04 19:43:41 -04:00
|
|
|
|
|
|
|
rule { anonymous }.prevent_all
|
|
|
|
|
2018-07-11 10:36:08 -04:00
|
|
|
rule { maintainer }.policy do
|
2018-04-04 19:43:41 -04:00
|
|
|
enable :create_deploy_token
|
|
|
|
enable :update_deploy_token
|
|
|
|
end
|
|
|
|
end
|