EssGetDatabaseAccess

Description

EssGetDatabaseAccess() 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);
ESS_HCTX_ThCtx
ESS_STR_TUserName
ESS_STR_TAppName
ESS_STR_TDbName
ESS_PUSHORT_TpCount
ESS_PPUSERDB_T ppUserDb

Parameters

hCtxEssbase API context handle
UserNameUser name. If NULL, lists all users for the specified application and database.
AppNameApplication name. If NULL, lists all applications and databases for the specified user.
DbNameDatabasename. If NULL, lists all databases for the specified user or application.
pCountAddress of variable to receive count of user database structures
ppUserDbAddress of pointer to receive an allocated array of user database structures

Return Value

If successful, returns a count of users/databases in pCount, and a list of user database structures in ppUserDb.

Notes

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

EssGetApplicationAccess()
EssGetUser()
EssListUsers()
EssSetDatabaseAccess()