Creating users and adding them to groups programmatically in Portal 902

What is the correct process and code needed to create a user and add it to a group programmatically in Portal 9.0.2 and how is it different from what it used to be in 309.
If anyone has an answer, please let me know and all contributions are really appreciated.
Thanks

You can use these procedures.
procedure Create_User(first_name IN VARCHAR2
,last_name IN VARCHAR2
,password IN VARCHAR2
,email IN VARCHAR2
,employeenumber IN VARCHAR2
,description IN VARCHAR2
is
retval PLS_INTEGER;
emp_session DBMS_LDAP.session;
emp_dn VARCHAR2(256);
emp_rdn VARCHAR2(256);
emp_array DBMS_LDAP.MOD_ARRAY;
emp_vals DBMS_LDAP.STRING_COLLECTION ;
ldap_host VARCHAR2(256);
ldap_port VARCHAR2(256);
ldap_user VARCHAR2(256);
ldap_passwd VARCHAR2(256);
ldap_base VARCHAR2(256);
BEGIN
retval := -1;
ldap_host := '<you_host>';
ldap_port := '4032';
ldap_user := 'cn=orcladmin';
ldap_passwd:= '<orcladmin_password>';
ldap_base := 'cn=users,dc=<your_compani_name>,dc=com';
DBMS_LDAP.USE_EXCEPTION := TRUE;
emp_session := DBMS_LDAP.init(ldap_host, ldap_port);
-- Bind to the directory
retval := DBMS_LDAP.simple_bind_s(emp_session,ldap_user, ldap_passwd);
emp_array := DBMS_LDAP.create_mod_array(14);
emp_vals(1) := first_name;
DBMS_LDAP.populate_mod_array(emp_array,DBMS_LDAP.MOD_ADD,'cn',emp_vals);
DBMS_LDAP.populate_mod_array(emp_array,DBMS_LDAP.MOD_ADD,'givenname',emp_vals);
DBMS_LDAP.populate_mod_array(emp_array,DBMS_LDAP.MOD_ADD,'uid',emp_vals);
emp_vals(1) := last_name;
DBMS_LDAP.populate_mod_array(emp_array,DBMS_LDAP.MOD_ADD,'sn',emp_vals);
emp_vals(1) := employeenumber;
DBMS_LDAP.populate_mod_array(emp_array,DBMS_LDAP.MOD_ADD,'employeenumber',emp_vals);
emp_vals(1) := description;
DBMS_LDAP.populate_mod_array(emp_array,DBMS_LDAP.MOD_ADD,'description',emp_vals);
emp_vals(1) := 'top';
emp_vals(2) := 'person';
emp_vals(3) := 'organizationalPerson';
emp_vals(4) := 'inetOrgPerson';
emp_vals(5) := 'orcluser';
emp_vals(6) := 'orcluserv2';
DBMS_LDAP.populate_mod_array(emp_array,DBMS_LDAP.MOD_ADD,'objectclass',emp_vals);
emp_vals.DELETE;
emp_vals(1) := email;
DBMS_LDAP.populate_mod_array(emp_array,DBMS_LDAP.MOD_ADD,'mail',emp_vals);
emp_vals(1) := password;
DBMS_LDAP.populate_mod_array(emp_array,DBMS_LDAP.MOD_ADD,'userPassword',emp_vals);
emp_dn := 'cn=' || first_name || ',' || ldap_base ;
retval := DBMS_LDAP.add_s(emp_session,emp_dn,emp_array);
DBMS_LDAP.free_mod_array(emp_array);
retval := DBMS_LDAP.unbind_s(emp_session);
-- Handle Exceptions
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE(' Error code : ' || TO_CHAR(SQLCODE));
DBMS_OUTPUT.PUT_LINE(' Error Message : ' || SQLERRM);
DBMS_OUTPUT.PUT_LINE(' Exception encountered .. exiting');
end Create_User;
create or replace
procedure Add_User_To_Group(user_name IN VARCHAR2
,group_name IN VARCHAR2
is
retval PLS_INTEGER;
ldap_host VARCHAR2(256);
ldap_port VARCHAR2(256);
ldap_user VARCHAR2(256);
ldap_passwd VARCHAR2(256);
ldap_base VARCHAR2(256);
my_session DBMS_LDAP.session;
my_message DBMS_LDAP.message;
my_entry DBMS_LDAP.message;
my_array DBMS_LDAP.MOD_ARRAY;
my_vals DBMS_LDAP.STRING_COLLECTION ;
group_dn VARCHAR2(256);
user_dn VARCHAR2(256);
BEGIN
retval := -1;
ldap_host := '<you_host>';
ldap_port := '4032';
ldap_user := 'cn=orcladmin';
ldap_passwd:= '<orcladmin_password>';
ldap_base := 'cn=users,dc=<your_compani_name>,dc=com';
DBMS_LDAP.USE_EXCEPTION := TRUE;
my_session := DBMS_LDAP.init(ldap_host, ldap_port);
-- Bind to the directory
retval := DBMS_LDAP.simple_bind_s(my_session,ldap_user, ldap_passwd);
--Find the user
my_vals(1) := '1.1';
retval := DBMS_LDAP.search_s(my_session,
ldap_base,
DBMS_LDAP.SCOPE_SUBTREE,
'(&(objectClass=person)(cn=' || user_name || '))',
my_vals,
0,
my_message);
my_entry := DBMS_LDAP.first_entry(my_session, my_message);
IF my_entry IS NOT NULL THEN
user_dn := DBMS_LDAP.get_dn(my_session, my_entry);
retval := DBMS_LDAP.search_s(my_session,
ldap_base,
DBMS_LDAP.SCOPE_SUBTREE,
'(&(objectClass=orclGroup)(cn=' || group_name ||'))',
my_vals,
0,
my_message);
my_entry := DBMS_LDAP.first_entry(my_session, my_message);
IF my_entry IS NOT NULL THEN
group_dn := DBMS_LDAP.get_dn(my_session, my_entry);
my_array := DBMS_LDAP.create_mod_array(1);
my_vals(1) := user_dn;
DBMS_LDAP.populate_mod_array(my_array, DBMS_LDAP.MOD_ADD, 'uniqueMember', my_vals);
retval := DBMS_LDAP.modify_s(my_session, group_dn, my_array);
DBMS_OUTPUT.PUT_LINE(RPAD('modify_s Returns ',25,' ') || ': '|| TO_CHAR(retval));
DBMS_LDAP.free_mod_array(my_array);
END IF;
END IF;
my_vals.DELETE;
retval := DBMS_LDAP.unbind_s(my_session);
-- Handle Exceptions
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE(' Error code : ' || TO_CHAR(SQLCODE));
DBMS_OUTPUT.PUT_LINE(' Error Message : ' || SQLERRM);
DBMS_OUTPUT.PUT_LINE(' Exception encountered .. exiting');
end Add_User_To_Group;

Similar Messages

  • Error when trying to give permissions to users and adding them to the site

    Hi,
    i'm facing an issue with a public website (SharePoint server 2010) where i can't add any users (windows users) or grant permission for them.
    I checked the Authentication Provider for the web application and Windows Authentication NTLM is enabled, the IIS also enable windows authentication for that site. 
    the issue happens when i go to Site Action --> Site Permission --> Grant Permissions --> I select users after searching for them and once i click OK Exception is appearing. 
    I check the logs and all i found is:
    10/12/2014 12:16:15.84 w3wp.exe (0x07C8)                       0x0AA0 SharePoint Server             Logging Correlation Data       9gc5 Verbose Thread change; resetting trace level override to 0; resetting correlation to a17a120f-ebf7-4de7-aeb4-91c0ae7be28e d07aff74-632e-4bfe-93d0-415b93f53f6a a17a120f-ebf7-4de7-aeb4-91c0ae7be28e
    Note that this happen all of sudden, i was able to add users / groups, users to groups, grant permissions directly but no i can't do none
    My website is grating permissions also for Anonymous users and it's working fine
    This is production server site so i can't try lots of options unless i'm sure of them
    Event viewer is not capturing any error 
    Please help

    This could be browser issue, please try adding site in trusted site in browser or try to some other browser like Chrome/Mozilla.
    I have faced this issue when I try to access site from server in IE, it get failed on "OK"  when adding user.
    I hope this I will help you
    If my contribution helps you, please click Mark As Answer on that post and
    Vote as Helpful
    Thanks, ShankarSingh(MCP)

  • Create users and assigning them security on the Entity dimension

    Hi All,
    I’m working with Hyperion ESSBASE 11.1.1.3 and Hyperion Planning 11.1.1.3 and I have a problem related to create new users (without admin permissions) and assigning them security on the Entity dimension.
    When I access with these users to a Dataform in Planning appears these message:
    “Security and/or filtering has resulted in a required dimension not being represented on this data form”
    I have followed these steps:
    - I have created new users (Native Directory) and provision them against essbase and the planning application in Shared Services.
    - I have expanded the essbase server > security > refresh security from shared services > all users.
    - I have assigned security roles in all members of Entity dimension in Planning.
    - I have refreshed database and security filters in Planning.
    Please help
    Thanks a lot in advance

    Hi,
    You will have to apply security to all the standard dimensions and not just entity, so that will be account, entity, scenario and version.
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Creating shapes and adding them to canvas

    hi all
    How can we create shapes in flex..add them into a canvas i found code that used sprite but was unable to add .as it not being a uicomponent?

    You need to wrap your sprite in a UIComponent. Accessing rawChildren can be dangerous.
    var mySprite:Sprite = new Sprite();
    mySprite.graphics.beginFill(0xFFCC00);
    mySprite.graphics.drawCircle(30, 30, 30);
    var uic:UIComponent = new UIComponent();
    uic.addChild(mySprite);
    this.addChild(uic);
    If this post answers your question or helps, please mark it as such.
    Greg Lafrance
    www.ChikaraDev.com
    Flex Development and Support Services

  • Script to Create User and Add profiles

    Instead of using the ODI 10g GUI Console to create users and add them to a profile, Can this task be achieved by scripting ? Either by wlst or JMX or Java Packages ? Please advise and guide me.
    -Thanks,

    Is there any other way for adding Bulk users and assigning them to a profile? Any thoughts Please
    Versions: 10.1.3.5 and 10.1.3.6

  • How to create mass users and map them to existing  hrms users

    Hi,
    Im running oracle ebusiness suite 12i . I want to create mass users , and map them to existing hrms users.
    The users I want to create exist in an excel spreadsheet with the columns employee id, user name. They will all be granted the same responsibility. I want to map them to existing hrms users using the employee id key.
    I have read about the package FND_USER_PKG.CREATEUSER and I can loop over it by using sql loader to create a temporary table, but I m lost on how to automatically map them to hrms users as part of the script.
    Any help.
    dula

    Thanks a lot Omka,
    I managed to create the users by running the script:
    declare
    Cursor C1 is
    select d.product_code,b.responsibility_key from FND_USER_RESP_GROUPS_ALL a,fnd_responsibility b,fnd_user c,fnd_application d
    where a.user_id = c.user_id
    and a.responsibility_id = b.responsibility_id
    and b.application_id = d.application_id
    and c.user_name ='JOCHIENG';
    Cursor employee is
    SELECT EMPLOYEE_ID,EMPLOYEE_NAME from eldoret_final;
    BEGIN
    for e in employee loop
    fnd_user_pkg.createuser
    x_user_name => e.EMPLOYEE_NAME
    *,x_owner => ''*
    *,x_unencrypted_password => 'welcome123'*
    *,x_start_date => SYSDATE - 10*
    *,x_end_date => NULL*
    *,x_description => 'CBK Employee'*
    *,X_EMPLOYEE_ID => e.EMPLOYEE_ID*
    fnd_user_pkg.addresp(upper (e.EMPLOYEE_NAME),'PER', 'CBK_EMPLOYEE_DIRECT_ACCESS','STANDARD', 'DESCRIPTION', sysdate, null);
    end loop;
    commit;
    end;
    I had first created the user JOCHIENG and assigned it the responsibility for Self service. So the script just assigns the responsibilities by copying from the one assgined to this user.
    Everything seems ok. However, when trying to log in as the new user, the login error: Login failed. Please verify your login information or contact the system administrator.
    is returned. But I can reset the password using the forms under Security > Define. Even with the correct password, the login doesn't go through.
    Any idea?
    dula

  • Creating users and groups

    Hi all,
    I have about 100 users and many groups.
    How can i create users and groups quickly?
    Appreciate any help

    Like the way you export planning application to file system and use it as a source to migrate it, In the same way take shared services file system export in the file system and migrate it to the new environment.
    Cheers..!!!
    Rahul S.

  • How to create users and groups using WLST Offline with Weblogic 8.1.4

    How to create users and groups using WLST Offline with Weblogic 8.1.4?
    Any ideas?

    Hi this is how i created a user using WLST Offline?
    cd('/Security/' + domainName)
    # Delete the default user name weblogic
    # incase you want to remove the defualt user weblogic
    delete('weblogic','User')
    # Creating a new user defined
    create(userName, 'User')
    # Setting the password of the user you created.
    cd ('/Security/' + domainName + '/User/' + userName)
    cmo.setPassword(password)
    Regards
    Makenzo

  • I have a windows computer. How can I create apps and put them on itunes?

    I have a windows computer. How can I create apps and put them on itunes?

    You can't. The iOS SDK requires Mac OS X and an Intel Mac; Windows applications can't be put on either the iOS or Mac OS X App Stores.
    (82889)

  • How to create User and Database in different Table spaces

    How to create User and Database in different Table spaces using oracle 10g
    Regards
    daya

    I am sorry but your question does not seem to make much sense.
    Can you please rephrase your question?

  • Need a help to create user and assign BP to it

    Hi,
    I have requirement to create Users (like SU01) in CRM and for that users need to create BP with role EMPLOYEE and assign BP to that USER.
    Can anybody please help on which Function Module I need to use to create user and assign BP to it.
    Thanks in advance..
    Sushant

    Hi,
    Many post post are there for your query in SDN search if my below shown link is not helpful.
    Hope the below will help you.
    Users Created ...
    Cheers!!
    VEnk@

  • Create users under Administration Server Create user and Refresh users options are disabled

    We have installed and configured 11.1.2.2 successfully, Essbase in standalone mode.
    When we try to create users under Administration Server Create user and Refresh users options are disabled. Please let me know how to create EAS users?
    Thanks,
    Satheesh.

    Please find below response.
    1.You can create users from EAS console using maxl, if you have not externalized the users .
    When we create using Maxl it will create for 'ESSBASE Servers' users but we want to create additional administrator users under 'Administrator Services' --> 'Users'. At the moment default 'Admin' users is created under 'Administrator Services' --> 'Users'.
    2.  you have installed your essbase in a stand -alone mode  , then the option of creating users will be enabled and you can give appropriate provision to applications.
    Yes. But the create users is disable for Admin.
    3. Through which url are you accessing EAS console is it http://Servername:19000/workspace/index.jsp ?
    http://prod-server:10080/easconsole/console.html
    Please suggest.

  • How to find all the SM37/36 jobs, created user and step user details

    Hi Gurus,
    Is there any table or transaction is available to check all the SM37/36 jobs that are running in the system, details of created user and step user in single screen?.
    Regards,
    Srinivas

    Check the below tables
    TBTCP                          Background Job Step Overview
    TBTCO                         Job Status Overview Table
    TBTCJSTEP                 Background Job Step Overview
    TBTC_SPOOLID                   Background Processing Spool IDs Table
    TBTCS                          Background Processing: Time Schedule Table

  • How do I create variables and store them?

    How do I create variables and store them?

    As someone already said, we need to know a little more about what you want to do with these variables, but in general, APEX Items are probably what you want. You can create APEX Items at the Application or Page level. Once you set the value of an item, you can reference it anywhere else in the application. So, if you have an item on page 1 called P1_ENAME, you can reference it on page 32 using bind variable syntax :P1_ENAME. If you just want to store but not display some information, you can use either a hidden page item or an Application Level item. Take a look at the 2 Day Developers Guide for more info.
    Tyler

  • OIM11gR2 - API - how to create accounts and link them to an oim user

    hi,
    my problem is the following:  I would like to import a lot(1000+) of different service accounts to my oim system and link them to oim users.
    at the moment, the information which service-account belongs to which person is stored in a textfile.
    I use this API code to create accounts:
    ProvisioningService service=getClient().getService(ProvisioningService.class);
    ApplicationInstanceService service=getClient().getService(ApplicationInstanceService.class);
    ApplicationInstance appInstance=service.findApplicationInstanceByName("LinuxServer001");
    FormInfo formInfo=appInstance.getAccountForm();
    String formKey=String.valueOf(formInfo.getFormKey());
    AccountData accountData=new AccountData(formKey,null,null);
    Account account=new Account(appInstance,accountData);
    account.setAccountType(Account.ACCOUNT_TYPE.Primary);       
    service.provision(userKey, account);
    this works fine! the account is displayed in the section  "user accounts", but the status of the created account is "Provisioning".
    when I reconcile this linux server, oim doesn't establish a link between the service account on the target system and the created account! why?
    how can i solve my problem? which information is missing, to establish a link between an existing account on a target system and an api created account?
    thank you!
    br,
    max

    Thanks, Brian, for your support! - It's working.
    It's hard to understand why NI did not pass this parameter to the top of the call chain...
    I also needed some time to understand the syntax of the string passed to the subaddress node:
    The name of the worksheet needs to be framed by single quotation marks and the following cell address must preceeded by an exclamation point (!).
    A working link pointing to cell "A1" of "Worksheet 1" looks like:
    'Worksheet 1'!A1
    Maybe also of interest: If you want to point the link to a worksheet inside the document itself, the parameter "address" (URL of link - href) can be left empty.
    Thanks and Regards,
    Ingo

Maybe you are looking for