handler

package
v1.18.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

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 GetCollaborationModePermission(uid, projectKey, resource, resourceName, action string) (bool, error)

func GetResourcesInHeader added in v1.7.1

func GetResourcesInHeader(c *gin.Context) ([]string, bool)

func InsertDetailedOperationLog added in v1.9.9

func InsertDetailedOperationLog(c *gin.Context, username, productName, scene, method, function, detail, requestBody string, logger *zap.SugaredLogger, targets ...string)

func InsertOperationLog

func InsertOperationLog(c *gin.Context, username, productName, method, function, detail, requestBody string, logger *zap.SugaredLogger)

InsertOperationLog 插入操作日志

func JSONResponse

func JSONResponse(c *gin.Context, ctx *Context)

func ListAuthorizedProjects added in v1.9.9

func ListAuthorizedProjects(uid string) ([]string, bool, error)

func ListAuthorizedProjectsByResourceAndVerb added in v1.9.9

func ListAuthorizedProjectsByResourceAndVerb(uid, resource, verb string) ([]string, bool, error)

func ListAuthorizedWorkflows added in v1.9.9

func ListAuthorizedWorkflows(uid, projectKey string) (authorizedWorkflow, authorizedWorkflowV4 []string, enableFilter bool, err error)

func ListCollaborationEnvironmentsPermission added in v1.9.9

func ListCollaborationEnvironmentsPermission(uid, projectKey string) (authorizedEnv *types.CollaborationEnvPermission, err error)

func Stream

func Stream(c *gin.Context, p producer, log *zap.SugaredLogger)

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

func NewContext(c *gin.Context) *Context

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.

func NewContextWithAuthorization added in v1.9.9

func NewContextWithAuthorization(c *gin.Context) (*Context, error)

NewContextWithAuthorization returns a context with user authorization info. This function should only be called when one need authorization information for api caller.

type FederatedClaims added in v1.9.9

type FederatedClaims struct {
	ConnectorId string `json:"connector_id"`
	UserId      string `json:"user_id"`
}

Directories

Path Synopsis
repository

Jump to

Keyboard shortcuts

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