Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Determine all groups for a defined user

I am currently creating a java method(part of and XPages managed bean) to retrieve a list groups a user(not necessarly current user) is a member of.

Is there any easy method to retieve this information or am i going to have to loop through all the groups to check for the user and also check if those groups are sub groups of other groups?

like image 608
JMCooper Avatar asked Apr 04 '12 12:04

JMCooper


2 Answers

Answered this in a blog post here: http://ntf.gbs.com/nathan/escape.nsf/d6plinks/NTFN-8TMHRP

Simple version is that what you're looking for is...

lotus.notes.addins.DominoServer server = new lotus.notes.addins.DominoServer("YourCanonicalServerName");
Collection nameList = server.getNamesList("TheUserNameYou'reLookingFor");

That should be all you need.

like image 175
Nathan T. Freeman Avatar answered Oct 21 '22 15:10

Nathan T. Freeman


use this snippets:

XSPContext context = XSPContext.getXSPContext(FacesContext.getCurrentInstance());
DirectoryUser currentUser = context.getUser();
Vector<String> groups = new Vector(currentUser.getGroups());
like image 20
user2446292 Avatar answered Oct 21 '22 16:10

user2446292