CdbUser Object

See Also   Methods   Properties

A CdbUser object represents a user account that has access permissions when a CdbWorkspace object operates as a secure workgroup (Microsoft Jet workspaces only).





Remarks

You use CdbUser objects to establish and enforce access permissions for the CdbDocument objects that represent databases, tables, and queries. Also, if you know the properties of a specific CdbUser object, you can create a new CdbWorkspace object that has the same access permissions as the CdbUser object.

You can append an existing CdbUser object to the Users collection of a CdbGroup object to give a user account the access permissions for that CdbGroup object. Alternatively, you can append the CdbGroup object to the Groups collection in a CdbUser object to establish membership of the user account in that group. If you use a Users or Groups collection other than the one to which you just appended an object, you may need to use the Refresh method.

With the properties of a CdbUser object, you can:

The Microsoft Jet database engine predefines two CdbUser objects named Admin and Guest. The user Admin is a member of both of the CdbGroup objects named Admins and Users; the user Guest is a member only of the CdbGroup object named Guests.

To create a new CdbUser object, use the CreateUser method.

To refer to a CdbUser object in a collection by its ordinal number or by its Name property setting, use either of the following syntax forms:

Users[0]

Users["name"]

CdbUser Constructor Syntax

Use any one of the following three constructors. The qualifier 'CONSTRUCTOR' in the syntax models is provided to help readability. It has no syntactic value.

CONSTRUCTORCdbUser(VOID);

This constructor creates an instance of the class. There are no parameters.

CONSTRUCTORCdbUser(const CdbUser &);

Type Description
const CdbUser & Reference to an object.

This constructor creates a copy of the object referenced in the parameter.

CONSTRUCTORCdbUser(DAOUser *pusr,

BOOL bAddRef = FALSE);

Type Argument Description
DAOUser * pusr A DAO Automation interface pointer corresponding to this DAO class.
BOOL bAddRef

=FALSE

Optional. A Boolean. If TRUE, the DAO Automation interface AddRef function is called.

DAO functionality is presented through pointers to DAO Automation interfaces. This constructor makes a DAO interface available in the form of a DAO class object that provides additional functionality.

This constructor is not required for typical use. It is provided to enable you to easily create a DAO class object if you have access to the corresponding DAO interface.

When the destructor for the DAO object is invoked, the underlying Automation interface's Release member is called. If Release decrements the interface's reference count to zero, the pointer to the Automation interface can be deleted. If you don't want this to happen (for example, because you want to discard the DAO object but continue using the Automation interface), specify TRUE for the second parameter. The underlying Automation interface's AddRef member is called, which counterbalances the eventual call to Release.