Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckStorageQuota ¶
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.