How to retrieve all users in a specific group

Hi,
I am using SunOne directory server. Can someone please post a sample code that illustrates how to fetch all the list of users in a particular group.
1) Let's say I want to find all the users in a group called "marketing". The root context is dc=mycompany,dc=com This group can be anywhere below this root context. Only information I am told is the name of the group - "marketing". How will I get all the users in this group?
2) For each user that is retrieved from the group marketing, how will I find out the user's DN?
Thanks for the help,
- Satish

Do it like this...
String searchBase = "ou=marketing";
StringBuffer filter = new StringBuffer();
filter.append("(|");
if (organizationName != null && !organizationName.trim().equals("")) {
     filter.append("(");
     filter.append(ou);
     filter.append("=");
     filter.append("marketing");
     filter.append(")");
SearchControls constraints = new SearchControls();
constraints.setSearchScope(SearchControls.SUBTREE_SCOPE);
constraints.setCountLimit(200); // How many users should be found
constraints.setTimeLimit(100000); // how much time should this search wait
// Get a initial context and set it to the ctx object
ctx.search(searchBase, filter.toString(), constraints);

Similar Messages

  • How to retrieve all users in the portal with UME API

    Hi everybody,
    I would like to know how to retrieve all the users from a portal, which uses LDAP as a source (there are users created in the portal as well)
    My code snippet is :
    IUserFactory userFactory = UMFactory.getUserFactory();
    UserSearchFilter searchFilter = userFactory.getUserSearchFilter();
    searchFilter.setDisplayName("*", ISearchAttribute.LIKE_OPERATOR, false);
    ISearchResult searchResult = userFactory.searchUsers(searchFilter);
    My problem is that with the code above, only the users created in the portal are displayed, and no LDAP users.
    Does someone know how to retrieve all the users whatever is the source?
    Regards
    Renaud

    prakash's code should work.
    however, mine code below doesn't user a search filter. it retrieves everyuser including users like indexadmin etc. Note:
    result.next().toString();
    returns a weird uniqueID used in the portal world.
    getUniqueName()
    gives your the usernames (sAMAccountName in Microsoft AD) people use to logon to the portal.
    try {
      IUserFactory uf = UMFactory.getUserFactory();
      ISearchResult result = uf.getUniqueIDs();
      while (result.hasNext()) {
        String uniqueid = result.next().toString();
        IUser user = uf.getUser(uniqueid);
        String userid = user.getUniqueName();
    } catch(Exception e) {
      //systemout

  • Retrieve all attributes for a specific objectClass using ldapsearch

    Hi everybody,
    Question : is it possible to retrieve all attributes for a specific objectClass (by example person) using ldapsearch tool ?
    I tried something like that, but it doesn't work :
    ldapsearch -v -h XXX -p XXX -b "cn=schema" -s base "objectclass=person" attributetypes
    Thanks a lot,
    Franck

    Ok, Thanks for you help,
    But my question is : For a specific objectClass, by example, I would like to have all attributes for the objectClass called "inetOrgPerson"
    something like that :
    ldapsearch -D "cn=Directory Manager" -w pwd -h host ...objectClass="inetOrgPerson"
    and the response could be :
    audio || businessCategory || departmentNumber || displayName || givenName || initials || jpegPhoto || labeledUri || manager || mobile || pager || photo || preferredLanguage || mail || o || roomNumber || secretary || userPKCS12
    I dont't know how to do ????
    Thanks
    Franck

  • How to retrieve the user input in One Step Screenflow

    Hello all,
    I am new in KM. I would like to ask in One Step Screenflow, I have add a inputfield into the ConfirmComponent. How can I retrieve the user input?
    public IRenderingEvent execute(IScreenflowData sfd) throws WcmException
              inp.setLabel(new Label("Delegation:"));
              ConfirmComponent cc = new  ConfirmComponent(ConfirmComponent.OK_CANCEL,this.context.getLocale(),inp);
              String sRid = (String)this.values.get(0);
              RID rid = RID.getRID(sRid, null);
              OneStepScreenflow oscf = new OneStepScreenflow(sfd,this.getAlias(),rid,cc);
              return oscf.execute();
    In the IRenderingEvent , How to retrieve the user input?
    public IRenderingEvent execute(IResource res, Event event ) throws WcmException
              if (event instanceof ConfirmEvent)
                        ConfirmEvent cce = (ConfirmEvent)event;
                        if (ConfirmEvent.CHOICE_YES.equals(cce.getChoice()))
                                  return new InfoEvent(Status.OK, "Done !");
                        else if (ConfirmEvent.CHOICE_NO.equals(cce.getChoice()))
                                  return ConfirmComponent.onNo(event, res.getContext().getLocale());
                        else if (ConfirmEvent.CHOICE_CANCEL.equals(cce.getChoice()))
                                  return ConfirmComponent.onCancel(event, res.getContext().getLocale());
              return new InfoEvent(Status.ABORT, "Aborted.");
    Many Thanks,
    Sunny

    Hello yoga,
    Many Many thanks for your reply again.
    I have just try the class in the thread link.
    There is a error
    "The project was not built since its classpath is incomplete. Cannot find the class file for javax.servlet.http.HttpServletRequest. Fix the classpath then try rebuilding this project."
    The errors occurs because of "extends OneStepComponent"
    public final class NewConfirmInputComponent extends OneStepComponent
    Where can find javax.servlet.http.HttpServletRequest to include it in my classpath?
    Thanks
    Sunny

  • How to get all users under an organizations?

    Hello everyone.
    Just want to know if anyone knows how to get all users under a particular organization.
    From the Search User form, I found they may kind of user such attribute conditions:
    MemberObjectGroup
    is in
    XXXX(organization)
    But unfortunately, the "is in" is not a valid AttributeConditionOperator, so besides using "recursive" self-written function, anyone knows any possible buit-in trick?

    Here is my solution:
    <Rule'>
        <RuleArgument name='organization'/>
        <RuleArgument name='context'/>
        <block>
            <defvar name='orgs'>
                <new class='java.util.ArrayList'/>
            </defvar>
            <invoke name='getChildObjectGroupNames'>
                <invoke name='getObject' class='com.waveset.ui.FormUtil'>
                    <ref>context</ref>
                    <s>ObjectGroup</s>
                    <ref>organization</ref>
                </invoke>
                <ref>orgs</ref>
            </invoke>
            <append name='orgs'>
                <ref>organization</ref>
            </append>
            <invoke name='getUsers' class='com.waveset.ui.FormUtil'>
                <ref>context</ref>
                <map>
                    <s>conditions</s>
                    <list>
                        <new class='com.waveset.object.AttributeCondition'>
                            <s>MemberObjectGroups</s>
                            <s>in</s>
                            <ref>orgs</ref>
                        </new>
                    </list>
                </map>
            </invoke>
        </block>
        <MemberObjectGroups>
            <ObjectRef type='ObjectGroup' id='#ID#Top' name='Top'/>
        </MemberObjectGroups>
    </Rule>

  • How to show all user logged in/loggout in Report

    How to display All User Logged in time & Logout Time?
    Hi..
    I want to display All user in Portlet a report that show us all user that logged in the portal,
    their username,
    their time logged in,
    their time logged out..
    where can i find these information?
    do Portal have already something like this?
    Plz advise..Thanks.

    Thanks Sharmila for answering my question..
    Similar question i want to ask..
    I look at the table, and view it's data...
    Mmm..some i don't recognize...
    Actually, i just want to grep
    1)The UserId of the user who logged in the portal
    2)The time he logged in the portal
    3)the time he log out the portal
    That's all..
    How can i do that?..
    I plan to create one table to store the data, and plan to grab the data by jsp....
    What are the table/function/api that can i use and how?
    Plz advise.
    Thanks

  • How to retrieve all datas that lost when i update my iphone4 to that 6.10 ios. i tried to look at may i tunes in my computer but it seems that i forgot to perform back ups since i purchased this phone 2yirs ago.. pls send me an advice..thank u.

    how to retrieve all datas that lost when i update my iphone4 to that 6.10 ios. i tried to look at may i tunes in my computer but it seems that i forgot to perform back ups since i purchased this phone 2yirs ago.. pls send me an advice..thank u.

    All of the data should be on your computer, simply sync it back.
    If the update was done via iTunes on the computer, the first step in the process is a backup of the device.

  • How to display All User Logged in time & Logout Time?

    How to display All User Logged in time & Logout Time?
    Hi..
    I want to display All user who logged in the portal,
    their username,
    their time logged in,
    their time logged out..
    where can i find these information?
    do Portal have already something like this?
    Plz advise..Thanks.

    The login information is in the wwlog_activity_log. The logout action is only logged when it is explicit. I am using the last user action time for the logout time so I can determine the duration of the visit.

  • How can I access user permission for specific items in Sharepoint 2013 via REST API?

    I want to access user permissions for specific items like lists, documents, folders etc. via the REST API.
    Currently I am hitting the following endpoint:
    http://win-5a8pp4v402g/sharepoint_test/site_1/_api/web/getUserEffectivePermissions('win-5a8pp4v402g\\Sharepoint User 2')
    However the response looks like this:
       "d":
           "GetUserEffectivePermissions":
               "__metadata":
                   "type": "SP.BasePermissions"
               "High": "0",
               "Low": "0"
    I cant understand why high and low are both 0? I have added the user to a specific group. Also this is the same result for each of the users. Another thing to note is that I havent added the "Guest" user in the sharepoint server. So when I hit the endpoint for the Guest user, it still shows the same response. So I know there is something I am doing wrong.I want to access permission of a user for a specific item, say a document using the REST API. Can someone tell me how? What would be the endpoint?

    Thanks for the reply. Although this works for Lists, I need to get permissions of documents too. Here is what I have tried:
    http://win-5a8pp4v402g/sharepoint_test/site_1/_api/web/GetFileByServerRelativeUrl('/sharepoint_test/site_1/Documents/file1.txt')/GetUserEffectivePermissions(@user)?@user='i%3A0%23%2Ew%7Cwin-5a8pp4v402g%5Csharepoint%20user%201'
    And the response is:
       "error":
           "code": "-1, Microsoft.SharePoint.Client.ResourceNotFoundException",
           "message":
               "lang": "en-US",
               "value": "Cannot find resource for the request GetUserEffectivePermissions."
    Clearly this doesnt work for a file. Whats wrong?

  • Can anyone tell me how to retrieve all reserved identifiers and keywords in

    can anyone tell me how to retrieve all reserved identifiers and keywords in oracle ???
    i want to know the syntax of query ??

    yes i do , but now i faced problem of JDBC
    thanx for the help , i am able to retrieve the keywords
    actually i want to retrieve the words in java thought JDBC
    my code is
    try ..//
    Vector  keywords =new Vector();
    String sql4=("select * from   V$RESERVED_WORDS");
    ResultSet rs7=stmt6.executeQuery(sql4);
    //  System.out.println("1");
    while(rs7.next())
    keywords.addElement(rs.getString("KEYWORD"));
    ;catch //This is giving following exception
    java.sql.SQLException: Invalid column name

  • How to retrieve all external refereces in a frame maker file without conditional text of hidden

    How to retrieve all external refereces in a frame maker file without conditional text of hidden

    Hi,<br />Finally I found the solution of the above problem.<br />Use following interface-function combination.<br />///////////code start<br />UIDList lst = Utils<IInCopyWorkFlowUtils>()->GetInCopyStories(doc);<br />for(int32 index = 0;index < lst.Length();index++)<br />{<br /><br />UIDRef incopyStory = Utils<IInCopyWorkFlowUtils>()->GetContainingInCopyStory(lst.GetRef(index));<br />if(incopyStory == UIDRef::gNull)<br />{<br />                                             break;<br />}<br />IDataLink * dLink = Utils<IInCopyBridgeUtils>()->QueryDataLink(incopyStory);<br />if(dLink == nil)<br />{<br />     break;<br />}<br />}<br />//////code end

  • How to see all users who are allowed permissions for the specified entity ?

    How to see all users who are allowed permissions for the specified entity ? 
    And change user permissions for the current entity
    from Moscow with money

    Vincent,
    ... and how to change entity permissions for some users?
    from Moscow with money

  • How to reset All users and delete their table?

    Hi,
    i want to know How to reset All users and delete their tables with username- system and password-manager.
    thanks

    Hi
    Here delete means truncate or drop?????
    If drop use the following statement to generate the script:
    select 'drop table ' || Owner || '.' || Table_Name || ';' from Dba_tables
    where owner in (<All_the_users_you_want_to_reset>);
    But before firing the above statement extract the DDL's to create all the users and put it in a file and just run that file to re-create the users.
    if its truncate then:
    select 'truncate table ' || Owner || '.' || Table_Name || ';' from Dba_tables
    where owner in (<All_the_users_you_want_to_reset>);
    Hope this Helps
    Regards

  • Retrieve all user id's from LDAP directory and populate in Oracle table.

    Guys,
    We've implemented LDAP authentication functionality in our application using Oracle's dbms_ldap package objects.
    Now,Is there any way that I can retrieve all user ids from the LDAP directory and store in an Oracle table?
    The distinguished name of authorized user as it appears in our LDAP directory is below:
    dn=uid=ab0472,ou=people,ou=xyz,o=world.
    Now I need to fetch all users uid's from the LDAP directory and populate in an Oracle table.Can somone help me with thoughts.
    Thanks,
    Bhagat

    Have a look at attachments API, since this also does the same thing except that it puts the file in fnd_lobs instead of the custom table.
    Thanks
    Tapash

  • How to retrieve all my photos...I have gray icons and question marks

    How to retrieve all my photos. I have gray icond and question marks

    Duplicate post.
    http://forums.adobe.com/thread/1419531
    Your original post has a response which requests more info from you.

Maybe you are looking for