Forums de discussion

Accessing users and groups

michael gantenbein, modifié il y a 13 années.

Accessing users and groups

New Member Publications: 9 Date d'inscription: 07/04/11 Publications récentes
Hi,

Im using Liferay 6.

In one of my portlets, I want to show a drop down list of all users and groups registered in Liferay.

How can I access this information (get the list of users and the list of groups) programmatically?

Thanks in advance.

Regards
Michael
thumbnail
Jitendra Rajput, modifié il y a 13 années.

RE: Accessing users and groups

Liferay Master Publications: 875 Date d'inscription: 07/01/11 Publications récentes
By using UserLocalserviceUtil you can retrive all the user's (Including default)

UserLocalServiceUtil.getUsers(int startIndex, int endIndex);
pass -1 as start and end Index . it will return all users

List<user> user = UserLocalServiceUtil.getUsers(-1,-1);

You can check for the default user by using 
userObject.isDefaultUser()
</user>


Same way you can do it for organization
OrganizationLocalServiceUtil.getOrganizations(start, end);

I hope it help you

Cheers
Jitendra
michael gantenbein, modifié il y a 12 années.

RE: Accessing users and groups

New Member Publications: 9 Date d'inscription: 07/04/11 Publications récentes
Hi,

By doing this, Liferay CE 5.0.5GA and 5.0.6GA both have a '5' entry in the result list.

Does anybody have an idea, what this record is? I don't have a user '5' in my User Management View.

Regards
thumbnail
Tejas Kanani, modifié il y a 12 années.

RE: Accessing users and groups

Liferay Master Publications: 654 Date d'inscription: 06/01/09 Publications récentes
Hi Michael,

Liferay OOTB has one user created by default. Which is default@liferay.com.
Not sure whether its the same which you are getting.