MCPcopy Create free account
hub / github.com/bytebase/bytebase / SetAuditWorkspaceID

Function SetAuditWorkspaceID

backend/common/context.go:43–52  ·  view source on GitHub ↗

SetAuditWorkspaceID records the workspace that the current request should be audited against, if the audit interceptor registered a setter on the context. Safe to call even when auditing is disabled for the current method.

(ctx context.Context, workspaceID string)

Source from the content-addressed store, hash-verified

41// audited against, if the audit interceptor registered a setter on the context.
42// Safe to call even when auditing is disabled for the current method.
43func SetAuditWorkspaceID(ctx context.Context, workspaceID string) {
44 if workspaceID == "" {
45 return
46 }
47 setter, ok := ctx.Value(AuditWorkspaceIDKey).(func(string))
48 if !ok {
49 return
50 }
51 setter(workspaceID)
52}
53
54// GetWorkspaceIDFromContext returns the workspace ID from the request context.
55func GetWorkspaceIDFromContext(ctx context.Context) string {

Callers 3

LoginMethod · 0.92
SignupMethod · 0.92
ExchangeTokenMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected