Advantage Client Engine
Retrieves one property associated with a database user from the data dictionary into the supplied buffer.
UNSIGNED32 AdsDDGetUserProperty( ADSHANDLE hDBConn,
UNSIGNED8 *pucUserName,
UNSIGNED16 usPropertyID,
VOID *pvProperty,
UNSIGNED16 *pusPropertyLen );
hDBConn (I) |
Handle of a database connection. |
pucUserName (I) |
Name of the database user object to retrieve the associated property. |
usPropertyID (I) |
Index of a database user property to retrieve. See Remarks for allowed values. |
pvProperty (O) |
Pointer to the buffer where the property is to be copied into. |
pusPropertyLen (I/O) |
On input, it specifies the size of the buffer pointed to by pvProperty. On output, it returns the length of property stored in the buffer. |
AE_INVALID_OBJECT_NAME |
Possible cause for the error is that the pucUserName does not specify a valid user name in the database. |
AE_INVALID_PROPERTY_ID |
Either the value supplied in usPropertyID is not a valid database user property ID, or the specified property is not retrievable. |
AE_INSUFFICIENT_BUFFER |
The size of the property to be copied into pvProperty is larger than the buffer size specified by *pusPropertyLen. The required buffer length is returned in *pusPropertyLen when this error occurs. |
AE_PROPERTY_NOT_SET |
The requested property is not set in the data dictionary. No data is returned in pvProperty and *pusPropertylen. |
AdsDDGetUserProperty retrieves one user property associated with the specified user. User properties can only be retrieved by the specified user or users with administrative permissions to this user. When connected as the administrator (ADSSYS user account), properties from any user can be retrieved. See Advantage Data Dictionary User Permissions for more information. The following are the valid values of usPropertyID and the expected return value in pvProperty and *pusPropertyLen.
usPropertyID |
Description |
ADS_DD_COMMENT |
Returns the description of the user in pvProperty. |
ADS_DD_USER_DEFINED_PROP |
Returns the user defined property for the specified user. |
ADS_DD_USER_GROUP_MEMBERSHIP |
Returns in the pvProperty the user groups that the specified user is a member of. The group membership is returned as a ‘;’ delimited string listing all user groups that the user is a member. For example: if the returned string is ‘Managers;R&D’, that means the user belongs to 2 user groups – the ‘Managers’ user group and the ‘R&D’ user group. |
After making a connection to the database, retrieve a list of the user groups that the user ‘User1’ is a member of.
AdsConnect60( "n:\\MyData\\myData.ADD", ADS_REMOTE_SERVER, "ADSSYS", NULL, ADS_DEFAULT, &hDD );
usLen = sizeof( aucGroups );
ulReturnCode = AdsDDGetUserProperty( hDD, "User1", ADS_DD_USER_GROUP_MEMBERSHIP, aucGroups, &usLen );