Documentation ¶
Index ¶
- func CheckPermissionGivenByCollaborationMode(uid, projectKey, resource, action string) (bool, error)
- func GetCollaborationModePermission(uid, projectKey, resource, resourceName, action string) (bool, error)
- func GetResourcesInHeader(c *gin.Context) ([]string, bool)
- func InsertDetailedOperationLog(c *gin.Context, ...)
- func InsertOperationLog(c *gin.Context, ...)
- func JSONResponse(c *gin.Context, ctx *Context)
- func ListAuthorizedProjects(uid string) ([]string, bool, error)
- func ListAuthorizedProjectsByResourceAndVerb(uid, resource, verb string) ([]string, bool, error)
- func ListAuthorizedWorkflows(uid, projectKey string) (authorizedWorkflow, authorizedWorkflowV4 []string, enableFilter bool, ...)
- func ListCollaborationEnvironmentsPermission(uid, projectKey string) (authorizedEnv *types.CollaborationEnvPermission, err error)
- func Stream(c *gin.Context, p producer, log *zap.SugaredLogger)
- type Context
- type FederatedClaims
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckPermissionGivenByCollaborationMode ¶ added in v1.9.9
func CheckPermissionGivenByCollaborationMode(uid, projectKey, resource, action string) (bool, error)
CheckPermissionGivenByCollaborationMode checks if a user is permitted to perform specific action in a given project. Although collaboration mode is used to control the action to specific resources, under some circumstances, there are leaks/designs that allows user with resource permission not related to the corresponding resource to access. e.g. ListTest API will allow anyone with edit workflow permission to call it. In this case, we need to check if the permission is granted by collaboration mode. AVOID USING THIS !!! FIXME: This function shouldn't exist. The only reason it exists is the incompetent of the system designer.
func GetCollaborationModePermission ¶ added in v1.9.9
func GetResourcesInHeader ¶ added in v1.7.1
func InsertDetailedOperationLog ¶ added in v1.9.9
func InsertOperationLog ¶
func InsertOperationLog(c *gin.Context, username, productName, method, function, detail, requestBody string, logger *zap.SugaredLogger)
InsertOperationLog 插入操作日志
func JSONResponse ¶
func ListAuthorizedProjects ¶ added in v1.9.9
func ListAuthorizedProjectsByResourceAndVerb ¶ added in v1.9.9
func ListAuthorizedWorkflows ¶ added in v1.9.9
func ListCollaborationEnvironmentsPermission ¶ added in v1.9.9
func ListCollaborationEnvironmentsPermission(uid, projectKey string) (authorizedEnv *types.CollaborationEnvPermission, err error)
Types ¶
type Context ¶
type Context struct { Logger *zap.SugaredLogger UnAuthorized bool Err error Resp interface{} Account string UserName string UserID string IdentityType string RequestID string Resources *user.AuthorizedResources }
Context struct
func NewContext ¶
NewContext returns a context without user authorization info. TODO: We need to implement a `context.Context` that conforms to the golang standard library. After Jul.10 2023, this function should only be used when no authorization info is required. If authorization info is required, use `NewContextWithAuthorization` instead.