Conch API

Logo

Datacenter build and management service

View the Project on GitHub joyent/conch-api

NAME

Conch::DB::ResultSet::Workspace

DESCRIPTION

Interface to queries involving workspaces.

Note: in the methods below, “above” and “beneath” are referring to the workspace tree, where the root (“GLOBAL”) workspace is considered to be at the top and child workspaces hang below as nodes and leaves.

A parent workspace is “above” a given workspace; its children are “beneath”.

METHODS

workspaces_beneath

Chainable resultset that finds all sub-workspaces beneath the provided workspace id.

The resultset does *not* include the original workspace itself – see “and_workspaces_beneath” for that.

and_workspaces_beneath

As workspaces_beneath, but also includes the original workspace.

$workspace_id can be a single workspace_id, an arrayref of multiple distinct workspace_ids, or a resultset, which must return a single column of distinct workspace_id(s)).

workspaces_above

Chainable resultset that finds all workspaces above the provided workspace id (that is, all parent workspaces, up to the root).

The resultset does *not* include the original workspace itself – see “and_workspaces_above” for that.

and_workspaces_above

As workspaces_above, but also includes the original workspace.

$workspace_id can be a single workspace_id, an arrayref of multiple distinct workspace_ids, or a resultset, which must return a single column of distinct workspace_id(s)).

with_role_via_data_for_user

Query for workspace(s) with an extra field attached to the query which will signal the workspace serializer to include the “role” and “via” columns, containing information about the effective permissions the user has for the workspace.

Only one user_id can be calculated at a time. If you need to generate workspace-and-role data for multiple users at once, you can manually do:

$workspace->user_id_for_role($user_id);

before serializing the workspace object.

role_via_for_user

For a given workspace_id and user_id, find the user_workspace_role row that is responsible for providing the user access to the workspace (the user_workspace_role with the greatest permission that is attached to an ancestor workspace).

_workspaces_subquery

Generate values for inserting into a recursive query. The first value is a string to be added after WHERE <column>; the remainder are bind values to be used in \[ $query_string, @binds ].

$workspace_id can be a single workspace_id, an arrayref of multiple distinct workspace_ids, or a resultset (which must return a single column of distinct workspace_id(s)).

LICENSING

Copyright Joyent, Inc.

This Source Code Form is subject to the terms of the Mozilla Public License, v.2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.