Common Functions

This section discusses the common functions used to reference a password data store.

Syntax

InsertUpdateUsrNamePsswd(URL_ID, EO_PE_USER_NAME, EO_PE_PASSWORD)

Description

InsertUpdateUsrNamePsswd takes the URL identifier (URL_ID) and the portal user ID (PRTL_USER_ID) and searches the table for an entry that already exists. If an entry exists, an update is performed; if no entry exists, a new entry is inserted.

The values for the user ID (EO_PE_USER_NAME) and password (EO_PE_PASSWORD) that are associated with the URL_ID and PRTL_USER_ID are encrypted when placed in the table.

This is the technical design in PeopleCode:

Function InsertUpdateUsrNamePsswd(&URL_ID, &EO_PE_USER_NAME, &EO_PE_PASSWORD)

   &found = "";
      
   &PRTL_USER_ID = %UserId;
       
   &EO_PE_USER_NAME = Encrypt("", &EO_PE_USER_NAME);
      &EO_PE_PASSWORD = Encrypt("", &EO_PE_PASSWORD);
    
   SQLExec("select EO_PE_USER_NAME from PS_EO_PE_SS_LOGIN 
   where URL_ID = :1 and PRTL_USER_ID = :2", &URL_ID, &PRTL_USER_ID,
   &found);
      

   If &found = "" Then
   SQLExec("INSERT INTO PS_EO_PE_SS_LOGIN( URL_ID, PRTL_USER_ID, 
   EO_PE_USER_NAME, EO_PE_PASSWORD) values(:1, :2, :3, :4)",
   &URL_ID, &PRTL_USER_ID, &EO_PE_USER_NAME, &EO_PE_PASSWORD);
   Else
   SQLExec("UPDATE PS_EO_PE_SS_LOGIN SET EO_PE_USER_NAME = :1, 
   EO_PE_PASSWORD = :2 WHERE URL_ID = :3 AND PRTL_USER_ID = :4", 
   &EO_PE_USER_NAME, &EO_PE_PASSWORD, &URL_ID, &PRTL_USER_ID);
   End-If;

End-Function;

Parameters

Parameter

Description

URL_ID

URL identifier.

EO_PE_USER_NAME

User name that is needed to access the account that is referenced by the URL_ID.

EO_PE_PASSWORD

Password that is associated with the EO_PE_USER_NAME.

Returns

The function returns no value.

Example

In this example, the function is used with hardcoded values. In most cases, variables are used as parameters.

InsertUpdateUsrNamePsswd("Yahoo_Mail_Account", "Name", "Password");

Name and password are encrypted and placed in the table. The table appears as follows:

URL_ID

PRTL_USER_ID

EO_PE_USER_NAME

EO_PE_PASSWORD

Yahoo_Mail_Account

Portal Login Name

ASDFG#$%MDSF

ASKDKFJ@W#$RFGMS

Syntax

GetUsrNamePsswd(URL_ID, EO_PE_USER_NAME, EO_PE_PASSWORD);

Description

GetUsrNamePsswd takes the URL_ID and PRTL_USER_ID and searches the table for the associated EO_PE_USER_ID and EO_PE_PASSWORD. GetUsrNamePsswd decrypts EO_PE_USER_ID and EO_PE_PASSWORD. The decrypted user ID and password are passed back.

This is the technical design in PeopleCode:

Function GetUsrNamePsswd(&URL_ID, &EO_PE_USER_NAME, &EO_PE_PASSWORD)
   
   &PRTL_USER_ID = %UserId;
     
   SQLExec("select EO_PE_USER_NAME, EO_PE_PASSWORD from  
   PS_EO_PE_SS_LOGIN where URL_ID = :1, and PRTL_USER_ID = :2", 
   &URL_ID, &PRTL_USER_ID, &EO_PE_USER_NAME, &EO_PE_PASSWORD);

   &EO_PE_USER_NAME = Decrypt("", &EO_PE_USER_NAME);
   &EO_PE_PASSWORD = Decrypt("", &EO_PE_PASSWORD);

End-Function;

Parameters

Parameter

Description

URL_ID

URL identifier.

EO_PE_USER_NAME

Empty variable that is used to store the value for the user name that is associated with the URL_ID.

The decrypted value can be retrieved from the function without using a return.

EO_PE_PASSWORD

Empty variable that is used to store the value for the password that is associated with the URL_ID.

The decrypted value can be retrieved from the function without using a return.

Returns

The function returns no value.

Example

The value for URL_ID is hardcoded. Usually, this parameter is a variable.

&UserName = "";

&Password = "";

GetUsrNamePsswd("Yahoo_Mail_Account", UserName, Password);

Syntax

DeleteUsrNamePsswd(&URL_ID);

Description

DeleteUsrNamePsswd deletes entries in the table by searching with the URL_ID and the PRTL_USER_ID and removing those items when it finds a match.

This is the technical design in PeopleCode:

Function DeleteUsrNamePsswd(&URL_ID)

   &PRTL_USER_ID = %UserId;
   
         
   SQLExec("Delete from PS_EO_PE_SS_LOGIN Where URL_ID = :1 and 
   PRTL_USER_ID = :2", &URL_ID, &PRTL_USER_ID);
   
End-Function;

Parameters

Parameter

Description

URL_ID

URL identifier.

Returns

The function returns no value.

Example

In this example, the value for URL_ID is hardcoded. Usually, this parameter is a variable.

DeleteUsrNamePsswd("Yahoo_Mail_Account");