Advantage Client Engine
Makes a database user member of a user group.
UNSIGNED32 AdsDDAddUserToGroup( ADSHANDLE hAdminConn,
UNSIGNED8 *pucGroupName,
UNSIGNED8 *pucUserName );
hAdminConn (I) |
Handle of a database connection. |
pucGroupName (I) |
Name of the database user group object to make the user a member of. |
pucUserName (I) |
Name of the database user object that will become a member of the user group. |
AE_INVALID_OBJECT_NAME |
Either the pucGroupName does not specify a valid user group in the database or the pucUserName does not specify a valid database user. |
AE_ALREADY_MEMBER_OF_GROUP |
The user is already a member of the specified user group. |
AdsDDAddUserToGroup makes the user a member of the specified user group. Once the user is a member of the user group, the user inherits rights to all objects that the user group has. If the user group’s object access rights changes, the user’s inherited rights will change accordingly. A user can be member of multiple user groups. The user’s effective right to a database object (table, view or stored procedure) is the summation of all inherited rights the user have from all user groups that the user is a member of.
ALTER permissions on the user group are required to add a user to a data dictionary user group. See Advantage Data Dictionary User Permissions for more information.
Note This function can be called inside a transaction, but will not be part of the transaction. Any changes it makes cannot be rolled back.
After making a connection to the database, add user "rsmith" to the user group "Managers". If the "Managers" has read and write rights to the table "employees", the user "rsmith" will now have rights to open the "employees" table for read and write purpose.
AdsConnect60( "n:\\MyData\\myData.ADD", ADS_REMOTE_SERVER, "ADSSYS", NULL, ADS_DEFAULT, &hDD );
ulReturnCode = AdsDDAddUserToGroup( hDD, "Managers", "rsmith" );
AdsDisconnect( hDD );
AdsConnect60( "n:\\MyData\\myData.ADD", ADS_REMOTE_SERVER, "rsmith", NULL, ADS_DEFAULT, &hConn );
AdsOpenTable( hConn, "employees", NULL, ADS_DEFAULT, ADS_DEFAULT, ADS_DEFAULT,
ADS_DEFAULT, ADS_DEFAULT, &hTable );