View Javadoc
1   package fr.ifremer.quadrige3.core.service.administration.user;
2   
3   /*-
4    * #%L
5    * Quadrige3 Core :: Quadrige3 Client Core
6    * $Id:$
7    * $HeadURL:$
8    * %%
9    * Copyright (C) 2017 Ifremer
10   * %%
11   * This program is free software: you can redistribute it and/or modify
12   * it under the terms of the GNU Affero General Public License as published by
13   * the Free Software Foundation, either version 3 of the License, or
14   * (at your option) any later version.
15   * 
16   * This program is distributed in the hope that it will be useful,
17   * but WITHOUT ANY WARRANTY; without even the implied warranty of
18   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19   * GNU General Public License for more details.
20   * 
21   * You should have received a copy of the GNU Affero General Public License
22   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
23   * #L%
24   */
25  import fr.ifremer.quadrige3.core.vo.administration.user.LightQuserVO;
26  import fr.ifremer.quadrige3.core.vo.administration.user.QuserVO;
27  import org.springframework.transaction.annotation.Transactional;
28  
29  /**
30   * <p>
31   * UserService interface.
32   * </p>
33   */
34  @Transactional(readOnly = true)
35  public interface UserService {
36  
37      /**
38       * Get full data on user (need for synchro server)
39       *
40       * @param userId a int.
41       * @return a {@link fr.ifremer.quadrige3.core.vo.administration.user.QuserVO} object.
42       */
43      QuserVO getUserById(int userId);
44  
45      /**
46       * Get full data on user, and department
47       *
48       * @param userId a int.
49       * @return a {@link fr.ifremer.quadrige3.core.vo.administration.user.QuserVO} object.
50       */
51      QuserVO getUserWithDepartmentAndPrivilegesById(int userId);
52  
53      /**
54       * Get minimal info on user (need for quadrige3 synchro server)
55       *
56       * @param quserId a int.
57       * @return a {@link fr.ifremer.quadrige3.core.vo.administration.user.LightQuserVO} object.
58       */
59      LightQuserVO getLightUserById(int quserId);
60  
61      /**
62       * return if a use is a loca administrator or not
63       *
64       * @param quserId       a int.
65       * @param privilegeCode a {@link java.lang.String} object.
66       * @return a boolean.
67       */
68      boolean hasPrivilege(int quserId, String privilegeCode);
69  
70      /**
71       * Save into the local database
72       *
73       * @param user                    a {@link QuserVO} object.
74       * @param saveOtherLinkedEntities if true, will save linked entities (department and status)
75       */
76      @Transactional
77      void save(QuserVO user, boolean saveOtherLinkedEntities);
78  
79      /**
80       * Is user a local user with an empty password ?
81       *
82       * @param login a {@link java.lang.String} object.
83       * @return a boolean.
84       */
85      boolean isLocalUserWithNoPassword(String login);
86  
87      /**
88       * Is login an extranet login
89       *
90       * @param login the login
91       * @return true if login is extranet
92       */
93      Boolean isLoginExtranet(String login);
94  
95      /**
96       * Is the login associated to a password
97       *
98       * @param login the login
99       * @return true if login has password
100      */
101     boolean hasPassword(String login);
102 
103     /**
104      * Reset the password for the login
105      *
106      * @param login the login
107      */
108     @Transactional
109     void resetPassword(String login);
110 
111     /**
112      * Update password for the login
113      *
114      * @param userId
115      * @param password
116      */
117     @Transactional
118     void updatePasswordByUserId(int userId, String password);
119 
120 }