Advantage Client Engine
Get a user’s or a user group’s permissions to a database object.
UNSIGNED32 ENTRYPOINT AdsDDGetPermissions( ADSHANDLE hAdminConn,
UNSIGNED8 *pucGrantee,
UNSIGNED16 usObjectType,
UNSIGNED8 *pucObjectName,
UNSIGNED8 *pucParentName,
UNSIGNED16 usGetInherited,
UNSIGNED32 *pulPermissions );
hAdminConn (I) |
Handle of a database connection. |
pucGrantee (I) |
Name of a user or a user group for whom the permissions have been granted. |
usObjectType (I) |
Type of the database object that is specified by the pucObjectName parameter. Valid values are ADS_DD_TABLE_OBJECT, ADS_DD_COLUMN_OBJECT, ADS_DD_VIEW_OBJECT, ADS_DD_PROCEDURE_OBJECT, ADS_DD_LINK_OBJECT, ADS_DD_PUBLICATION_OBJECT, or ADS_DD_SUBSCRIPTION_OBJECT. |
pucObjectName (I) |
Name of the database object to retrieve the granted permissions for. It may be the name of a database table, the name of a column in a database table, the name of a view, the name of a stored procedure, name of a publication, name of a subscription, or a link alias. |
pucParentName (I) |
Name of the database object that is the parent/owner of the object specified by pucObjectName. This parameter is only used if usObjectType is ADS_DD_COLUMN_OBJECT. In such case, this parameter specifies the name of the database table that owns the column specified by the pucObjectName parameter. For other object types, this parameter can be NULL and it is ignored. |
usGetInherited (I) |
True or False. If True and the pucGrantee specifies a user in the database, the function will return the user’s effective permission to the object, i.e. the user’s permission plus any permission the user inherited from the user group that the user belongs to. If False, only the permissions that are specifically granted to the user or the user group are returned. |
pulPermissions (O) |
Returns the permission granted to the user or user group for this object. This is a bit field and the permissions are OR’ed together. Valid permissions that can be returned are ADS_PERMISSION_READ, ADS_PERMISSION_UPDATE, ADS_PERMISSION_INSERT, ADS_PERMISSION_DELETE, ADS_PERMISSION_EXECUTE, ADS_PERMISSION_LINK_ACCESS , ADS_PERMISSION_INHERIT, ADS_PERMISSION_ALTER, ADS_PERMISSION_DROP, ADS_PERMISSION_CREATE, ADS_PERMISSION_WITH_GRANT, ADS_PERMISSION_ALL, and ADS_PERMISSION_ALL_WITH_GRANT. To get the grantee’s WITH GRANT permissions, *pulPermissions must be set to ADS_GET_PERMISSIONS_WITH_GRANT before calling AdsDDGetPermissions. Likewise, to get the grantee’s CREATE permissions *pulPermissions must be set to ADS_GET_PERMISSIONS_CREATE and to get the grantee’s CREATE WITH GRANT permissions, *pulPermissions must be set to ADS_GET_PERMISSIONS_CREATE_WITH_GRANT. See AdsDDGrantPermission for explanation on the effects of various permissions. |
AE_INVALID_OBJECT_NAME |
The name specified by the pucObjectName, pucParentName or pucGrantee could not be found in the database. |
AE_PERMISSION_DENIED |
The current user does not have permissions to retrieve the grantee’s permissions. |
AdsDDGetPermissions retrieves the user’s or the user group’s permissions on a specified object in the database.
Note The permissions can only be retrieved by the ADSSYS user or a user with administrative permissions for the specified user or user group.
usFindObjectType |
Description |
ADS_DD_PUBLICATION_OBJECT |
Retrieves the name of a publication object. The pucParentName is currently ignored and assumed to be the database. |
ADS_DD_SUBSCRIPTION_OBJECT |
Retrieves the name of a subscription object. The pucParentName is currently ignored and assumed to be the database. |
Get the effective permission of user "rsmith" on the "Employees" tables.
AdsConnect60( "n:\\MyData\\myData.ADD", ADS_REMOTE_SERVER, "ADSSYS", NULL, ADS_DEFAULT, &hDD );
/* Retrieves the permissions for the user rsmith on the "employees" table. */
ulReturnCode = AdsDDGetPermissions( hDD, "rsmith", ADS_DD_TABLE_OBJECT, "Employees", NULL, TRUE,
&ulPermissions );
AdsDisconnect( hDD );