# EssGetApplicationAccess

Description

EssGetApplicationAccess() gets a list of user application access structures, which contain information about user access to applications.

Syntax

    ESS_FUNC_M EssGetApplicationAccess (hCtx, UserName, AppName, pCount, ppUserApp);

ESS_HCTX_T | hCtx
ESS_STR_T | UserName
ESS_STR_T | AppName
ESS_PUSHORT_T | pCount
ESS_PPUSERAPP_T | ppUserApp

Parameters

hCtx | Essbase API context handle.
UserName | User name. If NULL, lists all users for the specified application.
AppName | Application name. If NULL, lists all applications for the specified user.
pCount | Address of variable to receive count of user application structures.
ppUserApp | Address of pointer to receive an allocated array of user application structures.

Return Value

If successful, returns a count of users/applications in pCount, and a list of user application structures in ppUserApp.

Notes

- If UserName is NULL, all users will be listed for the specified application. If AppName is NULL, all applications will be listed for the specified user. However, UserName and AppName cannot both be NULL
- The Access field of the user application structure is used to represent the user's granted access to the application, whereas the MaxAccess field represents the user's highest access from all sources (e.g. via groups or default application access etc.).
- The memory allocated for ppUserApp should be freed using EssFree().

Access

This function requires the caller to have Application Design privilege (ESS_PRIV_APPDESIGN) for the specified application, unless they are getting their own application access information.

Example

    ESS_FUNC_M
    ESS_GetApplicationAccess (ESS_HCTX_T  hCtx, ESS_HINST_T hInst)
    {
       ESS_FUNC_M       sts = ESS_STS_NOERR;
       ESS_STR_T       UserName;
       ESS_STR_T       AppName;
       ESS_USHORT_T    Count = 0;
       ESS_USHORT_T    ind;
       ESS_PUSERAPP_T  UserApp = NULL;

       UserName = "Admin";
       AppName  = "";

       sts = EssGetApplicationAccess(hCtx, UserName,
             AppName, &Count, &UserApp);
       if(!sts)
       {
          if(Count && UserApp)
          {
             printf ("\n------Application Access List----\n\n");
             for (ind = 0; ind < Count; ind++)
             {
             printf ("User->%s Application->%-10s
                      Access->%-4d MaxAccess->%-6d\r\n",
                      UserApp[ind].UserName,
                      UserApp[ind].AppName,
                      UserApp[ind].Access,
                      UserApp[ind].MaxAccess);
             }
             EssFree (hInst, UserApp);
          }
          else
             printf ("\rUser Application list is empty\n\n");
       }
       return (sts);
    }

See Also

EssGetDatabaseAccess()
EssListUsers()
EssSetApplicationAccess()
EssSetUser()