UserManagerImpl Class Reference

#include <UserManagerImpl.h>

Inheritance diagram for UserManagerImpl:

Inheritance graph
[legend]
Collaboration diagram for UserManagerImpl:

Collaboration graph
[legend]

Public Member Functions

 UserManagerImpl ()
 ~UserManagerImpl ()
void setSysDb (Database *db)
void setDba (bool flag)
void setUserName (const char *name)
int createUser (const char *name, const char *passwd)
 creates new User in the system.
int deleteUser (const char *name)
 deleted user from the system
Only default dba user is allowed to call this method.
int changePassword (const char *newPasswd)
 changes password for self.
int changePassword (const char *userName, const char *newPasswd)
 changes the password for specified user.

Detailed Description

Definition at line 22 of file UserManagerImpl.h.


Constructor & Destructor Documentation

UserManagerImpl::UserManagerImpl (  )  [inline]

Definition at line 31 of file UserManagerImpl.h.

00031 {}

UserManagerImpl::~UserManagerImpl (  )  [inline]

Definition at line 32 of file UserManagerImpl.h.

00032 {}


Member Function Documentation

int UserManagerImpl::changePassword ( const char *  userName,
const char *  newPasswd 
) [virtual]

changes the password for specified user.

Only default dba user is allowed to call this method.

Parameters:
username username for authentication
password password for authentication
Returns:
int return code

Implements UserManager.

Definition at line 60 of file UserManagerImpl.cxx.

References CatalogTableUSER::changePass(), ErrNoPrivilege, ErrSysInternal, OK, and printError.

00061 {
00062     if (!isDba)
00063     {
00064         printError(ErrNoPrivilege,
00065                    "Only DBA privileged schema can change password for other users");
00066         return ErrNoPrivilege;
00067     }
00068     int ret = 0;
00069     CatalogTableUSER cUser(systemDatabase_);
00070     ret = cUser.changePass(usrName, newPasswd );
00071     if (0 != ret)
00072     {
00073         printError(ErrSysInternal,
00074                    "Catalog table updation failed for user %s",usrName);
00075         return ErrSysInternal;
00076     }
00077     return OK;
00078 }

Here is the call graph for this function:

int UserManagerImpl::changePassword ( const char *  newPasswd  )  [virtual]

changes password for self.

Logged in user password is set to
specified password.

Parameters:
newPasswd new password to be set.
Returns:
int return code

Implements UserManager.

Definition at line 81 of file UserManagerImpl.cxx.

References CatalogTableUSER::changePass(), ErrSysInternal, OK, and printError.

00082 {
00083     int ret = 0;
00084     CatalogTableUSER cUser(systemDatabase_);
00085     ret = cUser.changePass(userName, newPasswd );
00086     if (0 != ret)
00087     {
00088         printError(ErrSysInternal,
00089                    "Catalog table updation failed");
00090         return ErrSysInternal;
00091     }
00092     return OK;
00093 }

Here is the call graph for this function:

int UserManagerImpl::createUser ( const char *  name,
const char *  passwd 
) [virtual]

creates new User in the system.


Only default dba user is allowed to call this method.

Parameters:
name username to be created
passwd password for the schema created
Returns:
int return code

Implements UserManager.

Definition at line 19 of file UserManagerImpl.cxx.

References ErrNoPrivilege, ErrSysInternal, CatalogTableUSER::insert(), OK, and printError.

00020 {
00021     if (!isDba)
00022     {
00023         printError(ErrNoPrivilege,
00024                    "Only DBA privileged schema can create users");
00025         return ErrNoPrivilege;
00026     }
00027     int ret = 0;
00028     //add entry to USER table
00029     CatalogTableUSER cUser(systemDatabase_);
00030     cUser.insert(name, password);
00031     if (0 != ret)
00032     {
00033         printError(ErrSysInternal,
00034                    "Catalog table insert failed for the user %s",name);
00035         return ErrSysInternal;
00036     }
00037     return OK;
00038 }

Here is the call graph for this function:

int UserManagerImpl::deleteUser ( const char *  name  )  [virtual]

deleted user from the system
Only default dba user is allowed to call this method.

Parameters:
name username to be deleted
Returns:
int return code

Implements UserManager.

Definition at line 40 of file UserManagerImpl.cxx.

References ErrNoPrivilege, ErrNotExists, OK, printError, and CatalogTableUSER::remove().

00041 {
00042     if (!isDba)
00043     {
00044         printError(ErrNoPrivilege,
00045                    "Only DBA privileged schema can delete users");
00046         return ErrNoPrivilege;
00047     }
00048     int ret = 0;
00049     CatalogTableUSER cUser(systemDatabase_);
00050     ret = cUser.remove(name);
00051     if (0 != ret)
00052     {
00053         printError(ErrNotExists,
00054                            "User %s not exists",name);
00055         return ErrNotExists;
00056     }
00057     return OK;
00058 }

Here is the call graph for this function:

void UserManagerImpl::setDba ( bool  flag  )  [inline]

Definition at line 35 of file UserManagerImpl.h.

Referenced by SessionImpl::getUserManager().

00035 { isDba = flag; }

Here is the caller graph for this function:

void UserManagerImpl::setSysDb ( Database db  )  [inline]

Definition at line 34 of file UserManagerImpl.h.

Referenced by SessionImpl::getUserManager().

00034 { systemDatabase_ = db; }

Here is the caller graph for this function:

void UserManagerImpl::setUserName ( const char *  name  )  [inline]

Definition at line 36 of file UserManagerImpl.h.

Referenced by SessionImpl::getUserManager().

00036 { strcpy( userName, name); }

Here is the caller graph for this function:


The documentation for this class was generated from the following files:
Generated on Mon Jun 9 22:55:33 2008 for csql by  doxygen 1.4.7