EssSetUserToSS

Migrates a user to EPM System security mode. This might be useful if the user migration failed using EssSetSSSecurityMode.

Syntax

ESS_FUNC_M EssSetUserToSS (hCtx, UserName, option, NewPassword, FileName, flag);
ParameterData TypeDescription

hCtx

ESS_HCTX_T

API context handle.

UserName

ESS_STR_T

Name of the user to convert to Shared Services (input).

option

ESS_USHORT_T

Integer representing the desired password creation method for migrated users.

  • 0—Use an administrator-specified password.

  • 1—Create passwords that are the same as user names for users being migrated to Shared Services.

    Note:

    The passwords are created as lower-case, even if there are upper-case letters in the user name.

  • 2—Automatically generate new passwords for the users being migrated to Shared Services.

NewPassword

ESS_STR_T

Password string (if option 2 is used).

FileName

ESS_STR_T

Name of file to contain saved passwords. If not provided, the default file is $ARBORPATH/bin/MigratedUsersPassword.txt.

flag

ESS_USHORT_T

Whether the passwords file, if already existing, should be overwritten.

  • ESS_FILE_OVERWRITE—Overwrite

  • ESS_FILE_NOOVERWRITE—Do not overwrite; return an error.

Return Value

Returns 0 if successful; otherwise, returns an error.

Access

This function requires the caller to be an Administrator.

Example

ESS_FUNC_M ESS_SS_SetUserToSS(ESS_HCTX_T  hCtx, ESS_HINST_T hInst)
{
   ESS_STS_T         sts = ESS_STS_NOERR;
   ESS_USHORT_T      option;
   ESS_STR_T         userName = ESS_NULL;
   ESS_STR_T         newpassword = ESS_NULL;
   ESS_STR_T         fName = ESS_NULL;
   ESS_USHORT_T      flag = ESS_FILE_OVERWRITE;
   
   sts = EssAlloc(hInst, sizeof(ESS_USERNAME_T), &userName);
   if(sts)
      return (sts);        
   memset(userName, 0, sizeof(ESS_USERNAME_T));
   strcpy( userName, "essexer");

   /* New Shared Services Native User Password Option: 
    * 
    * 0 to use user provided password 
    * 1 to use the user name as password 
    * 2 to automatically generate a password 
    **/

   option = 2; /* Generate password */

   sts = EssSetUserToSS(hCtx, userName, option, newpassword, fName, flag);

   if(sts)
      printf("Failed to migrate User %s to Shared Services mode.\n", userName);    

   if (userName)
      EssFree(hInst, userName);

   return (sts);   
}

See also an extended Shared Services Migration and User Management API Example

See Also