local

package
v0.0.0-...-a548ab7 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 8 Imported by: 32

Documentation

Index

Constants

View Source
const ContextName = "local"

ContextName the name of the security context.

Variables

This section is empty.

Functions

This section is empty.

Types

type SecurityContext

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

SecurityContext implements security.Context interface based on database

func NewSecurityContext

func NewSecurityContext(user *models.User) *SecurityContext

NewSecurityContext ...

func (*SecurityContext) Can

func (s *SecurityContext) Can(ctx context.Context, action types.Action, resource types.Resource) bool

Can returns whether the user can do action on resource

func (*SecurityContext) GetUsername

func (s *SecurityContext) GetUsername() string

GetUsername returns the username of the authenticated user It returns null if the user has not been authenticated

func (*SecurityContext) IsAuthenticated

func (s *SecurityContext) IsAuthenticated() bool

IsAuthenticated returns true if the user has been authenticated

func (*SecurityContext) IsSolutionUser

func (s *SecurityContext) IsSolutionUser() bool

IsSolutionUser ...

func (*SecurityContext) IsSysAdmin

func (s *SecurityContext) IsSysAdmin() bool

IsSysAdmin returns whether the authenticated user is system admin It returns false if the user has not been authenticated

func (*SecurityContext) Name

func (s *SecurityContext) Name() string

Name returns the name of the security context

func (*SecurityContext) User

func (s *SecurityContext) User() *models.User

User get the current user

Jump to

Keyboard shortcuts

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