bwLehrpool Masterserver
Manages authentication and sharing of virtual machines between participating institutions
LocalUser.java
Go to the documentation of this file.
1 package org.openslx.imagemaster.db.models;
2 
3 import org.openslx.bwlp.thrift.iface.Role;
4 import org.openslx.bwlp.thrift.iface.UserInfo;
6 
12 public class LocalUser
13 {
14  public final String login, organizationId;
15  public final String password;
16  public final String firstName, lastName;
17  public final String eMail;
18  public final Role role;
19 
20  public LocalUser( String login, String password, String organizationId, String firstName, String lastName, String eMail,
21  Role role )
22  {
23  this.login = login;
24  this.organizationId = organizationId;
25  this.password = password;
26  this.firstName = firstName;
27  this.lastName = lastName;
28  this.eMail = eMail;
29  this.role = role;
30  }
31 
32  @Override
33  public String toString()
34  {
35  final StringBuilder sb = new StringBuilder( this.login );
36  sb.append( " (" );
37  sb.append( this.organizationId );
38  sb.append( "): " );
39  sb.append( this.firstName );
40  sb.append( ' ' );
41  sb.append( this.lastName );
42  sb.append( ' ' );
43  sb.append( this.eMail );
44  return sb.toString();
45  }
46 
47  public UserInfo toUserInfo()
48  {
49  UserInfo ui = new UserInfo( login, firstName, lastName, eMail, organizationId );
50  ui.role = role;
51  return ui;
52  }
53 
54  public String getLogin()
55  {
56  return login;
57  }
58 
59  public boolean isAnonymous()
60  {
61  return firstName == null || Util.isEmpty( lastName ) || Util.isEmpty( eMail );
62  }
63 
64 }
Some utilities to make our lives easier.
Definition: Util.java:18
static boolean isEmpty(String str)
Definition: Util.java:123
LocalUser(String login, String password, String organizationId, String firstName, String lastName, String eMail, Role role)
Definition: LocalUser.java:20