Documentation ¶
Index ¶
- func Check(user *auth.CurrentUser, XMLID string, tx *sql.Tx) (error, error, int)
- func CheckID(tx *sql.Tx, user *auth.CurrentUser, dsID int) (error, error, int)
- func GetDSTenantIDByIDTx(tx *sql.Tx, id int) (*int, bool, error)
- func GetUserTenantIDListTx(tx *sql.Tx, userTenantID int) ([]int, error)
- func GetUserTenantListTx(user auth.CurrentUser, tx *sql.Tx) ([]tc.TenantNullable, error)
- func IsResourceAuthorizedToUserTx(resourceTenantID int, user *auth.CurrentUser, tx *sql.Tx) (bool, error)
- type DeliveryServiceTenantInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Check ¶
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 ¶
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 ¶
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 ¶
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