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

Method accessCheck

backend/api/v1/sql_service.go:1503–1515  ·  view source on GitHub ↗

The Build*Func parser-context helpers moved to `backend/component/parsercontext` so the runner layer can use them without an import cycle. See parsercontext.BuildGetDatabaseMetadataFunc, BuildListDatabaseNamesFunc, BuildGetLinkedDatabaseMetadataFunc. accessCheck check the access for the database. Do

(
	ctx context.Context,
	instance *store.InstanceMessage,
	database *store.DatabaseMessage,
	user *store.UserMessage,
	spans []*parserbase.QuerySpan,
	isExplain bool,
	statements []parserbase.Statement,
	requestSchema string,
	multiStatement bool,
)

Source from the content-addressed store, hash-verified

1501
1502// accessCheck check the access for the database. Do not support cross-project resources.
1503func (s *SQLService) accessCheck(
1504 ctx context.Context,
1505 instance *store.InstanceMessage,
1506 database *store.DatabaseMessage,
1507 user *store.UserMessage,
1508 spans []*parserbase.QuerySpan,
1509 isExplain bool,
1510 statements []parserbase.Statement,
1511 requestSchema string,
1512 multiStatement bool,
1513) error {
1514 return s.accessCheckWithGrantedTargets(ctx, instance, database, user, spans, isExplain, statements, nil, requestSchema, multiStatement)
1515}
1516
1517// accessCheckWithGrant returns an accessCheckFunc that exempts the access
1518// grant's target databases from IAM checks while keeping span-level checks for

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected