Documentation ¶
Index ¶
- Constants
- type SecurityContext
- func (s *SecurityContext) Can(ctx context.Context, action types.Action, resource types.Resource) bool
- func (s *SecurityContext) GetUsername() string
- func (s *SecurityContext) IsAuthenticated() bool
- func (s *SecurityContext) IsSolutionUser() bool
- func (s *SecurityContext) IsSysAdmin() bool
- func (s *SecurityContext) Name() string
- func (s *SecurityContext) User() *models.User
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
Click to show internal directories.
Click to hide internal directories.