authorization

package
v1.21.5 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultPermissionManager

type DefaultPermissionManager struct {
	Cache  *cache.ModelCache
	Userif aaa.ContextUserOperator
}

func (*DefaultPermissionManager) CheckByClusterNamespace

func (defaultPermissionChecker *DefaultPermissionManager) CheckByClusterNamespace(c *gin.Context)

func (*DefaultPermissionManager) CheckByEnvironmentID

func (defaultPermissionChecker *DefaultPermissionManager) CheckByEnvironmentID(c *gin.Context)

func (*DefaultPermissionManager) CheckByProjectID

func (defaultPermissionChecker *DefaultPermissionManager) CheckByProjectID(c *gin.Context)

func (*DefaultPermissionManager) CheckByTenantID

func (defaultPermissionChecker *DefaultPermissionManager) CheckByTenantID(c *gin.Context)

func (*DefaultPermissionManager) CheckByVirtualSpaceID

func (defaultPermissionChecker *DefaultPermissionManager) CheckByVirtualSpaceID(c *gin.Context)

func (*DefaultPermissionManager) CheckCanDeployEnvironment

func (defaultPermChecker *DefaultPermissionManager) CheckCanDeployEnvironment(c *gin.Context)

CheckCanDeployEnvironment 判断是否拥有环境的部署权限 1. 如果是系统管理员,pass 3. 如果是租户管理员,pass 3. 如果是项目管理员,pass 4. 如果是项目运维,pass 5. 如果是环境operator,pass 6. 其他都reject

func (*DefaultPermissionManager) CheckIsATenantAdmin

func (defaultPermissionChecker *DefaultPermissionManager) CheckIsATenantAdmin(c *gin.Context)

func (*DefaultPermissionManager) CheckIsSysADMIN

func (defaultPermissionChecker *DefaultPermissionManager) CheckIsSysADMIN(c *gin.Context)

func (*DefaultPermissionManager) CheckIsVirtualSpaceAdmin

func (defaultPermissionChecker *DefaultPermissionManager) CheckIsVirtualSpaceAdmin(c *gin.Context)

func (*DefaultPermissionManager) HasEnvPerm

func (defaultPermChecker *DefaultPermissionManager) HasEnvPerm(c *gin.Context, cluster, namespace string) (hasPerm bool, objname string, currentrole string)

func (*DefaultPermissionManager) HasObjectPerm

func (defaultPermChecker *DefaultPermissionManager) HasObjectPerm(c *gin.Context, kind string, pk uint) (hasPerm bool, objname string, currentrole string)

type PermissionManager

type PermissionManager interface {
	// CheckByClusterNamespace 根据cluster和namespace,判断是否有关联环境的权限
	CheckByClusterNamespace(c *gin.Context)
	// CheckByEnvironmentID 判断是否有环境的操作权限
	CheckByEnvironmentID(c *gin.Context)
	// CheckByProjectID  判断是否有项目的操作权限
	CheckByProjectID(c *gin.Context)
	// CheckByTenantID  判断是否有租户操作权限
	CheckByTenantID(c *gin.Context)
	// CheckByVirtualSpaceID  判断是否有虚拟空间操作权限
	CheckByVirtualSpaceID(c *gin.Context)
	// CheckIsSysADMIN  判断是否是系统管理员
	CheckIsSysADMIN(c *gin.Context)
	// CheckIsATenantAdmin  判断是否是一个租户管理员
	CheckIsATenantAdmin(c *gin.Context)
	// CheckCanDeployEnvironment  判断是否有对应环境的部署权限
	CheckCanDeployEnvironment(c *gin.Context)
}

PermissionManager 权限判断工具,仅支持租户,项目,环境三级数据

Jump to

Keyboard shortcuts

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