summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/openslx/imagemaster/localrpc/JsonUser.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/openslx/imagemaster/localrpc/JsonUser.java')
-rw-r--r--src/main/java/org/openslx/imagemaster/localrpc/JsonUser.java23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/main/java/org/openslx/imagemaster/localrpc/JsonUser.java b/src/main/java/org/openslx/imagemaster/localrpc/JsonUser.java
index 8f13084..2504a3d 100644
--- a/src/main/java/org/openslx/imagemaster/localrpc/JsonUser.java
+++ b/src/main/java/org/openslx/imagemaster/localrpc/JsonUser.java
@@ -1,23 +1,32 @@
package org.openslx.imagemaster.localrpc;
-import org.openslx.imagemaster.session.User;
+import org.openslx.bwlp.thrift.iface.Role;
+import org.openslx.bwlp.thrift.iface.UserInfo;
+import org.openslx.imagemaster.util.Util;
public class JsonUser
{
- private String login = null;
- private String organizationid = null;
+ private String userId = null;
+ private String organizationId = null;
private String firstName = null;
private String lastName = null;
private String mail = null;
private String role = null;
- private int userId = -1;
- public User toUser()
+ public UserInfo toUser()
{
- if ( userId <= 0 || firstName == null || lastName == null || firstName.isEmpty() || lastName.isEmpty() )
+ Role role;
+ try {
+ role = Role.valueOf( this.role );
+ } catch ( Exception e ) {
return null;
- return new ShibUser( userId, login, organizationid, firstName, lastName, mail, role );
+ }
+ if ( Util.isEmpty( userId ) || Util.isEmpty( organizationId ) || Util.isEmpty( lastName ) || Util.isEmpty( mail ) )
+ return null;
+ UserInfo ui = new UserInfo( userId, firstName, lastName, mail, organizationId );
+ ui.role = role;
+ return ui;
}
}