25
25
import java .util .UUID ;
26
26
27
27
public class UserController extends BaseController <UserDto > {
28
- private UserDao userDao ;
29
- private PasswordDao passwordDao ;
30
- private UserSessionDao userSessionDao ;
28
+ private final UserDao userDao ;
29
+ private final PasswordDao passwordDao ;
30
+ private final UserSessionDao userSessionDao ;
31
31
32
32
public UserController (UserDto user ) {
33
33
super (user );
@@ -42,7 +42,7 @@ public UserDto create(UserDto template) throws AqualityException {
42
42
if (template .getPassword () != null ) {
43
43
template .setPassword (saltPassword (template , template .getPassword ()));
44
44
}
45
- return userDao .create (template );
45
+ return toPublicUser ( userDao .create (template ) );
46
46
} else {
47
47
throw new AqualityPermissionsException ("Account is not allowed to create User" , baseUser );
48
48
}
@@ -104,14 +104,18 @@ UserDto auth(String authString, boolean ldap) throws AqualityException {
104
104
}
105
105
106
106
private List <UserDto > toPublicUsers (List <UserDto > users ) {
107
- for (UserDto user :
108
- users ) {
109
- user .setPassword ("" );
110
- user .setSession_code ("" );
107
+ for (UserDto user : users ) {
108
+ toPublicUser (user );
111
109
}
112
110
return users ;
113
111
}
114
112
113
+ private UserDto toPublicUser (UserDto user ) {
114
+ user .setPassword ("" );
115
+ user .setSession_code ("" );
116
+ return user ;
117
+ }
118
+
115
119
private String generateSessionCode (UserDto user ) {
116
120
Base64 base64 = new Base64 ();
117
121
DateUtils dates = new DateUtils ();
0 commit comments