2016-08-18 12:52:35 -04:00
|
|
|
module Ci
|
|
|
|
class RunnerPolicy < BasePolicy
|
|
|
|
def rules
|
|
|
|
return unless @user
|
|
|
|
|
2017-04-08 22:20:57 -04:00
|
|
|
can! :assign_runner if @user.admin?
|
2016-08-18 12:52:35 -04:00
|
|
|
|
|
|
|
return if @subject.is_shared? || @subject.locked?
|
|
|
|
|
|
|
|
can! :assign_runner if @user.ci_authorized_runners.include?(@subject)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|