models

package
v0.6.0-rc.5 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base struct {
	ID        uuid.UUID `gorm:"type:uuid;primaryKey"`
	CreatedAt time.Time
	UpdatedAt time.Time
}

Base is a base model which holds common fields for each model.

func (*Base) BeforeCreate

func (b *Base) BeforeCreate(tx *gorm.DB) error

BeforeCreate triggers by GORM before create.

type BasicAuthToken

type BasicAuthToken struct {
	// contains filtered or unexported fields
}

BasicAuthToken represents object to store auth information related to Basic Auth.

func (BasicAuthToken) GetRoles

func (p BasicAuthToken) GetRoles() map[string]struct{}

GetRoles returns User roles assigned to current Auth token.

func (BasicAuthToken) HasAdminAccess

func (p BasicAuthToken) HasAdminAccess() bool

HasAdminAccess makes check that user has admin permissions to access to the requested resource.

func (BasicAuthToken) HasUserAccess

func (p BasicAuthToken) HasUserAccess(namespace string) bool

HasUserAccess makes check that user has permission to access to the requested namespace.

type UserPermissions

type UserPermissions struct {
	// contains filtered or unexported fields
}

UserPermissions represents model to store user permissions data.

func NewUserPermissions

func NewUserPermissions(data map[string]map[string]struct{}) *UserPermissions

NewUserPermissions creates new instance of UserPermissions object.

func (UserPermissions) GetData

func (p UserPermissions) GetData() map[string]map[string]struct{}

GetData returns current permissions data.

func (UserPermissions) ValidateAuthToken

func (p UserPermissions) ValidateAuthToken(authToken string) *BasicAuthToken

ValidateAuthToken makes basic validation of auth token.

Jump to

Keyboard shortcuts

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