EssGetDatabaseAccess() gets a list of user database access structures, which contain information about user access to databases.
ESS_FUNC_M EssGetDatabaseAccess (hCtx, UserName, AppName, DbName, pCount, ppUserDb);
| ESS_HCTX_T | hCtx |
| ESS_STR_T | UserName |
| ESS_STR_T | AppName |
| ESS_STR_T | DbName |
| ESS_PUSHORT_T | pCount |
| ESS_PPUSERDB_T | ppUserDb |
| hCtx | Essbase API context handle |
| UserName | User name. If NULL, lists all users for the specified application and database. |
| AppName | Application name. If NULL, lists all applications and databases for the specified user. |
| DbName | Databasename. If NULL, lists all databases for the specified user or application. |
| pCount | Address of variable to receive count of user database structures |
| ppUserDb | Address of pointer to receive an allocated array of user database structures |
If successful, returns a count of users/databases in pCount, and a list of user database structures in ppUserDb.
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.
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);
}
EssGetApplicationAccess()
EssGetUser()
EssListUsers()
EssSetDatabaseAccess()