Skip to Content
0
Former Member
Jul 17, 2009 at 12:57 PM

How to check whether portal user exists or not using UM API.

191 Views

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.