1 /*
2 * Copyright (c) 2002-2021, City of Paris
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright notice
10 * and the following disclaimer.
11 *
12 * 2. Redistributions in binary form must reproduce the above copyright notice
13 * and the following disclaimer in the documentation and/or other materials
14 * provided with the distribution.
15 *
16 * 3. Neither the name of 'Mairie de Paris' nor 'Lutece' nor the names of its
17 * contributors may be used to endorse or promote products derived from
18 * this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
24 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
31 *
32 * License 1.0
33 */
34 package fr.paris.lutece.plugins.mylutece.service;
35
36 import fr.paris.lutece.portal.service.plugin.Plugin;
37
38 import java.sql.Timestamp;
39
40 import java.util.List;
41 import java.util.Map;
42
43 /**
44 * Account life time service interface
45 *
46 */
47 public interface IAccountLifeTimeService
48 {
49 /**
50 * Get the list of id of users that have an expired time life but not the expired status
51 *
52 * @param currentTimestamp
53 * Timestamp describing the current time.
54 * @return the list of id of users with expired time life
55 */
56 List<Integer> getIdUsersWithExpiredLifeTimeList( Timestamp currentTimestamp );
57
58 /**
59 * Get the list of id of users that need to receive their first alert
60 *
61 * @param alertMaxDate
62 * The maximum date to send alerts.
63 * @return the list of id of users that need to receive their first alert
64 */
65 List<Integer> getIdUsersToSendFirstAlert( Timestamp alertMaxDate );
66
67 /**
68 * Get the list of id of users that need to receive their first alert
69 *
70 * @param alertMaxDate
71 * The maximum date to send alerts.
72 * @param timeBetweenAlerts
73 * Timestamp describing the time between two alerts.
74 * @param maxNumberAlerts
75 * Maximum number of alerts to send to a user
76 * @return the list of id of users that need to receive their first alert
77 */
78 List<Integer> getIdUsersToSendOtherAlert( Timestamp alertMaxDate, Timestamp timeBetweenAlerts, int maxNumberAlerts );
79
80 /**
81 * Get the list of id of users that have an expired password but not the change password flag
82 *
83 * @param currentTimestamp
84 * Timestamp describing the current time.
85 * @return the list of id of users with expired passwords
86 */
87 List<Integer> getIdUsersWithExpiredPasswordsList( Timestamp currentTimestamp );
88
89 /**
90 * Increment the number of alert send to users by 1
91 *
92 * @param listIdUser
93 * The list of users to update
94 */
95 void updateNbAlert( List<Integer> listIdUser );
96
97 /**
98 * Set the "change password" flag of users to true
99 *
100 * @param listIdUser
101 * List of user's id to update
102 */
103 void updateChangePassword( List<Integer> listIdUser );
104
105 /**
106 * Set a user account status as expired. Expired user will be anonymized by an anonymization daemon
107 *
108 * @param listIdUser
109 * User accounts list to set as expired
110 */
111 void setUserStatusExpired( List<Integer> listIdUser );
112
113 /**
114 * Get the body of the mail to send when a user account expire
115 *
116 * @return The body of the mail to send
117 */
118 String getExpirationtMailBody( );
119
120 /**
121 * Get the body of the mail to send for a first notification of a user before his account expire
122 *
123 * @return The body of the mail to send
124 */
125 String getFirstAlertMailBody( );
126
127 /**
128 * Get the body of the mail to send for a new notification of a user before his account expire
129 *
130 * @return The body of the mail to send
131 */
132 String getOtherAlertMailBody( );
133
134 /**
135 * Get the body of the mail to send when a password expired
136 *
137 * @return The body of the mail to send
138 */
139 String getPasswordExpiredMailBody( );
140
141 /**
142 * Add specifiques parameters to a given model
143 *
144 * @param model
145 * The model
146 * @param nIdUser
147 * The id of the user to add the parameters
148 */
149 void addParametersToModel( Map<String, String> model, Integer nIdUser );
150
151 /**
152 * Get the main email adresse of a user
153 *
154 * @param nUserId
155 * Id of the user
156 * @return The main email adresse of a user
157 */
158 String getUserMainEmail( int nUserId );
159
160 /**
161 * Get the current plugin
162 *
163 * @return The plugin
164 */
165 Plugin getPlugin( );
166 }