on 07-17-2009 1:57 PM
Hi Experts,
Let us say i need to create an user account "PortalUser",i know how to create an user,setting first name,lastname,password for that.
but here before creating the portal user, i need to check whether that user exists or not.If user already exists ,then i need to skip the below for creating the user.
IUserFactory userFact = UMFactory.getUserFactory();
IGroupFactory groupFact = UMFactory.getGroupFactory();
IRoleFactory roleFact = UMFactory.getRoleFactory();
IUser tuser = userFact.getUserByLogonID("PortalUser");
{
IUserMaint newUser = userFact.newUser("PortalUser");
newUser.setFirstName("PortalUser");
newUser.setLastName("Test");
newUser.setEmail("PortalUser.Testatgmaildotcom");
//Locale PortalLanguage = new Locale(Lang.toLowerCase(), "");
Locale PortalLang=new Locale("en");
newUser.setLocale(PortalLang);
newUser.save();
newUser.commit();
IUserAccount userAcc = UMFactory.getUserAccountFactory().newUserAccount("PortalUser", newUser.getUniqueID());
userAcc.setPassword("test1test$");
userAcc.save();
userAcc.commit();
}
Thanks in advance.
Thanks
Sony.
Hi,
Try this code,
IUserFactory factory = UMFactory.getUserFactory();
IUser user = factory.getUserByLogonID(userId);
lastName = user.getLastName();
firstName = user.getFirstName();
refer this pdf,its very helpful
Regards,
Sunaina Reddy T
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
use the .getUser() method of IUserFactory to fet the user and compare it with the user you are trying to create.
You can also use isUserCreationPossible() returns true if an IUser can be created, otherwise false.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.