subscription

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckStorageQuota

func CheckStorageQuota(ctx *gin.Context, userID id.ID, authClient userclient.Interface) bool

CheckStorageQuota returns true if the user is over quota and the request was rejected with HTTP 507. userID is the neutral id (ObjectID or uuid); its canonical string is what the auth service parses. A zero id is a caller error (no authenticated user was resolved): the request is rejected with HTTP 401 and true is returned, never failing open. The zero-id check comes first, so it holds even when no auth client is configured.

When the user is over quota, it writes HTTP 507 with the body {"error":"storage_quota_exceeded"} and returns true.

It deliberately FAILS OPEN (returns false, the write is allowed) when the auth client is nil or the auth RPC errors. The server is the only gate on limits, and an auth outage must not block users' writes. Limits only apply when auth has payments enabled; otherwise IsStorageFull never reports a full account.

func IsUserSubscribed

func IsUserSubscribed(ctx context.Context, userID primitive.ObjectID, authClient userv1connect.UserServiceClient) (bool, error)

IsUserSubscribed checks if a user has an active subscription via gRPC call to auth service

Types

This section is empty.

Jump to

Keyboard shortcuts

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