2018-11-18 11:00:15 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-05-09 12:01:36 +05:30
|
|
|
class DeployTokenPolicy < BasePolicy
|
|
|
|
with_options scope: :subject, score: 0
|
2018-11-18 11:00:15 +05:30
|
|
|
condition(:maintainer) { @subject.project.team.maintainer?(@user) }
|
2018-05-09 12:01:36 +05:30
|
|
|
|
|
|
|
rule { anonymous }.prevent_all
|
|
|
|
|
2018-11-18 11:00:15 +05:30
|
|
|
rule { maintainer }.policy do
|
2018-05-09 12:01:36 +05:30
|
|
|
enable :create_deploy_token
|
|
|
|
enable :update_deploy_token
|
|
|
|
end
|
|
|
|
end
|