Skip to content

enterprise: Enforce user and external service limits

Administrator requested to merge core/enforce-user-limits into main

Created by: ryanslade

We now properly enforces the 10-user limit (including when users sign in via SSO rather than being explicitly created by the site admin) and X-external-services limit for non-enterprise instances.

We were setting hook functions to check enforced limits in an Init function which set the hooks on our global database struct and in the move away from using globals some instances were being used without the trigger functions.

This is a minimal changes that defines the trigger functions globally instead.

Old init function: https://github.com/sourcegraph/sourcegraph/blob/9e35730ee86edfa25c50623db13fe83ea57ceb15/enterprise/cmd/frontend/internal/licensing/init/init.go#L28-L38

An example where we create a store without the hooks: https://github.com/sourcegraph/sourcegraph/blob/243e44d5079e4d9970955f5828a0ac0bf265f5b4/internal/database/external_accounts.go#L266

Merge request reports

Loading