tenant

package
v6.1.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 4, 2022 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 1 more Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(user *auth.CurrentUser, XMLID string, tx *sql.Tx) (error, error, int)

Check checks that the given user has access to the given XMLID. Returns a user error, system error, and the HTTP status code to be returned to the user if an error occurred. On success, the user error and system error will both be nil, and the error code should be ignored.

func CheckID

func CheckID(tx *sql.Tx, user *auth.CurrentUser, dsID int) (error, error, int)

CheckID checks that the given user has access to the given delivery service. Returns a user error, a system error, and an HTTP error code. If both the user and system error are nil, the error code should be ignored.

func GetDSTenantIDByIDTx

func GetDSTenantIDByIDTx(tx *sql.Tx, id int) (*int, bool, error)

GetDSTenantIDByIDTx returns the tenant ID, whether the delivery service exists, and any error. Note the id may be nil, even if true is returned, if the delivery service exists but its tenant_id field is null. TODO move somewhere generic

func GetUserTenantIDListTx

func GetUserTenantIDListTx(tx *sql.Tx, userTenantID int) ([]int, error)

GetUserTenantIDListTx returns a list of tenant IDs accessible to the given tenant. Note: If the given tenant or any of its parents are inactive, no IDs will be returned. If child tenants are needed even if the current tenant is inactive, use GetUserTenantListTx instead.

func GetUserTenantListTx

func GetUserTenantListTx(user auth.CurrentUser, tx *sql.Tx) ([]tc.TenantNullable, error)

GetUserTenantListTx returns a Tenant list that the specified user has access to.

func IsResourceAuthorizedToUserTx

func IsResourceAuthorizedToUserTx(resourceTenantID int, user *auth.CurrentUser, tx *sql.Tx) (bool, error)

IsResourceAuthorizedToUserTx returns a boolean value describing if the user has access to the provided resource tenant id and an error If the user tenant is inactive (or any of its parent tenants are inactive), false will be returned.

Types

type DeliveryServiceTenantInfo

type DeliveryServiceTenantInfo tc.DeliveryServiceNullable

DeliveryServiceTenantInfo provides only deliveryservice info needed here

func GetDeliveryServiceTenantInfo

func GetDeliveryServiceTenantInfo(xmlID string, tx *sql.Tx) (*DeliveryServiceTenantInfo, error)

GetDeliveryServiceTenantInfo returns tenant information for a deliveryservice

func (DeliveryServiceTenantInfo) IsTenantAuthorized

func (dsInfo DeliveryServiceTenantInfo) IsTenantAuthorized(user *auth.CurrentUser, tx *sql.Tx) (bool, error)

IsTenantAuthorized returns true if the user has tenant access on this tenant

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL