# EsbGetDatabaseAccess

Description

EsbGetDatabaseAccess() gets a list of user database access structures, which contain information about user access to databases.

Syntax

    EsbGetDatabaseAccess (hCtx, User, AppName, DbName, pItems)

    ByVal hCtx    As Long
    ByVal User    As String
    ByVal AppName As String
    ByVal DbName  As String
          pItems  As Integer

Parameters

hCtx | Essbase VB API context handle.
User | User name. If an empty string, lists all users for the specified application and database.
AppName | Application name. If an empty string, lists all applications and databases for the specified user.
DbName | Database name. If an empty string, lists all databases for the specified user or application.
pItems | Address of variable to receive Items of user database structures.

Return Value

If successful, returns a Items of users/databases in pItems, and generates a list of user database structures accessible via EsbGetNextItem().

Notes

- If any of User, AppName, or DbName are an empty string, they will be treated as wild cards and all items of the appropriate type will be listed. If AppName is an empty string, DbName is assumed to also be an empty string. Any two of these arguments may be an empty string, 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.).
- Filter access privileges are equivalent to ESB_PRIV_DBLOAD privileges.

Access

This function requires the caller to have Database Design privilege (ESB_PRIV_DBDESIGN) for the specified database, unless they are getting their own database access information.

Example

    Declare Function EsbGetDatabaseAccess Lib "ESBAPIW" (ByVal hCtx As Long, ByVal User As String, ByVal AppName As String, ByVal DbName As String, Items As Integer) As Long

    Sub ESB_GetDatabaseAccess ()
       Dim Items As Integer
       Dim AppName As String
       Dim DbName As String
       Dim User As String
       Dim UserDb As ESB_USERDB_T
       Dim sts As Long

       AppName = "Sample"
       DbName = "Basic"
       User = "Joseph"

       '********************
       ' Get Database Access
       '********************
       sts = EsbGetDatabaseAccess (hCtx,
       User, AppName, DbName, Items)

       For n = 1 To Items

         '******************************
         ' Get next User Database Access
         ' structure from the list
         '******************************
         sts = EsbGetNextItem (hCtx,
         ESB_USERDB_TYPE, UserDb)
       Next
    End Sub

See Also

EsbGetApplicationAccess()
EsbGetUser()
EsbListUsers()
EsbSetDatabaseAccess()
EsbGetNextItem()