Java API to find group members?

I need to find a way to list all the members of a group.
There're only two similar methods in the oracle OID java API. Group.isMember() and Util.getGroupMemberShip().
Is there something like Group.getGroupMembers(), or Util.getGroupMembers()?
If not, do I have to query the OID myself? Thanks!

Hi,
You can do it using JNDI - e.g: I have posted a code snippet here that shows my isGroupMember method. The method checks if a user belongs to a Group
* The method isMemberInGroup checks if a user is a member of a group. The
* method relies on the Context provided by the calling method.
* @throws java.lang.Exception
* @throws javax.naming.NamingException
* @return bIsMemberInGroup true, if the user is a member of the group.
* @param objDirContext the DirContext provided by the calling method.
* @param strGroupDN the DN of the Group.
* @param strMemberDN the DN of the Member.
public boolean isMemberInGroup(String strMemberDN,
String strGroupDN,
DirContext objDirContext)
throws NamingException, Exception
SearchControls objSearchControls = new SearchControls();
String[] strAttributes = new String[]{};
String strFilter = null;
boolean bIsMemberInGroup          = false;
NamingEnumeration objNamingEnumeration;
try
objSearchControls.setReturningAttributes(strAttributes);
objSearchControls.setSearchScope(SearchControls.OBJECT_SCOPE);
strFilter = "(&(uniquemember="+strMemberDN+")(objectclass=groupOfUniqueNames))";
objNamingEnumeration = objDirContext.search(strGroupDN, strFilter, objSearchControls);
bIsMemberInGroup = objNamingEnumeration.hasMore();
catch(NamingException objNamingException)
ExceptionHandler.handle(objNamingException);
catch(Exception objException)
ExceptionHandler.handle(objException);
return bIsMemberInGroup;
}// end of isMemberInGroup method
You can find many such examples on popular Java Websites....
Regards,
Sandeep

Similar Messages

  • Use java api to find all available workspaces

    Hi,
    I am trying to use the java API for the oracle repository to find all available workspaces to a user with a given username and password. At the moment i can get at a workspace once i know the workspace name in advance but i need my program to give the user a list of the available workspaces instead of the user having to know the workspace name...
    any ideas??
    cheers
    paul

    Paul,
    For queries I use simple sql select rather than the API.
    The view 'sdd_workareas' will show you all the workareas the connected user has access to.
    'i$sdd_workareas' will show all workareas.
    SQL> desc sdd_workareas
    Name Null? Type
    IRID NOT NULL NUMBER
    OWNER NOT NULL VARCHAR2(256)
    NAME NOT NULL VARCHAR2(256)
    KIND NOT NULL VARCHAR2(30)
    NOTM NOT NULL NUMBER
    DATE_CREATED NOT NULL DATE
    CREATED_BY NOT NULL VARCHAR2(32)
    NOTC NOT NULL NUMBER
    DATE_CHANGED DATE
    CHANGED_BY VARCHAR2(32)
    IS_COMPILED CHAR(1)
    DEFAULT_CHECKIN_BRANCH NUMBER
    DESCRIPTION VARCHAR2(2000)
    the context is then set using jr_context.set_workarea('WORKAREA-NAME');
    regards,
    David

  • Get All group from LCES using Livecycle java API

    Hello ,
    Can anyone told me how i can retrieve all the groups that exist in my livecyle using JAVA API.
    Some method who return all groups ??
    Thanks!

    First Thank you for your answer
    I tried this part
    //Set connection properties required to invoke LiveCycle ES
                Properties connectionProps = new Properties();
                connectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_EJB_ENDPOINT, "jnp://test:1099");
                                                                      connectionProps.setProperty(ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL,Service ClientFactoryProperties.DSC_EJB_PROTOCOL);
                connectionProps.setProperty(ServiceClientFactoryProperties.DSC_SERVER_TYPE, "JBoss");
                connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME, "administrator");
                connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD, "password");
                ServiceClientFactory scf = ServiceClientFactory.createInstance(connectionProps);
                DirectoryManager directoryManager = new DirectoryManagerServiceClient(scf);
                PrincipalSearchFilter psf = new PrincipalSearchFilter();
        psf.setPrincipalType(Principal.PRINCIPALTYPE_GROUP);  //Recommended - refines the search to a User or Group
        psf.setRetrieveOnlyActive(); // Recommended - returns only ative users/groups and not obsolete/deleted users/groups
        List<Principal> resultList = directoryManager.findPrincipals(psf);
        System.out.println("Done");
    and when I check the result of my list I find incomprehensible informations.
    So when I debug the code ,  my list  contains little information.
    NB : my LDAP contains hundreds of groups.
    Any suggestion
    Any code Source.

  • How to create the groups in OID Using Java API.

    Hi,
    I need to create the group in OID Using Java API's only(i.e., javax.naming.* only).
    I need to achieve it without using any oracle specific jars.
    Is there any way to achieve it?.If there's a option to achieve it,do let me know.
    I also need to create the users in that group ,after creating it.
    If you share any useful link or ideas for the same would be great.
    Thanks
    Balaji

    bobws wrote:
    Hi,
    I want to find the installed JREs in windows using java. I couldn't fine any java API. So I am using the below code to fetch the JRE list from windows registries & parse the returned collection to know the installed JRE.Why? If you are running java you already have a JRE. So why not just use it?
    >
    String key = "HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Runtime Environment";
    Runtime.getRuntime().exec(
    "reg query " + "\"" + key + "\"");
    Is it legal to retrieve the installed JREs in this way? Legal? It is OS specific, and to a certain extent dependent on vendor and what the vendor wants to do. Could also be impacted by permissions. Other than that it is ok.
    I am feeling like its a type of hacking. So I couldn't decide whether this is legal (recommended) way of using. Does anybody can answer me. I can see the similar posts in google. Somebody suggests this way & somebody suggests to use preference API which is similar to this. Appreciate your help.Preferences won't work. It doesn't allow access to the registry in general, only a part of it. There are discussions in the JNI forum about retrieving VM versions. Prior to actually using the VM though.

  • Create group in OID using java api

    Hi all!
    I need to create group in OID using java api. Java api documentation contains examples for creating users but not for groups. I search oracle.com (and google) and didn't find any hint.
    Anybody know the way?
    thank you.

    Andrew,
    a group is created like any other entry in OID. You need to specify the dn, objectclass(es) and (mandatory) attributes.
    e.g.
    objectclass=groupOfUniqueNames
    with
    uniquemember=cn=orcladmin, cn=Users, dc=de,dc=oracle,dc=com
    as an example take a look at
    cn=iASAdmins, cn=Groups,cn=OracleContext,dc=de,dc=oracle,dc=com
    to see the schema (data) for groupofuniquenames you can either use ODM or query the directory server
    ldapsearch -p 3060 -b "cn=subschemasubentry" -s base "objectclass=*"
    regards,
    --Olaf                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Java API getting unix file ownership(name, group..etc)

    I am looking for any standard or 3rd-paty Java API that retrieves unix file ownership (name, group..etc)
    Thanks.

    I don't like your chances of finding a standard library to pull Unix group and user ownership. That would be violating the whole theory of Java being OS agnostic. I'm also unaware of any 3rd party library that does this.
    That said, you can definitely do this. One way I can think of is making a Runtime call:
    http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Runtime.html
    You could use this to do an ls -l on a file and parse the result.
    This would of course be violating standard practice in J2EE when any access direct to the file-system is regarded as being a pretty bad idea. It would also make remove the write-once run-anywhere aspect to your code, though that may not concern you too much.
    cheers,
    Trevor Nielsen
    londonmiddleware.org

  • How to find bpel instance in 11g based on the index values using Java APIs

    Hi ,
    In SOA10G we had option to find the instances based on the index value using Java APIs like below.
    WhereCondition criteria= new WhereCondition(SQLDefs.CX_index_1 + " = ?");
    criteria.setString(1, "indexValue");
    Locator mLoc = getLocator();
    IInstanceHandle[] foundInstances = mLoc.listInstancesByIndex(criteria);
    Please tell me how to achieve the same functionality in SOA 11G using Java APIs
    Regards,
    Saba

    I have multiple bpel in my composite. I checked in ci_indexes table and it shows the instance number of the bpel process. But the em console is showing only the composite instance number. when I opened composite instance, I could see all the bpel process with instance number in the audit trail. How can I find the the actual composite instance number that I should search for in the em console ???

  • Where can I find the original code for class in Java API

    I am learning Java programming and wanted to see how professionals handel all cases. Can anyone tell me where I can find the original implementation code for classes in Java API? It would be a great help for me.

    the basic source is where you installed java in a file called java.src, its either in the main dir of one of the sub dirs ( mmm ), contains all the source code for all the classes in the api.

  • Where can find java API to dwl

    does anyone know if i can download java API spec from sun.. since i cant find where I can dwl and i wish to use it offline....

    dwl?
    sure - its on the downloads page.

  • I can not find java library for spatial java api B14373-01

    hi
    at the following link there is a description of the current java api..
    http://download-uk.oracle.com/docs/cd/B19306_01/appdev.102/b14373/toc.htm
    but i can't find the appendant *.jar files
    can anybody help me...
    jens

    You can find them under $ORACLE_HOME/md/lib
    directory.
    siva

  • Find Duplicate Members in more than two Active Directory Groups

    hi,
    I am trying to find out duplicate members in more than two active directory groups. I am new to powershell and only found one script that gives me only duplicate members in two groups. If any one can help 

    I have this script that find duplicate members in two groups
    $GroupAMembers = "" 
    $GroupBMembers = "" 
    $Members_A = "" 
    $Members_B = "" 
    $GroupAMembers = Get-ADGroupMember (groupname)
    $GroupBMembers = Get-ADGroupMember (groupname)
    ForEach ($Members_A in $GroupAMembers){ 
      ForEach ($Members_B in $GroupBMembers){ 
    if ($Members_A.name -eq $Members_B.name)
    Write-Host $Members_A.name

  • Where can I find the complete Oracle Business Rules Java API Reference ?

    Does anybody know where to get the complete Oracle Business Rules Java API Reference ?
    The version on http://download-east.oracle.com/docs/cd/B31017_01/web.1013/b28966/toc.htm is incomplete. It is missing the entire "oracle.rules.sdk.ruleset" package.
    Ki

    Kim,
    The oracle.rules.sdk.ruleset package is only for internal operation. The public interface to creating rules is oracle.rules.sdk.editor.ruleset , and this is included in the javadoc.

  • Where can I find the Java API doc for the OES PEP interfaces (OpenAZ API).

    In the PepApiExample downlouded from Oracle web site at [PepApiExample |http://www.oracle.com/technetwork/middleware/id-mgmt/downloads/pepapiexample-1588440.zip], there are some Java API interfaces related OpenAZ API, but there is no the whole API docs, where I can get it?
    Thanks.

    There should be a file called javadocs.jar in your portal installation directory. Either under SUNWps/sdk or SUNWps/export.
    - Jim

  • Image upload using Java API

    Hi all,
    I am trying to upload an image into MDM repository using the Java MDM4J API. I have referred to the earlier posting in this forum for the same problem I am not able to add images into Catalog thru java API. However I am working on SP3 version of MDM software and looks like the Images table structure changed a bit and the code in the earlier posting isn't working.
    I am getting an error code <b>-5586944</b> and the message that gets printed on the console is
    <i>a2i.core.StringException: AddRecord error
         at a2i.common.CatalogData.AddRecord(Unknown Source)
         at a2i.common.CatalogData.AddRecord(Unknown Source)</i>
    Here is the code that I am using to upload the image
    String filePath = "C:\temp\Sunset.jpg";
    File file = new File(filePath);
    byte[] bytes = new byte[(int) file.length()];
    try{
         //read byte from file, and set the large data
         FileInputStream inputStream = new FileInputStream(file);
         inputStream.read(bytes);
         mdmFields.Add(new A2iField("Data ID", new Value(bytes)));
    }catch(IOException ioex){
         ioex.printStackTrace();
    int dataGroupId = 0;//Hardcoded it to 0. There is one group already in the repository
    mdmFields.Add(new A2iField("Data Group ID", new Value(dataGroupId)));
    //adding the name
    mdmFields.Add(new A2iField("Name", new Value(file.getName())));
    mdmFields.Add(new A2iField("Original Name", new Value(file.getName())));
    //adding OrigLocationId
    int origLocationId =0;
    try{
         origLocationId = catalog.AddDataLocation(filePath, 0, DataLocationType.ComputerLocation);
         System.out.println("Location id generated is " +origLocationId);
    }catch(StringException ex){
         System.out.println("Error while generating the location id");
         ex.printStackTrace();
    mdmFields.Add(new A2iField("Original Location ID", new Value(origLocationId)));
    try {
         //adding the image to the "Images" table
         int newImageId = catalog.AddRecord("Images", mdmFields, 0, 0);
    } catch (StringException e) {
         // TODO Auto-generated catch block
         System.out.println("Error while adding the image record " + e.GetErrorCode() + "  " + e.GetRCMessage(e.GetErrorCode()));
         e.printStackTrace();
    I am not able to figure out what is causing the problem. Any ideas would be greatly helpful. Thanks in advance.
    Suman.

    Hi Mausam,
    Thanks for your help. However, the problem doesn't seem to be going.
    I printed the records in the <b>Data Groups</b> table using a program to find the record ids that are already existing. My Data Groups table has 3 records. Here are the values.
    ID :1 Value :MyGroup
    ID :2 Value :Group2
    ID :3 Value :Group3
    I tried passing all the above 3 values (1,2,3) as input to the <b>Data Group ID</b> field. However, this time, I am getting a different error code this time
    Error while adding the image record -2147483647  No message for RC (0x80000001)
    a2i.core.StringException: AddRecord error
         at a2i.common.CatalogData.AddRecord(Unknown Source)
         at a2i.common.CatalogData.AddRecord(Unknown Source)
         at images.MyImageUpload.uploadImage(MyImageUpload.java:82)
    The error code <b>2147483647</b>  from the javadocs says <b>RC_BADPARAM</b>. Not able to figure out what exactly is causing the problem with Data Group ID.
    Any ideas or pointers to solve this would be greatly helpful. Thanks in advance.
    Regards
    Suman
    > Hi Suman,
    >
    > If you look at the description for the error code,
    > you get RC_CM_DATAGROUPNOTFOUND.
    >
    > Try giving some other value ( 1 worked for me ) in
    > the Data Group or try following the code given for
    > the Data Group in other forum post that you have
    > mentioned.
    >
    > Regards,
    > Mausam

  • How to show logged-in Line Group Members in a Hunt Pilot (CUCM V7.1.3)

    I have configured a Hunt Pilot with a Hunt List which points to a Line Group with some DNs as Line Group Members. Additionally i gave the affected Users the option to log-in or log-out from the Hunt Pilot by configuring the "Hunt Group Logout" Button in the corresponding Phone Button Template.
    Is there a way to find out who is logged-in or logged-out from the Hunt Pilot?

    Hi Bill,
    thanks for your very interesting hint .
    I run the query you posted and actually got the following output. But the displayed linegroups are only a subset from my configured 79 linegroups . Is there a possibility to display all linegroups with all corresponding DNs and can i display this information for only one linegroup?
    When i know the queery that satisfy my claims, i will write a small web application that uses the AXL-SOAP API.
    Regards, Robert
    admin:run sql select lg.name as LineGroup,n.dnorpattern,dhd.hlog from linegroup as lg inner join linegroupnumplanmap as lgmap on lgmap.fklinegroup=lg.pkid inner join numplan as n on lgmap.fknumplan = n.pkid inner join devicenumplanmap as dmap on dmap.fknumplan = n.pkid inner join device as d on dmap.fkdevice=d.pkid inner join devicehlogdynamic as dhd on dhd.fkdevice=d.pkid order by lg.name
    linegroup                      dnorpattern     hlog
    ============================== =============== ====
    LG_A-Ulr4_Augsburg_9965077_235 \+498215075234  f
    LG_A-Ulr4_Augsburg_9965077_235 \+498215075209  f
    LG_A-Ulr4_Augsburg_9965077_235 \+498215075224  f
    LG_A-Ulr4_Augsburg_9965077_235 \+498215075226  f
    LG_A-Ulr4_Augsburg_9965077_235 \+498215075227  f
    LG_A-Ulr4_Augsburg_9965079_300 \+498215075327  f
    LG_A-Ulr4_Augsburg_9965079_300 \+498215075306  f
    LG_AB-Fried17_9965006          \+496021391713  f
    LG_AB-Fried17_9965006          \+496021391714  f
    LG_AB-Fried17_9965006          \+496021391721  f
    LG_AB-Fried17_9965006          \+496021391727  f
    LG_AM-Mar9_9965004             \+499621474921  f
    LG_BT-Sch9_9965010             \+4992189423    f
    LG_DD-Fet29_9965014            \+493514459055  t
    LG_HO-Bah1_9965020             \+4992818194122 f
    LG_KE-Moz31_9965024            \+498315215110  f
    LG_LA-Dre11_9965025            \+498714308419  f
    LG_LA-Dre12_9965026            \+498719239113  f
    LG_Mue-Sta41_9965029           \+498631386227  f
    LG_N-KOEN11_9965034            \+4991124039112 f
    LG_N-KOEN11_9965034            \+4991124039142 f
    LG_N-KOEN11_9965034            \+4991124039110 f
    LG_N-Ste6_9965057_400          \+499112428403  f
    LG_N-Ste6_9965058_450          \+499112428455  f
    LG_NES-Sie2_9965008            \+499771610413  f
    LG_NES-Sie2_9965008            \+499771610421  f
    LG_NM-Bah12_9965030            \+499181293312  f
    LG_PA-Kle13_9965035            \+498519594109  f
    LG_PA-Kle13_9965035            \+498519594113  f
    LG_PAN-Drb12_9965036           \+498561961225  t
    LG_PAN-Drb12_9965036           \+498561961224  f
    LG_R-Her2_9965068_400          \+499413783414  f
    LG_TS-Bah26_9965040            \+498619887312  f
    LG_Voicemail                   997005          t
    LG_Voicemail                   997006          t
    LG_Voicemail                   997007          t
    LG_Voicemail                   997008          t
    LG_Voicemail                   997009          t
    LG_Voicemail                   997010          t
    LG_Voicemail                   997011          t
    LG_Voicemail                   997012          t
    LG_Voicemail                   997013          t
    LG_Voicemail                   997014          t
    LG_Voicemail                   997015          t
    LG_Voicemail                   997016          t
    LG_Voicemail                   997017          t
    LG_Voicemail                   997018          t
    LG_Voicemail                   997019          t
    LG_Voicemail                   997020          t
    LG_Voicemail                   997021          t
    LG_Voicemail                   997022          t
    LG_Voicemail                   997023          t
    LG_Voicemail                   997024          t
    LG_Voicemail                   997025          t
    LG_Voicemail                   997026          t
    LG_Voicemail                   997027          t
    LG_Voicemail                   997028          t
    LG_WEN-Buer16_9965041          \+499614820413  t
    LG_WEN-Buer16_9965041          \+499614820415  f
    LG_WM-Puet35_9965042           \+49881922927   f
    admin:

Maybe you are looking for