SudoSOS Back-end API / service/user-expiry-service / UserExpiryService
Class: UserExpiryService ​
Extends ​
Constructors ​
Constructor ​
new UserExpiryService(manager?): UserExpiryService;Parameters ​
| Parameter | Type |
|---|---|
manager? | EntityManager |
Returns ​
UserExpiryService
Inherited from ​
Properties ​
| Property | Modifier | Type | Inherited from |
|---|---|---|---|
manager | protected | EntityManager | WithManager.manager |
Methods ​
configureLogger() ​
protected configureLogger(logger): void;Parameters ​
| Parameter | Type |
|---|---|
logger | Logger |
Returns ​
void
Inherited from ​
deactivateExpiredUsers() ​
deactivateExpiredUsers(): Promise<User[]>;Sets all local users whose expiryDate is in the past to inactive. Only affects accounts of local user types (LocalUserTypes) that are currently active, not deleted, and have an expiryDate set. Sends an account expired notification to each deactivated user before persisting the deactivation; users whose notification fails are not deactivated so they remain eligible for the next run.
Returns ​
Promise<User[]>
The list of users that were set to inactive.
notifyNearExpirationUsers() ​
notifyNearExpirationUsers(): Promise<User[]>;Sends a near-expiration notification to all active local users whose account will expire within 30 days from now. Only notifies accounts of local user types (LocalUserTypes) that are currently active, not deleted, and have an expiryDate set.
The expiryNotificationSent flag is persisted before dispatching the notification: at-most-once delivery. If mail dispatch fails after the flag is saved, the user is not re-notified on the next run -- this is preferable to spamming users on repeated transient failures.
Returns ​
Promise<User[]>
The list of users for which both the flag was persisted and the notification was dispatched successfully.