Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

28 lines (21 sloc) 0.484 kB
require 'set'
module VCAP::CloudController
class Roles
CLOUD_CONTROLLER_ADMIN_SCOPE = 'cloud_controller.admin'
def initialize(token=nil)
@scopes = Set.new(token && token['scope'])
end
def admin?
@scopes.include?(CLOUD_CONTROLLER_ADMIN_SCOPE)
end
def admin=(flag)
@scopes.send(flag ? :add : :delete, CLOUD_CONTROLLER_ADMIN_SCOPE)
end
def none?
@scopes.empty?
end
def present?
@scopes.any?
end
end
end
Jump to Line
Something went wrong with that request. Please try again.