Gets a list of user database access structures, which contain information about user access to databases.
Syntax
ESS_FUNC_M EssGetDatabaseAccess (hCtx, UserName, AppName, DbName, pCount, ppUserDb);
Parameter | Data Type | Description |
---|---|---|
hCtx | ESS_HCTX_T | API context handle |
UserName | ESS_STR_T | User name. If NULL, lists all users for the specified application and database. |
AppName | ESS_STR_T | Application name. If NULL, lists all applications and databases for the specified user. |
DbName | ESS_STR_T | Databasename. If NULL, lists all databases for the specified user or application. |
pCount | ESS_PUSHORT_T | Address of variable to receive count of user database structures |
ppUserDb | ESS_USERDB_T, ESS_GROUPDB_T | Address of pointer to receive an allocated array of user database structures |
Notes
If any of UserName, AppName, or DbName are NULL, they will be treated as wild cards and all items of the appropriate type will be listed. If AppName is NULL, DbName is assumed to also be NULL. Any two of these arguments may be NULL, but not all three.
The Access field of the user database structure is used to represent the user's granted access to the database, whereas the MaxAccess field represents the user's highest access from all sources (e.g. via groups or default database access etc.).
The memory allocated for ppUserDb should be freed using EssFree().
Filter access privileges are equivalent to ESS_PRIV_DBLOAD privileges.
Return Value
If successful, returns a count of users/databases in pCount, and a list of user database structures in ppUserDb.
Access
This function requires the caller to have database Design privilege (ESS_PRIV_DBDESIGN) for the specified database, unless they are getting their own database access information.
Example
ESS_FUNC_M ESS_GetDatabaseAccess (ESS_HCTX_T hCtx, ESS_HINST_T hInst) { ESS_FUNC_M sts = ESS_STS_NOERR; ESS_STR_T UserName; ESS_STR_T AppName; ESS_STR_T DbName; ESS_USHORT_T Count = 0; ESS_USHORT_T ind; ESS_PUSERDB_T UserDb = NULL; UserName = "Admin"; AppName = "Sample"; DbName = ""; sts = EssGetDatabaseAccess(hCtx, UserName, AppName, DbName, &Count, &UserDb); if(!sts) { if(Count && UserDb) { printf ("\r\n-------Database Access List------- \r\n\r\n"); for (ind = 0; ind < Count; ind++) { printf("User -> %s\r\n",UserDb[ind].UserName); printf("Application -> %s\r\n", UserDb[ind].AppName); printf("Database -> %s\r\n",UserDb[ind].DbName); printf("Access -> %d\r\n",UserDb[ind].Access); printf("MaxAccess -> %d\r\n", UserDb[ind].MaxAccess); printf("FilterName -> %s\r\n", UserDb[ind].FilterName); printf("===================================\r\n"); } EssFree (hInst, UserDb); } else printf ("\r\nDatabase list is empty\r\n\r\n"); } return (sts); }
See Also