web / lib/services/system-user-service
lib/services/system-user-service
Service for managing the system user account.
The system user is a reserved account used to own orphaned public data when users delete their accounts. Public catalogs and datasets are transferred to this system user rather than being deleted, ensuring that publicly shared data remains accessible.
Classes
SystemUserService
Service for managing the system user account.
Constructors
Constructor
new SystemUserService(
payload):SystemUserService
Parameters
payload
BasePayload
Returns
Methods
getOrCreateSystemUser()
getOrCreateSystemUser():
Promise<User>
Get or create the system user account.
This method is idempotent - if the system user already exists, it returns the existing user. If not, it creates one.
Returns
Promise<User>
The system user record
isSystemUser()
isSystemUser(
userId):Promise<boolean>
Check if a user ID belongs to the system user.
Parameters
userId
The user ID to check
string | number
Returns
Promise<boolean>
True if the ID belongs to the system user
Variables
SYSTEM_USER_EMAIL
constSYSTEM_USER_EMAIL:"system@timetiles.internal"="system@timetiles.internal"
Reserved system user email address. This email is used to identify the system user account.
Functions
createSystemUserService()
createSystemUserService(
payload):SystemUserService
Create a system user service instance.
Returns a fresh instance each call. The service is stateless apart from a trivial in-class cache that works within a single usage flow.
Parameters
payload
BasePayload