class Yao::Resources::RoleAssignment

Public Class Methods

create_url(_subpath='') click to toggle source

@param _subpath [String] @return [String]

# File lib/yao/resources/role_assignment.rb, line 22
def create_url(_subpath='')
  resources_name
end
get(opt = {}) click to toggle source

@param query [Hash]

# File lib/yao/resources/role_assignment.rb, line 27
def get(opt = {})
  query = {}

  if (user = opt[:user])
    query['user.id'] = resource_id_or_string(user)
  end

  if (project = opt[:project] || opt[:tenant])
    query['scope.project.id'] = resource_id_or_string(project)
  end

  list(query)
end

Private Class Methods

resource_id_or_string(item) click to toggle source
# File lib/yao/resources/role_assignment.rb, line 42
def resource_id_or_string(item)
  if item.respond_to?(:id)
    item.id
  else
    item
  end
end

Public Instance Methods

project() click to toggle source

@return [Yao::Resources::Project]

# File lib/yao/resources/role_assignment.rb, line 15
def project
  @project ||= Yao::Project.get(scope["project"]["id"])
end