Index

DKUserMgmtICM

Purpose:

This class represents and implements datastore user management functions. An instance of DKUserMgmtICM is created as part of a chain of instantiations when you create an instance of DKDatastoreICM. Use the userManagement() function of DKDatastoreAdminICM to get the DKUserMgmtICM instance. The following example illustrates getting the instance:

DKDatastoreICM ds;
     DKDatastoreDefICM* dsDef = 0;
     DKDatastoreAdminICM* dsAdmin = 0;
     DKUserMgmtICM* userMgmt = 0;
     /* Connect to the datastore   */
     ds.connect(uid, pwd, .....);
     .....
     dsDef = (DKDatastoreDefICM*)ds.datastoreDef();
     dsAdmin = (DKDatastoreAdminICM*)dsDef->datastoreAdmin();
     userMgmt = (DKUserMgmtICM*)dsAdmin->userManagement();
     ....

Since: Version 8

Class summary:

class DKEXPORT DKUserMgmtICM : public dkUserManagement
 {
 public:
     DKUserMgmtICM();
     DKUserMgmtICM(dkDatastore * ds);
     virtual ~DKUserMgmtICM();
 
     virtual void add(dkUserDef* userDefObj);
     virtual void add(dkUserGroupDef* userGrpDef);
     void changePassword(const char* newPwd);
     void changePassword(const char* userId, const char* newPwd);
     virtual void changePassword(const char* userId, const char* oldPwd, const char* newPwd);
     virtual void clearCache();
     virtual dkUserDef* createUserDef();
     virtual dkUserGroupDef* createUserGroupDef();
     virtual void del(dkUserDef* userDefObj);
     virtual void del(dkUserGroupDef* userGrpDef);
     virtual void delUser(const char* name);
     virtual void delUserGroupDef(const char* name);
     long getAccessLevel();
     virtual dkUserDef* getUserDef(const char* name);
     DKString getUserDomain(const char* name);
     virtual dkUserGroupDef* getUserGroupDef(const char* name);
     long getUserPrivilege(const char*  name);
     DKBoolean isAdminUser(const char* userName);
     DKBoolean isTraceEnabled();
     DKString* listActiveUserNames(long& arrSize);
     virtual dkCollection* listGroupsForUser(const char* name);
     virtual dkCollection* listUserDefs();
     virtual dkCollection* listUserGroupDefs();
     virtual dkCollection* listUserGroupDefs(const char* domainName);
     DKString* listUserGroupNames(const char* domainName,long& arrSize);
     DKString* listUserGroupNames(long& arrSize);
     DKString* listUserGroups(long& arrSize);
     DKString* listUserGroups(const char* domainName,long& arrSize);
     DKString* listUserNames(const char* domainName,long& arrSize);
     DKString* listUserNames(long& arrSize);
     DKString* listUsers(const char* domainName,long& arrSize);
     DKString* listUsers(long& arrSize);
     DKString* listUsersInGroup(const char* id);
     void removeUserDef(const char* name);
     virtual dkUserDef* retrieveUserDef(const char* name);
     virtual dkUserGroupDef* retrieveUserGroupDef(const char* userGroupName);
     void removeUserGroupDef(const char* name);
     void setTraceEnabled(DKBoolean isEnabled);
     void update(dkUserDef* userDef);
     void update(dkUserGroupDef* userGroupDef);
 };

Members:

Constructors and destructor
DKUserMgmtICM();

Default constructor. Creates an user mgmt object that is not associated with any datastore instance currently.

DKUserMgmtICM(dkDatastore * ds);

Constructor that takes a datastore instance as a parameter. The returned user mgmt object instance is associated with the datastore instance. Equivalent to calling the default constructor followed by the setDatastore method on the created object. Parameters: ds - valid instance of a datastore object. Should be an instance of DKDatastoreICM

virtual ~DKUserMgmtICM();

Destructor for this object.

Member Functions

add
Adds an user group definition to the persistent datastore. Parameters: userGroupDef - user group definition as an instance of DKUserGroupDefICM. Throws: DKException if error occurs on the server.
virtual void add(dkUserGroupDef* userGrpDef);

add
Adds a user definition to the persistent datastore. Parameters: userDefObject - user definition as an instance of DKUserDefICM. Throws: DKException if error occurs on the server.
virtual void add(dkUserGroupDef* userGrpDef);

clearCache
Removes all cached data from the in-memory representation of this user mgmt object.
virtual void clearCache();

changePassword
Changes the password of the current user and replaces it with the new password. Parameters: newPwd - new password. Throws: DKException if error occurs on the server.
void changePassword(const char* newPwd);

changePassword
Replaces the password of the current user with the new password. This method can only be called by a user with adminstrator privileges. Parameters:
  • userId - user id of user whose password is to be changed.
  • newPwd - new password for specified user.

Throws: DKException if error occurs on the server.

void changePassWord(const char* userId, const char* newPwd);

changePassword
Changes the password for the specified user id. This method can only be called by a user with adminstrator privileges. Parameters:
  • userId - user id of user whose password is to be changed.
  • oldPwd - old password of user.
  • newPwd - new password of user.

Throws: DKException if error occurs on the server.

virtual void changePassword(const char* userId, const char* oldPwd, const char* newPwd);

createUserDef
Creates a new user definition. Returns: new user definition as an instance of DKUserDefICM.
virtual dkUserDef* createUserDef();

createUserGroupDef
Creates a new user group definition. Returns: new user group definition as an instance of DKUserGroupDefICM.
virtual dkUserGroupDef* createUserGroupDef();

del
Deletes a user definition from the persistent datastore. Parameters: userDefObj - user definition as an instance of DKUserDefICM. Throws: DKException if error occurs on the server.
virtual void del(dkUserDef* userDefObj);

del
Deletes a user group definition from the persistent datastore. Parameters: userGrpDef - user group definition as an instance of DKUserGroupDefICM. Throws: DKException if error occurs on the server.
virtual void del(dkUserGroupDef* userGrpDef);

delUser
Deletes an user of the specified name from datastore. Parameters: name - name of user whose user definition is to be deleted. Throws: DKException if error occurs on the server.
virtual void delUser(const char* name);

delUserGroupDef
Deletes an user group object of the specified name from the datastore. Parameters: name - name of the user group whose user group definition is to be deleted. Throws: DKException if error occurs on the server.
virtual void delUserGroupDef(const char* name);

getAccesLevel
Retrieves the user's access level. Returns: 1 if the user is an administrative user; 0 otherwise. Throws: DKException if error occurs on the server.
long getAccessLevel();

getUserDef
Retrieves the in-memory representation of a user definition. Parameters: name - name of the user whose user definition is to be retrieved. Returns: user definition as instance of DKUserDefICM.
virtual dkUserDef* getUserDef(const char* name);

getUserDomain
Retrieves the specified user's administration domain. Parameters: name - name of the user whose adminstration domain is to be retrieved. Returns: Adminstration domain name as a DKString variable.
DKString getUserDomain(const char* name);

getUserGroupDef
Retrieves the in-memory representation of a user group definition. Parameters: name - name of the user whose user group definition is to be retrieved. Returns: user group definition as instance of DKUserGroupDefICM.
virtual dkUserGrouDef* getUserGroupDef(const char* name);

getUserPrivilege
Retrieves the code for the privilege set for the user. Parameters: name - name of the user whose privilege set code is to be retrieved. Returns: privilege set code for the user. Throws: DKException if error occurs on the server.
long getUserPrivilege(const char* name);

isAdminUser
Checks to see if the user specified is an adminstrator or not. Parameters: userName - name of user to check. Returns: TRUE if the user is an adminstrator; FALSE otherwise.
DKBoolean isAdminUser(const char* userName);

isTraceEnabled
Checks to see if tracing is currently enabled. Returns: TRUE if tracing is enabled; FALSE otherwise.
DKBoolean isTraceEnabled();

listActiveUserNames
List active users in the system for given domain. Parameters: arrSize - size of returned active user name array. Returns: array of active user names as DKString variables. Throws: DKException if error occurs on the server.
DKString* listActiveUserNames(long& arrSize);

listActiveUserNames
Retrieves the list of active user names for a given adminstration domain. Parameters:
  • domainName - name of the domain for which active users is to be retrieved.
  • arrSize - size of the retrieved active user name array.

Returns: array of active user names as DKString variables Throws: DKException if error occurs on the server.

DKString* listActiveUsernames(const char* domainName,long& arrSize)

listUserDefs
Retrieves a list of the users defined in the system. Returns: Collection of user definitions as instances of DKUserDefICM. Throws: DKException if error occurs on the server.
virtual dkCollection* listUserDefs();

listGroupsForUser
Retrieves a collection of user groups that the specified user belongs to from the persistent datastore. Parameters: name - name of the user. Returns: Collection of user groups as instances of DKUserGroupDefICM. Throws: DKException if error occurs on the server.
virtual dkCollection* listGroupsforUser(const char* name);

listUserGroupDefs
Retrieves a collection of user group definitions in the system. Returns: Collection of user groups as instances of DKUserGroupDefICM. Throws: DKException if error occurs on the server.
virtual dkCollection* listUserGroupDefs();

listUserGroupDefs
Retrieves a collection of user group definitions for a given adminstration domain. Parameters: domainName - name of the administration domain to get user group definitions for. Returns: Collection of user groups as instances of DKUserGroupDefICM. Throws: DKException if error occurs on the server.
virtual dkCollection* listUserGroupDefs(const char* domainName);

listUserGroupNames
Retrieves the list of user groups defined for the specified adminstration domain. Parameters:
  • domainName - name of the domain for which the user group names are to be retrieved.
  • arrSize - size of the retrieved user group name array.

Returns: array of user group names for the specified admin domain as DKString variables. Throws: DKException if error occurs on the server.

DKString* listUserGroupNames(const char* domainName,long& arrSize);

listUserGroupNames
Retrieves the list of user groups defined in the system. Parameters: arrSize - size of the retrieved user group name array. Returns: array of user group names as DKString variables. Throws: DKException if error occurs on the server.
DKString* listUserGroupNames(long& arrSize);

listUserGroups
Retrieves the list of user group names defined in the system. Parameters: arrSize - size of user group name array. Returns: array of user group names as DKString variables. Throws: DKException if error occurs on the server.
DKString* listUserGroups(long& arrSize);

listUserGroups
Retrieves the list of user group names for the specified adminstration domain. Parameters:
  • domainName - name of the adminstration domain for which the list of user group names is to be retrieved.
  • arrSize - size of the user group names array retrieved.

Returns: array of user group names as DKString variables. Throws: DKException if error occurs on the server.

DKString* listUserGroups(const char* domainName,long& arrSize);

listUserNames
Retrieves the list of user names defined in the system for a given adminstration domain. Parameters:
  • domainName - name of the domain for which the list of user names is to be retrieved.
  • arrSize - size of the retrieved user name array.

Returns: array of user names as DKString variables. Throws: DKException if error occurs on the server.

DKString* listUserNames(const char* domainName,long& arrSize);

listUserNames
Retrieves the list of user names defined in the system. Parameters: arrSize - size of the retrieved user name array. Returns: array of user names as DKString variables. Throws: DKException if error occurs on the server.
DKString* listUserNames(long& arrSize);

listUsers
Retrieves the list of user names defined in the system for the specified adminstration domain. Parameters:
  • domainName - name of the adminstration domain for which the user names is to be retrieved.
  • arrSize - size of the retrieved user name array.

Returns: array of user names as DKString variables. Throws: DKException if error occurs on the server.

DKString* listUsers(const char* domainName,long& arrSize);

listUsers
Retrieves the list of user names defined in the system. Parameters: arrSize - size of the retrieved user name array. Returns: array of user names as DKString variables. Throws: DKException if error occurs on the server.
DKString* listUsers(long& arrSize);

listUsersInGroup
Retrieves the list of users in a user group from the persistent datastore. Parameters: name - name of the user group whose users are to be retrieved. Returns: Collection of user definitions as instances of DKUserDefICM. Throws: DKException if error occurs on the server.
DKString* listUsersInGroup(const char* name);

removeUserDef
Removes a user definition from memory. This method can only be called by an adminstrator. Parameters: name - name of the user whose user definition is to be removed. Throws: DKException if error occurs on the server.
void removeUserDef(const char* name);

retrieveUserDef
Retrieves a user definition by name. The password for the user is not retrieved. Parameters: userName - name of the user whose user definition is to be retrieved. Returns: user definition as an instance of DKUserDefICM. Throws: DKException if error occurs on the server.
virtual dkUserDef* retrieveUserGroupDef(const char* userName);

retrieveUserGroupDef
Retrieves a user group definition based on the group name. Parameters: userGroupName - name of the user group to be retrieved. Returns: user group definition as an instance of DKUserGroupDefICM. Throws: DKException if error occurs on the server.
virtual dkUserGroupDef* retrieveUserDef(const char* userGroupName);

removeUserGroupDef
Removes the specified user group from the in-memory representation. This method can only be called by administrators. Parameters: name - name of the user group to be removed. Throws: DKException if error occurs on the server.
void removeUserGroupDef(const char* name);

setTraceEnabled
Determines whether tracing should be enabled for debugging purposes. Parameters: isEnabled - If TRUE, tracing is enabled; if FALSE, tracing is disabled.
void setTraceEnabled(DKBoolean isEnabled);

update
Updates the definition of a user group in the persistent datastore. Parameters: userGroupDef - user group definition to be updated as an instance of DKUserGroupDefICM. Throws: DKException if error occurs on the server.
void update(dkUserDef* userDef);

update
Updates the definition of a user in the persistent datastore. Parameters: userDef - user definition to be updated as an instance of DKUserDefICM. Throws: DKException if error occurs on the server.
void update(dkUserGroupDef* userGroupDef);

(c) Copyright International Business Machines Corporation 1996, 2003. IBM Corp. All rights reserved.