api_utils

package
v0.40.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildAPIDependsOn added in v0.24.0

func BuildAPIDependsOn(space *model.Space) []string

func BuildAPIShares added in v0.24.0

func BuildAPIShares(space *model.Space) []string

func CheckTemplateAccess added in v0.33.0

func CheckTemplateAccess(templateId string, user *model.User) error

CheckTemplateAccess enforces the same visibility as the template read path: template managers see everything; everyone else only templates returned by their permission-filtered, zone-restricted list. Callers map the error to a 404 so template existence isn't leaked.

func FileStorageAllowed added in v0.39.0

func FileStorageAllowed(next http.HandlerFunc) http.HandlerFunc

FileStorageAllowed refuses file storage requests from spaces whose template switches file storage off, or that have switched it off themselves.

func GetAccessibleSpace added in v0.24.2

func GetAccessibleSpace(spaceId string, user *model.User) (*model.Space, error)

func GetLatestSpaceResourceUsage added in v0.24.2

func GetLatestSpaceResourceUsage(spaceId string) *apiclient.SpaceResourceUsage

func GetSpaceDetails added in v0.19.0

func GetSpaceDetails(spaceId string, user *model.User) (*apiclient.SpaceDefinition, error)

GetSpaceDetails returns detailed space information with permission checks

func GetTemplateDetails added in v0.19.0

func GetTemplateDetails(templateId string, user *model.User) (*apiclient.TemplateDetails, error)

GetTemplateDetails returns detailed template information with permission checks

func RequestSpace added in v0.40.0

func RequestSpace(r *http.Request) *model.Space

RequestSpace returns the space a request comes from, or nil when the request isn't from a space (only the agent's token carries one) or the space can't be found. It is read on every call, so restrictions the space applies to itself take effect straight away.

func RequestSpaceTemplate added in v0.39.0

func RequestSpaceTemplate(r *http.Request) *model.Template

RequestSpaceTemplate returns the template of the space a request comes from, or nil when the request isn't from a space or the template can't be found. It is read on every call, so changing a template's settings applies to its spaces straight away.

Types

type ApiUtilsUsers

type ApiUtilsUsers struct {
}

func NewApiUtilsUsers

func NewApiUtilsUsers() *ApiUtilsUsers

func (*ApiUtilsUsers) DeleteUser

func (auu *ApiUtilsUsers) DeleteUser(toDelete *model.User) error

func (*ApiUtilsUsers) RemoveUsersSessions

func (auu *ApiUtilsUsers) RemoveUsersSessions(user *model.User)

Delete the sessions owned by a user

func (*ApiUtilsUsers) RemoveUsersTokens

func (auu *ApiUtilsUsers) RemoveUsersTokens(user *model.User)

Delete the tokens owned by a user

func (*ApiUtilsUsers) UpdateSpaceSSHKeys

func (auu *ApiUtilsUsers) UpdateSpaceSSHKeys(space *model.Space, user *model.User)

func (*ApiUtilsUsers) UpdateSpacesSSHKey

func (auu *ApiUtilsUsers) UpdateSpacesSSHKey(user *model.User)

func (*ApiUtilsUsers) UpdateUserSpaces

func (auu *ApiUtilsUsers) UpdateUserSpaces(user *model.User)

For disabled users ensure all spaces are stopped, for enabled users update the SSH key on the agents

Jump to

Keyboard shortcuts

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