public void createUser(){
String userLogin = "A12345";
String fName = "Anand";
String lName = "Badal";
long actKey = 1;
String password = "Test123";
String empType = "EMP";
try{
//get user manager service
UserManager userManager = Platform.getService(UserManager.class);
//create user attributes map
HashMap<String, Object> usrAttributes = new HashMap<String, Object>();
usrAttributes.put("User Login", userLogin);
usrAttributes.put("First Name", fName);
usrAttributes.put("Last Name", lName);
usrAttributes.put("act_key", actKey);
usrAttributes.put("usr_password", password);
usrAttributes.put("Role", empType);
User user = new User(userLogin, usrAttributes);
userManager.create(user);
System.out.println("User created successfully...");
}catch(Exception e) {
System.out.println("Error occured while creating user - " + e);
}
}
Happy Learning!!!
String userLogin = "A12345";
String fName = "Anand";
String lName = "Badal";
long actKey = 1;
String password = "Test123";
String empType = "EMP";
try{
//get user manager service
UserManager userManager = Platform.getService(UserManager.class);
//create user attributes map
HashMap<String, Object> usrAttributes = new HashMap<String, Object>();
usrAttributes.put("User Login", userLogin);
usrAttributes.put("First Name", fName);
usrAttributes.put("Last Name", lName);
usrAttributes.put("act_key", actKey);
usrAttributes.put("usr_password", password);
usrAttributes.put("Role", empType);
User user = new User(userLogin, usrAttributes);
userManager.create(user);
System.out.println("User created successfully...");
}catch(Exception e) {
System.out.println("Error occured while creating user - " + e);
}
}
Happy Learning!!!
No comments:
Post a Comment