How to add user to external LDAP programmatically?

Hello.
I have portal application in JDeveloper. Here is code that adds user to WLS embedded LDAP:
JpsContextFactory jps = JpsContextFactory.getContextFactory();
JpsContext jpsContext = jps.getContext();
IdentityStoreService storeService = jpsContext.getServiceInstance(IdentityStoreService.class);
IdentityStore is = storeService.getIdmStore();
UserManager mn = is.getUserManager();
RoleManager rm = is.getRoleManager();
Principal p = mn.createUser(username,password.toCharArray()).getPrincipal();
Role r = is.searchRole(is.SEARCH_BY_NAME, "Administrators");
rm.grantRole(r, p);
But I also have external LDAP on my WLS. How can I add users to external LDAP programmaticaly?

System Preferences > Users & Groups > Unlock the lock on the bottom left > click the plus sign on the bottom left

Similar Messages

  • How to add users from person or group field in a sharepoint list to sharepoint group

    Hi,
    How to add users(single or multiple) from person or group field in a sharepoint list to sharepoint group programmatically?
    Any suggestions would be appreciated.
    Thank you,
    AA.

    Hello,
    Use SPGroup.AddUser() method to add user in group. I have just written sample code in notepad so it is not tested:
    SPSecurity.RunWithElevatedPrivileges(delegate()
    using(SPSite Site = new SPSite(SPContext.Current.Site.Url))
    Using(SPWeb Web = Site.OpenWeb())
    SPList list = web.Lists["ListName"];
    SPQuery query=new SPQuery ();
    query.Query = "<Where><Eq><FieldRef Name='Title' /><Value Type='Text'>Test</Value></Eq></Where>";
    SPListItemCollection items = list.GetItems(query);
    if(items.Count > 0)
    foreach(SPListItem item in items)
    //Get USers from person or group column
    SPFieldUser userField = (SPFieldUser)item.Fields.GetField("Users");
    SPFieldUserValueCollection userFieldValueCollection = (SPFieldUserValueCollection)userField.GetFieldValue(item["Users"].ToString());
    SPGroup spGroup = spSite.RootWeb.Groups[groupName];//group name
    if (users.Count != 0)
    bool isUserInGroup = false;
    foreach (SPFieldUserValue user in users)
    foreach (SPUser item in spGroup.Users)
    string itemUserName = item.LoginName;
    string UserName = user.User.LoginName;
    if (itemUserName == UserName)
    isUserInGroup = true;
    break;
    if (!isUserInGroup)
    spGroup.AddUser(user.User);
    The above code will query list item and then get users from "Users" column. Now it will check whetehr user is already in group not, if not then add user in group.
    http://rajanijilla.blogspot.sg/2012/09/add-users-to-group-programmatically.html
    Hope it could help
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • How to add user defined tab in the Header level of T-Code O4NM?

    How to add user defined tab in the Header level of  T-Code O4NM?
    I tried with BADI but I cant able to find any BADI for it and also searched for screen exit too..

    Can you check the user exits,
    OIJNOM_N and OIJTKT_N
    Cheers,
    Balaji

  • How to add users to group which is present in another AD domain?

    Hi,
    Using JNDI how to add user as a member of group which is present in another AD domain?
    For example: In AD forest test.com their are two domain a.test.com and b.test.com. Group is present in a.test.com and I want to add user present in b.test.com as a member of the group.
    Any pointer around this would be great help.

    See the below link to get an idea on group types.
    http://technet.microsoft.com/en-us/library/cc755692(v=ws.10).aspx
    If the group is a universal group, you can just add members similar to local group even if user and group are in different domains. That is by setting the member attribute of the group.

  • How to add users to OSM using UserAdmin.xsd

    Hi,
    Can you please explain me how to add users to OSM using UserAdmin.xsd i.e xml import/export tool. I need the steps how to do that..
    Thanks in Advance,
    Menaka

    Hi Razvi444,
    You need to use submit data to web service in Submit button rule,where you can use above web service.
    Refer http://office.microsoft.com/en-in/infopath-help/submit-form-data-to-a-web-service-HA010107048.aspx more details
    Thanks

  • How to add user from domain A to a group in domain B

    How would you acheive adding a user from domain A to a group that is in domain B via powershell without the Quest cmdlets? I've been trying to figure this out for about a week now. Please let me know if the scripting guy has seen this issue before.
    LittleTech

    Hello jrv,
    Here's what i was trying to do. The two domains im working with have a trust between them.
    1. Create a user in External.Domain.Com
    2. Add the user in External.Domain.Com to GroupOne in ExternalDomain2.Domain.com
    3. The only knowledge that ExternalDomain2.Domain.Com would have about the account in External.Domain.Com is whatever is in the Global Catalog. Here is what im trying, but it isn't working.
    #Connecting to domain PSDrive
    New-PSDrive
    -Name
    ExternalDomain
    -PSProvider
    ActiveDirectory
    -Root
    -Server
    DC01.Domain.com
    cd
    ExternalDomain:
    #Create user
    #Add to ExternalDomain Groups
    $UserDN=Get-ADUser-LDAPFilter"(sAMAccountName=$UserID)"
    #Connecting to domain2 PSDrive 
    cd
    AD:
    $GroupDN="CN=Wireless
    Device Users,OU=Wireless,OU=Systems and Technology,DC=External,DC=Domain2,DC=Com"
    Add-ADGroupMember-Identity$GroupDN-Members(Get-ADObject-Identity$UserDN.DistinguishedName
    -Server"DC01.Domain.com:3268")
    Connecting via port 3268 allows me to talk to the global catalog instead of LDAP.
    I receive the following message: A Referral was returned from the server
    I know that if i connect using [ADSI] i am able to specify that the connection follows referrals, the AD cmdlets seem to not have that function. The Quest AD cmdlets do... I just dont want to have to use third party cmdlets to do what the AD cmdlets should
    be able to do in the first place.
    THanks,
    LittleTech

  • How to create User Portal in OID programmatically in JSP

    Hi.
    I want to create User Portal programmatically in JSP (if posible) or have to use procedure.
    I check with package wwsec_api, it just have 'function
    add_portal_user', but it say we must have "the user must already exist in OID before this function is called."
    So, i checked for 'how to create User in OID'. What i got (in metalink)just methods that 'Create manually Portal Users in to OID' by LDAP or PL/SQL coding (with list of user in flat files).
    What i want to do is, How to create User POrtal in OID by JSP? What are the procedure/table/method involved?
    Do anybody have any samples?..
    Thanks.

    I had to write my own because I could not find one anywhere. Here is an addUser() method that seems to work pretty well.
    import oracle.ldap.util.jndi.ConnectionUtil;
    import javax.naming.directory.*;
    import javax.naming.*;
    public class LdapUser
    public LdapUser(){}
    public void addUser(String pUsername, String pPassword, String pFirstName, String pLastName, String pEmail)
    try
    InitialDirContext ctx = ConnectionUtil.getDefaultDirCtx("host", "port", "orcladmin", "pwd");
    BasicAttributes attrs = new BasicAttributes();
    BasicAttribute oc = new BasicAttribute("objectclass");
    oc.add("top");
    oc.add("person");
    oc.add("inetOrgPerson");
    oc.add("organizationalPerson");
    oc.add("orclUser");
    oc.add("orclUserV2");
    attrs.put(oc);
    BasicAttribute gn = new BasicAttribute("givenName", pFirstName);
    attrs.put(gn);
    BasicAttribute sn = new BasicAttribute("sn", pLastName);
    attrs.put(sn);
    BasicAttribute cn = new BasicAttribute("mail", pEmail);
    attrs.put(cn);
    BasicAttribute pwd = new BasicAttribute("userpassword", pPassword);
    attrs.put(pwd);
    // Etcetera, etcetera...
    ctx.createSubcontext("cn="+pUsername+",cn=users,dc=whatever,dc=com", attrs);
    ctx.close();
    System.out.println("Success!!");
    catch (NameAlreadyBoundException nabe)
    System.out.println("Username is already in use. Please choose another.");
    catch (NamingException ne)
    System.out.println("NamingException: " + ne);
    catch (Exception e)
    System.out.println("User account was not created.");
    }

  • How to get user information from ldap - bpm11g

    hi all,
    i need know how to do get information from ldap, but using adf bean for show user data in adf form.
    anyone knows about this ?
    tks.

    Neal wrote:
    >
    Hi,
    I am using WLS default authentication to protect my JSP pages. Can someone tell
    me if it is possible to add more fields to the default login box (in addition
    to login and password boxes, I want to ask user the department name). In additional,
    can WLS propogate this information (department name) along with other security
    credentails to other J2EE components such as EJBs? In my EJBs I want to be able
    to get the department name that user provided during login and then use that for
    conditional business logic.
    Any insights on this subject will be greatly appreciated.
    TIA,
    -NealYou can't do this with the default simple authentication. That can only handle a
    username / password combination.
    You should be able to do this with JAAS. You could write a LoginModule that
    populates the department as a Principal or public Credential on the Subject in
    addition to the normal authentication. You would have to do a callback handler
    that passed through the department info to it.
    This link has more on WLS's stab at JAAS:
    http://e-docs.bea.com/wls/docs61/security/prog.html#1039659
    Once you have associated the Subject with the access control context by invoking
    a doAs() you should be able to get it back at any point with
    Subject.getSubject(AccessController.getContext()) to get access to the
    department info.
    It will all be a bit of a chore, mind.

  • How to add users to the container

    Hi,
    My JSF application has security enabled. The users and their roles are defined in a .xml file located in my container (standard). Is there any way I can dynamically add users to this .xml file? Right now I am able to add them manually, but it would be nice if they were added as soon as they joined my service.
    Best Regards
    Thomas

    There is always some way ...
    Most app servers will support custom login modules via the JAAS "LoginModule" interface. Glassfish has built-in modules for file, LDAP, certificate store and solaris authentication, but you can plug-in others. There is an article and sample for how to do this for a database at <http://dev2dev.bea.com/pub/a/2003/04/Pijpops.html> (targeted at BEA, but Glassfish, etc should be the same).
    Using a database or LDAP directory to store your users means there are plenty of standard tools for manipulating and managing the data, and any updates will be available immediately to your app server.
    If you want to stick to with the file module, you can obviously update the file directly, but then the app-server or domain might need a restart before your new users get picked up, and also if the file stores the passwords hashed, you have to know the particular hashing algorithm used. Otherwise, each app server usually exposes the admin functionality (like adding users) through some web-service or EJB interface -- but this tends to be app-server specific. Your app server docs should give more details.
    What app server and version are you using? Glassfish? JBoss?

  • How to add users to demo model

    Hello,
    Objective is to add user to demo context instead of using pipadmin user. Through user mangement added users, however In the manage application groups users are not showing up
    tried the Synchronize User Tables and it is hanging
    actived extended listener service and still Synchronize User Tables is hanging
    what is mean by Synchronize User Tables ..what does it really do
    Thanks
    TR

    TR-
    The Synchronize Users piece is needed in SSM because of how users access the system. As a standalone, Netweaver CE handles the user management in UME and there are settings that can be modified in Netweaver CE if you'd rather use BusinessObjects Enterprise or LDAP for user management.
    Changes in users is not automatically refreshed in Strategy Management and so the synchronize users procedure. There are occasions where the synch doesn't look like it has taken place, but when you go to Manage Application Groups in the Administrator interface the updated names appear.
    If you are using Netweaver CE to maintain users, add the user in the Identity Management section and make sure to assign that user to appropriate groups. After you have saved that, Sychronize Users in SSM Admininistration and restart
    As Vijay is asking in his response, you should clear open sessions by either restarting JPIP in Tools or Extended Listener & Listener in Windows Services, if JPIP is not displayed on your Tools page.
    Regards,
    Bob
    Edited by: Bob McGlynn on Jun 29, 2010 6:06 AM

  • How to add a new Shared Variable programmatically to an existing and deployed library?

    Hi there!
    I am trying to accomplish this on both LabVIEW 8.6 and LabVIEW 2010 and seems like it's not any different in this situation.
    My case: A project has a library with 4 Shared Variables (SVs). The library and the variables are deployed (visible in Distributed System Manager 8.6/2010). I want to add 2 more variables into this library. It is possible to do this manually from Project Explorer window's options menu. But while running an application it has to be done programmatically. Can I provide the library reference to the one currently existing without creating a new one?
    "Create Or Add Library To Project" function in the Datalogging and Supervisory Control (DSC) toolkit does not help in this case. That function, as the name suggests, just tries to create a new library in the project.
    Two possible methods:
    The function "Add Shared Variable To Library" (DSC>EngineControl>Libraries & Processes) needs a library reference, which could be provided via "CreateOrAddLibraryToProject" function, but this function tries to create a new library, and if I provide the path of the existing library it throws an exception that the library already exists in the project (yes, as I wrote above, I need to add new variables to an existing and deployed library).
    OR
    The function "Create Shared Variable" (DSC>EngineControl>Variables & I/O Servers) will add Shared Variable in a process, and not physically in a library file, and the problem (limitation) with this approach is that it doesn't allow to add complex data type Shared Variables (for example in LabVIEW 8.6 it has only 4 datatype options in input parameter, and even in LV2010 it does not have "Image" datatype that I need).
    The scond method is my preferred method as it allows to work on Online Shared Variables and doesn't create them physically in libraries (and this is good as the variables' scope remains only till the Variable Engine is running). But it doesn't support advanced data types, and the first method is powerful in terms that it supports to virtually any datatype, it just seems tricky to get that reference to the library.
    Any tips?
    Thanks ahead!
    Vaibhav

       <<<<>>>>   
    As the above two images show, while a library does not exist, it is easy to use the "CreateOrAddLibraryToProject.vi" which will add a new library to the project (if it doesn't exist on file system, a new library will be created) and that way, using the reference (the green wire going out from the function and the Case Structure, can be used to add Shared Variables to the library. The problem was what to do when a library already exists in the project, how to add more variables to it. I was looking for a way to get a library reference, and somehow I could not see it inside a Project's property (VI Server functions). Hence I posted the question. And upon continuing my search, I found it on the Application's property list.
    I hope it was useful for someone else as well. And thanks for the replies. Please share a better idea if you have.
    Vaibhav

  • In XML Gateway Responsibility How to add User defined Trading Partner type.

    Hi,
    We have a requirements to add user defind Trading Partner Type apart from the default trading partner type.
    How to do this? If any one know , kinldy let me explain it
    Thanks

    I looked it up in the mean time ...
    The docs state that you only can use simple data type or java.util.list or AttributeList (which is a wrapper for any viewRow). So I guess you have to somehow flatten your complex data type or create a custom VO which holds it.
    http://download.oracle.com/docs/cd/E12839_01/web.1111/b31974/bcextservices.htm#CJAEHFJD
    Scroll down to 11.2.3
    Timo

  • How to add User Permissions to form created in InfoPath 2010 created for SharePoint document Library

    Hi,
    I created a form in InfoPath 2010 with three views (one for user input, the other two views to be used by supervisors) and published this to a SharePoint 2010 document library. Now the way this form is supposed to work is that when a User goes to the document
    library and adds a document, it is supposed to open the Form with the User's input view. When the User submits the document, only him/her should be able to open and possibly edit the the form. When the Immediate Supervisor opens the form, it should open in
    the Supervisors view and allow them to fill in only their section and not be able to edit or alter the user's data. When the Immediate Supervisor saves the document, the Over-all Supervisor should be able to open it in their view and not be able to edit or
    alter the sections filled out by the User and Immediate Supervisor.
    How would i go about completing this? I have the views created but now have the problem of associating these views with their respective users or groups.

    Hello,
    You need to first create user group in sharepoint site then add user in group according to their role. Later you need to call usergroup.asmx web service to get current logged-In user group name so you can switch view and also apply rule for editing or disabling
    controls in form.
    Follow this link to get group name:
    http://social.technet.microsoft.com/wiki/contents/articles/13271.sharepoint-2010-extracting-user-group-of-current-login-user-in-infopath-2010.aspx
    http://social.msdn.microsoft.com/Forums/en-US/018f5184-5c83-4a53-b66b-8c376fc800fc/how-to-get-current-users-sharepoint-group-name-sharepoint-2010-infopath-2010
    To apply rule on control:
    http://office.microsoft.com/en-in/infopath-help/add-rules-for-performing-other-actions-HA101783373.aspx
    Hope it could help
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • How to add user defined functions in Menu bar of a Selection Screen?

    Hi,
    Can anybody please suggest me that how can I add user defined functions in the menu bar of a Selection Screen?
    Regards
    s@k

    Dear Amit,
    I am referring to the standard SAP program: RIEQUI20.
    On the initial screen, there are 3 tabs.
    Code:
    SELECTION-SCREEN BEGIN OF TABBED BLOCK tab FOR 25 LINES.
    SELECTION-SCREEN TAB (20) tab1 USER-COMMAND ucomm1
                         DEFAULT SCREEN 001.
    SELECTION-SCREEN TAB (20) tab2 USER-COMMAND ucomm2
                         DEFAULT SCREEN 002.
    SELECTION-SCREEN TAB (20) tab3 USER-COMMAND ucomm2
                         DEFAULT SCREEN 003.
    SELECTION-SCREEN END OF BLOCK tab.
    AT SELECTION-SCREEN.
      CLEAR gv_okcode.
      gv_okcode = sy-ucomm.
      CLEAR sy-ucomm.
      CASE gv_okcode.
        WHEN 'IH08'.
          CALL TRANSACTION 'IH08'. "Equipment Selection
        WHEN 'IW29'.
          CALL TRANSACTION 'IW29'. "Notification Selection
        WHEN 'IW39'.
          CALL TRANSACTION 'IW39'. "Order List Selection
        WHEN OTHERS.
      ENDCASE.
    *   Check date:                                         
      IF NOT datuv IS INITIAL                            
      AND NOT datub IS INITIAL.                         
        IF datub >= datuv.                              
        ELSE.                                           
          MESSAGE e884(ih) WITH datuv datub.            
        ENDIF.                                           
      ENDIF.                                             
      IF variant IS INITIAL AND
         dy_vari IS INITIAL.
        PERFORM get_default_variant_f14 USING variant.
      ENDIF.
      PERFORM variant_existence_f14 USING variant.
      IF datuv IS INITIAL.
        datuv = sy-datum.
      ENDIF.
      IF datub IS INITIAL.
        datub = sy-datum.
      ENDIF.
      IF sy-ucomm = 'ADDR'.
        PERFORM adress_sel_f01 USING 'EQUIR'.
      ENDIF.
      PERFORM check_parnr_f76.
    *  AT SELECTION SCREEN OUTPUT
    AT SELECTION-SCREEN OUTPUT.
      STATICS: l_slset TYPE sy-slset.
    *--- Set initial variant
      PERFORM variant_init_f14 USING 'INST' 'INST' 'INST' 'RIEQUI20'.
      IF variant IS INITIAL AND
         dy_vari IS INITIAL AND
        gv_variant_flag IS INITIAL.
        PERFORM get_default_variant_f14 USING variant.
        gv_variant_flag = 'X'.
      ENDIF.
    *--- Set Icon for adress-button
      PERFORM set_icon_f01 USING dy_adrfl ad_icon text-ad0 text-ad1.
    *--- get classification data from select option
    *--- (if new variant or if called via submit or F3)
      IF ( l_slset NE sy-slset ) OR
         ( s_comw[] IS NOT INITIAL AND gt_clsd_comw[] IS INITIAL ).
        l_slset = sy-slset.
        gv_class_old = dy_class.
        gv_klart_old = dy_klart.
        PERFORM copy_selopt_comw_f79 TABLES gt_clsd_comw s_comw.
        PERFORM class_search_init_f77 USING 'EQUI'.
      ENDIF.
    *--- set Icon for classification
      LOOP AT gt_clsd_comw TRANSPORTING NO FIELDS          
                          WHERE atcod > '0'.               
        EXIT.                                              
      ENDLOOP.                                             
      IF sy-subrc IS INITIAL.
        gv_comw_flag = 'X'.
      ELSE.
        CLEAR gv_comw_flag.
      ENDIF.
      PERFORM set_icon_f01 USING gv_comw_flag cl_icon text-cl0 text-cl1.
      CALL METHOD cl_uid_cust=>selection_screen_output.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR variant.
      PERFORM variant_inputhelp_f14 USING variant 'RIEQUI20'.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR dy_parnr.
      PERFORM f4_for_parnr_f76.
    AT SELECTION-SCREEN ON BLOCK clse.
      IF dy_class NE gv_class_old
        OR dy_klart NE gv_klart_old.
        gv_class_old = dy_class.
        gv_klart_old = dy_klart.
        CLEAR gv_comw_flag.
        REFRESH gt_clsd_comw.
        REFRESH s_comw.
      ENDIF.
      PERFORM class_exist_f77 USING dy_klart dy_class 'DY_CLASS'.
      IF sy-ucomm = 'COMW'.
        CALL FUNCTION 'IHCLSD_VALUATION_POPUP'
          EXPORTING
            i_klart               = dy_klart
            i_class               = dy_class
            i_language            = sy-langu
            i_key_date            = sy-datum
            i_also_subclasses     = dy_subcl
          TABLES
            ct_comw               = gt_clsd_comw
          EXCEPTIONS
            exc_no_class          = 1
            exc_klart_not_allowed = 2.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
    *--- fill classification data in select option
        PERFORM copy_comw_selopt_f79 TABLES gt_clsd_comw s_comw.
      ENDIF.
      IF sy-ucomm = 'ONLI'.
        sscrfields-ucomm = sy-ucomm.
      ENDIF.
    Regards
    s@k
    Edited by: siemens.a.k on Jan 15, 2010 10:10 AM

  • How to add user to one to many groups in Active directory using powershell

    Hi  All
    I am working on a script to create a user and based on user type i would like to add that user into 2 to 3 groups . At the moment i have 3 groups e.g domain users, Developers, tester, 
    $NewUser = Read-Host "New Username"
    $firstname = Read-Host "First Name"
    $Lastname = Read-Host "Last Name"
    $NewName = "$firstname $lastname"
    $Group = "Dev"
    New-ADUser -SamAccountName $NewUser -Name $NewName -GivenName $firstname -Surname $lastname -displayname $Newname -UserPrincipalName $[email protected] -Path "CN=Users,DC=mydomain,DC=local" -AccountPassword (ConvertTo-SecureString -AsPlainText
    "Password" -Force)  -Enabled $true 
    Add-ADGroupMember -Identity $Group  -Members $NewUser
    I am not sure how to give user(sys admin) this option of choosing 1 or more groups while creating new user

    modified this line Add-ADGroupMember
    -Identity ([string]$h[$group])
    -Members
    $NewUser
    and
    now getting the error message Add-ADGroupMember : Cannot find
    an object with identity: '' under: 'DC=mydomain,DC=local

Maybe you are looking for

  • Mail not showing in any folder...!!!

    The mail database where all the mails are stored (documents and settings/application data/thunderbird), that folder size is more than 14 GB. but no mail showing in thunderbird.

  • IDoc Tunneling and XML_CONVERSION

    Hi, I'm developing a File 2 IDoc / IDoc 2 File Scenario. The Partner who receives and send files wants to use the idoc flat table structure. I noticed that wasn't so easy to convert IDoc XML to flat file, till i found IDoc Tunelling which perfectly f

  • How to configure flatfile adapter?

    I need to configure flat file adapter to load sample data I tried configuring with flatfileactiveSync(csv) reosurce type when I reconcile it says error iterating over objects and failed pls help me on this

  • Windows 8 two-finger-scrolling not working properly

    Two-Finger Scrolling in Windows 8 doesn't seem to work properly on my U300S Synaptics trackpad. Instead of just scrolling through the tiles or app on the Windows 8(.1) startscreen, individual apps are higlighted and scrolled through like when I use t

  • How to export a table with BLOBs

    Hi, when I have to export a table with its own data, I generally export it by using the export on UNIX. I've never tried to export a table with a BLOB. Is it possible in the same manner or what else? Thanks!