AdsDDCreateUserGroup

Advantage Client Engine

Create a new user group in the database.

Syntax

UNSIGNED32 AdsDDCreateUserGroup( ADSHANDLE hAdminConn,

UNSIGNED8 *pucGroupName,

UNSIGNED8 *pucDescription );

Parameters

hAdminConn (I)

Handle of a database connection.

pucGroupName (I)

Name of the user group to create.

pucDescription (I)

Optional description of the user group. This parameter can be NULL.

Special Return Codes

AE_INVALID_OBJECT_NAME

Possible cause for the error is that the pucGroupName is already used by another object in database.

Remarks

AdsDDCreateUserGroup creates a user group object in the database. A user group can be used to logically group users with similar object access rights together. By default, a user inherits rights from the groups that he is a member of. By granting rights to user groups instead of users, it makes it simpler to add and remove access rights to multiple users. A user can become a member of a user group by calling the AdsDDAddUserToGroup API.

CREATE USER GROUP permissions are required to create a data dictionary user group. See Advantage Data Dictionary User Permissions for more information.

Note When a database is created, it is by default to not perform access rights checking. In order to enforce the access rights of the users, the ADS_DD_VERIFY_ACCESS_RIGHTS property of the database must be set to True by calling the AdsDDSetDatabaseProperty API.

 

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.

Example

After making a connection to the database, create a user group named "Managers" in the database and grant the user group read and update permissions to the "Employees" table.

AdsConnect60( "n:\\MyData\\myData.ADD", ADS_REMOTE_SERVER, "ADSSYS", NULL, ADS_DEFAULT, &hDD );

ulReturnCode = AdsDDCreateUserGroup( hDD, "Managers", "All managers are in this group." );

ulReturnCode = AdsDDGrantPermission( hDD, ADS_DD_TABLE_OBJECT, "Employees", NULL, "Managers",

ADS_PERMISSION_READ | ADS_PERMISSION_UPDATE );

See Also

AdsConnect60

AdsDDSetDatabaseProperty

AdsDDCreateUser

AdsDDDeleteUserGroup

AdsDDAddUserToGroup

AdsDDRemoveUserFromGroup

AdsDDGrantPermission

AdsDDRevokePermission

sp_CreateGroup