EssSetCalcListEx

Sets the calculation list accessible to the specified user or group. Similar to EssSetCalcList, but includes users and groups hosted in a user directory.

Syntax

ESS_FUNC_M EssSetCalcListEx (hCtx, UserId, bIsIdentity, entityType, AppName, DbName, AllCalc, count, pCalcList);
ParameterData TypeDescription

hCtx

ESS_HCTX_T

API context handle (input).

UserID

ESS_STR_T

Input. User or group for which to set the calculation list. Can be specified as name@provider or as a unique identity attribute.

bIsIdentity

ESS_BOOL_T

Input. Indicates whether UserID is a name or an identity. If TRUE, UserID is an identity.

entityType

ESS_USHORT_T

Input. Type of entity contained in UserID. Can be one of the following:

  • ESS_TYPE_USER

  • ESS_TYPE_GROUP

AppName

ESS_STR_T

Application name (input).

DbName

ESS_STR_T

Database name (input).

AllCalc

ESS_BOOL_T

Allow all calcs flag (input). If TRUE, the user or group can access all calculation scripts; otherwise, only those specified in CalcList are accessible.

Count

ESS_USHORT_T

Count of the number of accessible calculation script objects (input).

pCalcList

ESS_POBJNAME_T

Pointer to an array of accessible calculation script object names (input).

Notes

Return Value

None.

Access

This function requires the caller to have database Design privilege (ESS_PRIV_DBDESIGN) for the specified database.

Example

void GetCalcList(ESS_STR_T userName)
{                          
   ESS_STS_T sts = ESS_STS_NOERR;
   ESS_BOOL_T AllCalcs = ESS_FALSE;
   ESS_USHORT_T Count, ind;            
   ESS_POBJNAME_T pCalcList = NULL;

   sts = EssGetCalcList(hCtx, userName, AppName, DbName, &AllCalcs, &Count, &pCalcList);
   printf("EssGetCalcList sts: %ld\n", sts);
   //sts = EssGetCalcListEx(hCtx, userName, AppName, DbName, &AllCalcs, &Count, &pCalcList);
   //printf("EssGetCalcListEx sts: %ld\n", sts);

   if(AllCalcs)
      printf("\tThis user has access to all script on %s %s\n", AppName, DbName);
   else
   {
      if(!sts && pCalcList)
      {
         printf("-------- Get Calc List -----------\r\n"); 
            for (ind = 0; ind < Count; ind ++)
               printf(" %s\n",pCalcList[ind]);
          
         EssFree(hInst, pCalcList);
      }
   }
}


ESS_FUNC_M ESS_SetCalcListEx (ESS_HCTX_T hCtx)

{
   ESS_STS_T sts = ESS_STS_NOERR;
   ESS_STR_T calcUser;
   ESS_BOOL_T AllCalcs;
   ESS_USHORT_T count;            
   ESS_OBJNAME_T CalcList[2];
   ESS_PUSERINFO_T pUserInfo;
   ESS_BOOL_T bIsIdentity;
   ESS_USHORT_T type;
   ESS_USERDBEX_T userDb[1];
   ESS_PUSERDBEX_T pUserDb = ESS_NULL;

   bIsIdentity = ESS_FALSE;
   type = ESS_TYPE_USER;
   AllCalcs = ESS_FALSE;
   count = 2;
   strcpy(CalcList[0],"calc1");
   strcpy(CalcList[1],"calc2");

   sts = EssSetCalcListEx(hCtx, calcUser, bIsIdentity, type, AppName, DbName, AllCalcs, count, CalcList);
   printf("EssSetCalcListEx sts: %ld\n", sts);
   if(!sts)
      GetCalcList(calcUser);
   
   return (sts);
}

See Also