Version: v1.8.6 Latest Latest

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

Go to latest
Published: Nov 15, 2019 License: Apache-2.0 Imports: 7 Imported by: 1




This section is empty.


This section is empty.


This section is empty.


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, pm promgr.ProjectManager) *SecurityContext

NewSecurityContext ...

func (*SecurityContext) Can added in v1.8.0

func (s *SecurityContext) Can(action rbac.Action, resource rbac.Resource) bool

Can returns whether the user can do action on resource

func (*SecurityContext) GetMyProjects

func (s *SecurityContext) GetMyProjects() ([]*models.Project, error)

GetMyProjects ...

func (*SecurityContext) GetProjectRoles

func (s *SecurityContext) GetProjectRoles(projectIDOrName interface{}) []int

GetProjectRoles ...

func (*SecurityContext) GetRolesByGroup added in v1.6.0

func (s *SecurityContext) GetRolesByGroup(projectIDOrName interface{}) []int

GetRolesByGroup - Get the group role of current user to the project

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

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL