Gets a list of user or group application access structures, which contain information about user or group access to applications. Similar to EssGetApplicationAccess, but can accept a user directory specification or unique identity attribute for UserID.
Syntax
ESS_FUNC_M EssGetApplicationAccessEx (hCtx, UserId, bIsIdentity, type, AppName, pCount, ppUserApp);
Parameter | Data Type | Description |
---|---|---|
hCtx | ESS_HCTX_T | API context handle (input). |
UserId | ESS_STR_T | User or group name (input). Can be specified as name@provider or as a unique identity attribute. If NULL, lists all users or groups for the specified application. |
bIsIdentity | ESS_BOOL_T | Input. Indicates if UserID is a name or an identity. If TRUE, UserID is an identity. |
type | ESS_USHORT_T | Type of entity (input). Indicates if UserID is a group or a user. Can be one of the following:
|
AppName | ESS_STR_T | Application name (input). If NULL, lists all applications for the specified user. |
pCount | ESS_PUSHORT_T | Address of variable to receive count of user application structures (output). |
ppUserApp | ESS_PPUSERAPPEX_T | Address of pointer to receive an allocated array of user application structures (output). The user application structure can include user directories and unique identity attributes. |
Notes
If UserID 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, UserID 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().
Return Value
If successful, returns a count of users/applications in pCount, and a list of user application structures in ppUserApp.
Access
This function requires callers to have application designer privilege (ESS_PRIV_APPDESIGN) for the specified application, unless they are getting their own application access information.
Example
void DisplayUserAppInfo(ESS_PUSERAPPEX_T userApp, ESS_USHORT_T count) { ESS_STS_T sts = ESS_STS_NOERR; ESS_USHORT_T ind; printf ("\n------Application Access List----\n\n"); for (ind = 0; ind < count; ind++) { printf("\tUser: %s\n", userApp[ind].UserName); printf("\tProvider Name: %s\n", userApp[ind].ProviderName); printf("\tConnection Param: %s\n", userApp[ind].connparam); printf("\tAppName: %s\n", userApp[ind].AppName); switch(userApp[ind].Access) { case ESS_PRIV_NONE: printf("\tAccess: %d - ESS_PRIV_NONE\n", userApp[ind].Access); break; case ESS_PRIV_READ: printf("\tAccess: %d - ESS_PRIV_READ\n", userApp[ind].Access); break; case ESS_PRIV_WRITE: printf("\tAccess: %d - ESS_PRIV_WRITE\n", userApp[ind].Access); break; case ESS_PRIV_CALC: printf("\tAccess: %d - ESS_PRIV_CALC\n", userApp[ind].Access); break; case ESS_PRIV_METAREAD: printf("\tAccess: %d - ESS_PRIV_METAREAD\n", userApp[ind].Access); break; case ESS_PRIV_DBLOAD: printf("\tAccess: %d - ESS_PRIV_DBLOAD\n", userApp[ind].Access); break; case ESS_PRIV_DBMANAGE: printf("\tAccess: %d - ESS_PRIV_DBMANAGE\n", userApp[ind].Access); break; case ESS_PRIV_DBCREATE: printf("\tAccess: %d - ESS_PRIV_DBCREATE\n", userApp[ind].Access); break; case ESS_PRIV_APPLOAD: printf("\tAccess: %d - ESS_PRIV_APPLOAD\n", userApp[ind].Access); break; case ESS_PRIV_APPMANAGE: printf("\tAccess: %d - ESS_PRIV_APPMANAGE\n", userApp[ind].Access); break; case ESS_PRIV_APPCREATE: printf("\tAccess: %d - ESS_PRIV_APPCREATE\n", userApp[ind].Access); break; case ESS_PRIV_USERCREATE: printf("\tAccess: %d - ESS_PRIV_USERCREATE\n", userApp[ind].Access); break; case ESS_ACCESS_READ: printf("\tAccess: %d - ESS_ACCESS_READ\n", userApp[ind].Access); break; case ESS_ACCESS_WRITE: printf("\tAccess: %d - ESS_ACCESS_WRITE\n", userApp[ind].Access); break; case ESS_ACCESS_CALC: printf("\tAccess: %d - ESS_ACCESS_CALC\n", userApp[ind].Access); break; case ESS_ACCESS_METAREAD: printf("\tAccess: %d - ESS_ACCESS_METAREAD\n", userApp[ind].Access); break; case ESS_ACCESS_DBMANAGE: printf("\tAccess: %d - ESS_ACCESS_DBMANAGE\n", userApp[ind].Access); break; case ESS_ACCESS_DBCREATE: printf("\tAccess: %d - ESS_ACCESS_DBCREATE\n", userApp[ind].Access); break; case ESS_ACCESS_APPMANAGE: printf("\tAccess: %d - ESS_ACCESS_APPMANAGE\n", userApp[ind].Access); break; case ESS_ACCESS_APPCREATE: printf("\tAccess: %d - ESS_ACCESS_APPCREATE\n", userApp[ind].Access); break; case ESS_ACCESS_FILTER: printf("\tAccess: %d - ESS_ACCESS_FILTER\n", userApp[ind].Access); break; case ESS_ACCESS_DBALL: printf("\tAccess: %d - ESS_ACCESS_DBALL\n", userApp[ind].Access); break; case ESS_ACCESS_APPALL: printf("\tAccess: %d - ESS_ACCESS_APPALL\n", userApp[ind].Access); break; case ESS_ACCESS_ADMIN: printf("\tAccess: %d - ESS_ACCESS_ADMIN\n", userApp[ind].Access); break; default: printf("\tAccess: Unknown\n"); } switch(userApp[ind].MaxAccess) { case ESS_PRIV_NONE: printf("\tMax Access: %d - ESS_PRIV_NONE\n", userApp[ind].MaxAccess); break; case ESS_PRIV_READ: printf("\tMax Access: %d - ESS_PRIV_READ\n", userApp[ind].MaxAccess); break; case ESS_PRIV_WRITE: printf("\tMax Access: %d - ESS_PRIV_WRITE\n", userApp[ind].MaxAccess); break; case ESS_PRIV_CALC: printf("\tMax Access: %d - ESS_PRIV_CALC\n", userApp[ind].MaxAccess); break; case ESS_PRIV_METAREAD: printf("\tMax Access: %d - ESS_PRIV_METAREAD\n", userApp[ind].MaxAccess); break; case ESS_PRIV_DBLOAD: printf("\tMax Access: %d - ESS_PRIV_DBLOAD\n", userApp[ind].MaxAccess); break; case ESS_PRIV_DBMANAGE: printf("\tMax Access: %d - ESS_PRIV_DBMANAGE\n", userApp[ind].MaxAccess); break; case ESS_PRIV_DBCREATE: printf("\tMax Access: %d - ESS_PRIV_DBCREATE\n", userApp[ind].MaxAccess); break; case ESS_PRIV_APPLOAD: printf("\tMax Access: %d - ESS_PRIV_APPLOAD\n", userApp[ind].MaxAccess); break; case ESS_PRIV_APPMANAGE: printf("\tMax Access: %d - ESS_PRIV_APPMANAGE\n", userApp[ind].MaxAccess); break; case ESS_PRIV_APPCREATE: printf("\tMax Access: %d - ESS_PRIV_APPCREATE\n", userApp[ind].MaxAccess); break; case ESS_PRIV_USERCREATE: printf("\tMax Access: %d - ESS_PRIV_USERCREATE\n", userApp[ind].MaxAccess); break; case ESS_ACCESS_READ: printf("\tMax Access: %d - ESS_ACCESS_READ\n", userApp[ind].MaxAccess); break; case ESS_ACCESS_WRITE: printf("\tMax Access: %d - ESS_ACCESS_WRITE\n", userApp[ind].MaxAccess); break; case ESS_ACCESS_CALC: printf("\tMax Access: %d - ESS_ACCESS_CALC\n", userApp[ind].MaxAccess); break; case ESS_ACCESS_METAREAD: printf("\tMax Access: %d - ESS_ACCESS_METAREAD\n", userApp[ind].MaxAccess); break; case ESS_ACCESS_DBMANAGE: printf("\tMax Access: %d - ESS_ACCESS_DBMANAGE\n", userApp[ind].MaxAccess); break; case ESS_ACCESS_DBCREATE: printf("\tMax Access: %d - ESS_ACCESS_DBCREATE\n", userApp[ind].MaxAccess); break; case ESS_ACCESS_APPMANAGE: printf("\tMax Access: %d - ESS_ACCESS_APPMANAGE\n", userApp[ind].MaxAccess); break; case ESS_ACCESS_APPCREATE: printf("\tMax Access: %d - ESS_ACCESS_APPCREATE\n", userApp[ind].MaxAccess); break; case ESS_ACCESS_FILTER: printf("\tMax Access: %d - ESS_ACCESS_FILTER\n", userApp[ind].MaxAccess); break; case ESS_ACCESS_DBALL: printf("\tMax Access: %d - ESS_ACCESS_DBALL\n", userApp[ind].MaxAccess); break; case ESS_ACCESS_APPALL: printf("\tMax Access: %d - ESS_ACCESS_APPALL\n", userApp[ind].MaxAccess); break; case ESS_ACCESS_ADMIN: printf("\tMax Access: %d - ESS_ACCESS_ADMIN\n", userApp[ind].MaxAccess); break; default: printf("\tMax Access: Unknown\n"); } printf("\n"); } } ESS_FUNC_M ESS_GetApplicationAccessEx (ESS_HCTX_T hCtx, ESS_HINST_T hInst) { ESS_STS_T sts = ESS_STS_NOERR; ESS_STR_T userId; ESS_BOOL_T bIsIdentity; ESS_USHORT_T type; ESS_USHORT_T count = 0; ESS_USERAPPEX_T userApp[2]; ESS_PUSERAPPEX_T pUserApp = ESS_NULL; count = 1; strcpy(userApp[0].UserName, "IDUser1"); strcpy(userApp[0].ProviderName, ""); strcpy(userApp[0].connparam, ""); userApp[0].type = ESS_TYPE_USER; strcpy(userApp[0].AppName, AppName); userApp[0].Access = ESS_PRIV_APPMANAGE; userApp[0].MaxAccess = ESS_PRIV_APPMANAGE; sts = EssSetApplicationAccessEx(hCtx, count, &userApp); printf("EssSetApplicationAccessEx sts: %ld\n", sts); userId = "IDUser1"; AppName = AppName; type = ESS_TYPE_GROUP; bIsIdentity = ESS_FALSE; sts = EssGetApplicationAccessEx(hCtx, userId, bIsIdentity, type, AppName, &count, &pUserApp); printf("EssGetApplicationAccessEx sts: %ld\n", sts); if(!sts) { if(count && pUserApp) { DisplayUserAppInfo(pUserApp, count); sts = EssFree (hInst, pUserApp); } else printf ("\rUser Application list is empty\n\n"); } return (sts); }
See Also