Project and Portfolio Management Practitioners Forum
cancel
Showing results for 
Search instead for 
Did you mean: 

How can I import users to knta_users table from knta_users_int with programmatically

Highlighted
Hbaltuntel
Acclaimed Contributor

How can I import users to knta_users table from knta_users_int with programmatically

Hi All

 

I am doing a web application to create user for ppm without workbench. I have added a user to knta_users_int. I have to add security groups for the user but knta_user_security table need user_id from knta_users.

 

I can run import users report manually but I must do it with programmatically.

 

Is there any store procedure or job to import data knta_users from knta_users_int.

 

Or how can I run a report in code.

 

Thank you for your helps

5 REPLIES
Jim Esler
Honored Contributor

Re: How can I import users to knta_users table from knta_users_int with programmatically

We have the Import Users report scheduled to run periodically (every 2 hours). We have one report scheduled to import new users and another report scheduled to add and drop security groups for registered users.  This results in a delay of up to 2 hours before the changes are made but it works. Note that before 9.14 there was a bug that would cause the reports to hang if more than one instance of the Import Users report was started at the same time.

Oscar_Pereira
Frequent Visitor

Re: How can I import users to knta_users table from knta_users_int with programmatically

Hi,

 

The report uses the package KNTA_USER_INT.  You can check the logic behind that package to see how the report works and populates the knta_users table.

 

I have two questions so we all can get a better idea on the requirement:

 

1-Are you going to use LDAP integration at all?   

2-Is the requirement only to import a high number of users to knta_users? 

 

Regards

Oscar Pereira

Hbaltuntel
Acclaimed Contributor

Re: How can I import users to knta_users table from knta_users_int with programmatically

Hi Oscar,

 

Yes I am going to use LDAP integration and the program should add users to knta_users table, one by one.

Hbaltuntel
Acclaimed Contributor

Re: How can I import users to knta_users table from knta_users_int with programmatically

This is so limited. I can not say the program users "add user wait 2 hours and add security groups"

The solution would be like this,
1) add users to knta_users_int
2) run import users report or job or sp to import knta_users with progammatically
3) add security groups to knta_user_security
jsalass
Frequent Visitor

Re: How can I import users to knta_users table from knta_users_int with programmatically

Hi Hbaltuntel,

 

Basically, the report uses the following package to import users fron the INT tables to PPM:

 

<ppm_schema_name>.KNTA_USER_INT

 

First just check if the values are correct:

 

ksc_run_plsql_procedure KNTA_USER_INT.Run_Derive_And_Validate    

 

These are the parameters needed to run:


p_group_id.INTEGER.INOUT=[TEMP_GrOUP_ID]    
p_run_import.VARCHAR.IN=[P.P_RUN_IMPORT]    
p_keep_ids.VARCHAR.IN=N    
p_seed_data.VARCHAR.IN=N    
p_overwrite.VARCHAR.IN=Y    
p_run_user_security.VARCHAR.IN=Y    
p_source_type_code.VARCHAR.IN=[P.P_SOURCE_CODE]    
p_user_id.INTEGER.IN=[RP.CREATED_BY]    
p_username.VARCHAR.IN=[RP.CREATED_BY_USERNAME]    
p_products.VARCHAR.IN=[P.P_PRODUCT_LICENSES]    
p_disable_users.VARCHAR.IN=[P.P_DISABLE_USERS]    
p_security_groups.VARCHAR.IN=[P.P_SECURITY_GROUPS]    
p_user_security_action.VARCHAR.IN=[P.P_USER_SECURITY_ACTION]    
p_add_missing_sec_grp.VARCHAR.IN=[P.P_ADD_SECURITY_GROUP]    
p_keep_existing_values.VARCHAR.IN=[P.P_KEEP_EXISTING_VALUES]    
p_region_id.INTEGER.IN=[P.P_REGION]    
o_message_type.INTEGER.OUT    
o_message_name.VARCHAR.OUT    
o_message.VARCHAR.OUT    

And then  it starts theimport process

ksc_run_plsql_procedure KNTA_USER_INT.Run_Import


p_group_id.INTEGER.INOUT=[TEMP_GROUP_ID]
p_run_import.VARCHAR.IN=[P.P_RUN_IMPORT]
p_keep_ids.VARCHAR.IN=N
p_seed_data.VARCHAR.IN=N
p_overwrite.VARCHAR.IN=Y
p_run_user_security.VARCHAR.IN=Y
p_source_type_code.VARCHAR.IN=[P.P_SOURCE_CODE]
p_user_id.INTEGER.IN=[RP.CREATED_BY]
p_username.VARCHAR.IN=[RP.CREATED_BY_USERNAME]
p_products.VARCHAR.IN=[P.P_PRODUCT_LICENSES]
p_disable_users.VARCHAR.IN=[P.P_DISABLE_USERS]
p_security_groups.VARCHAR.IN=[P.P_SECURITY_GROUPS]
p_user_security_action.VARCHAR.IN=[P.P_USER_SECURITY_ACTION]
p_add_missing_sec_grp.VARCHAR.IN=[P.P_ADD_SECURITY_GROUP]
p_keep_existing_values.VARCHAR.IN=[P.P_KEEP_EXISTING_VALUES]
p_region_id.INTEGER.IN=[P.P_REGION]
p_license_action.VARCHAR.IN=[P.P_LICENSE_ACTION]
o_message_type.INTEGER.OUT
o_message_name.VARCHAR.OUT
o_message.VARCHAR.OUT
ksc_end_plsql_parameters
ksc_run_jsp_report /web/knta/sc/rpt/ImportUsers.jsp
REPORT_ID=[RP.REPORT_SUBMISSION_ID]
USER_ID=[RP.CREATED_BY]
OUT_BASEFILE=[RP.FILENAME]

Finally it is important to execute the kRunCacheManager.sh A comamnd to fluse the cache and see the changes in PPM.

 

So, you can populate the INT tables in your QA/DEV instances and then call those procedures in the package and pass the information you populated.

 

Hope this helps.

 

Regards,

Jonathan

//Add this to "OnDomLoad" event