blob: bc9289a5689e3b8b22a95fbb6ef455f99e69ab8e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
package org.openslx.imagemaster.db.models;
import org.openslx.bwlp.thrift.iface.Role;
import org.openslx.bwlp.thrift.iface.UserInfo;
import org.openslx.imagemaster.util.Util;
/**
* Represents a user. Should be extended and given an according static method to
* instantiate by loading data from some backend.
*
*/
public class LocalUser
{
public final String login, organizationId;
public final String password;
public final String firstName, lastName;
public final String eMail;
public final Role role;
public LocalUser( String login, String password, String organizationId, String firstName, String lastName, String eMail,
Role tutor )
{
this.login = login;
this.organizationId = organizationId;
this.password = password;
this.firstName = firstName;
this.lastName = lastName;
this.eMail = eMail;
this.role = tutor;
}
@Override
public String toString()
{
final StringBuilder sb = new StringBuilder( this.login );
sb.append( " (" );
sb.append( this.organizationId );
sb.append( "): " );
sb.append( this.firstName );
sb.append( ' ' );
sb.append( this.lastName );
sb.append( ' ' );
sb.append( this.eMail );
return sb.toString();
}
public UserInfo toUserInfo()
{
UserInfo ui = new UserInfo( login, firstName, lastName, eMail, organizationId );
ui.role = role;
return ui;
}
public String getLogin()
{
return login;
}
public boolean isAnonymous()
{
return firstName == null || Util.isEmpty( lastName ) || Util.isEmpty( eMail );
}
}
|