Conch API

Logo

Datacenter build and management service

View the Project on GitHub joyent/conch-api

NAME

Conch::Plugin::AuthHelpers

DESCRIPTION

Contains all convenience handlers for authentication

HELPERS

is_system_admin

return $c->status(403) if not $c->is_system_admin;

Verifies that the currently stashed user has the ‘is_admin’ flag set

is_workspace_admin

return $c->status(403) if not $c->is_workspace_admin;

Verifies that the currently stashed user_id has ‘admin’ permission on the current workspace (as specified by :workspace_id in the path) or one of its ancestors.

user_has_workspace_auth

Verifies that the currently stashed user_id has (at least) this auth role on the specified workspace (as indicated by :workspace_id in the path).

Users with the admin flag set will always return true, even if no user_workspace_role records are present.

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/.