OSB_LIB::OsbUser Class Reference

Collaboration diagram for OSB_LIB::OsbUser:

Collaboration graph
[legend]
List of all members.

Detailed Description

User of the OSB system.

It represents the users of the OSB system. It also performs user management functions like user creation, user deletion, and user modification.

Todo:
Once we support customer self-care the functionality of the class must be merged into Associate.

Definition at line 79 of file osbuser.h.

Public Types

Public Member Functions

Read access to the members.
Modify data members.
Maintain available modules and access rights.

Private Member Functions

Database operations.

Private Attributes

Friends


Member Typedef Documentation

typedef std::map< ModuleId, Id<UserGroup> > OSB_LIB::OsbUser::Grants

List of modules and related user group.

Definition at line 89 of file osbuser.h.

typedef Id<OsbUser> OSB_LIB::OsbUser::Oid

Unique identifier for the OSB users.

Definition at line 87 of file osbuser.h.


Constructor & Destructor Documentation

OSB_LIB::OsbUser::OsbUser ( const Oid oid = Oid()  ) 

Default constructor with optional object id.

OSB_LIB::OsbUser::OsbUser ( const std::string &  login,
const std::string &  password = "" 
) [explicit]

Constructor with login name and optional password.

Parameters:
login OSB user login name.
password OSB user password.
Exceptions:
OsbException if login is empty.
OsbException if login or password is too long.


Member Function Documentation

bool OSB_LIB::OsbUser::checkPw ( const std::string &  password  )  [private]

Validate the password.

Parameters:
password Current password of the user.
Returns:
true if the password is correct, else false.

ModuleId OSB_LIB::OsbUser::defModule (  )  const [inline]

The default module of the user.

Note:
It may not be set.

Definition at line 121 of file osbuser.h.

References defModule_.

const std::string& OSB_LIB::OsbUser::email (  )  const [inline]

Definition at line 115 of file osbuser.h.

References email_.

void OSB_LIB::OsbUser::grant ( const UserGroup grp  ) 

Grant the module and access rights of user group.

Parameters:
grp The user group to add. It replaces an existing group for the same module.
See also:
setDefModule().

const Grants& OSB_LIB::OsbUser::grants (  )  const

List of modules and related user group available for the user.

void OSB_LIB::OsbUser::insert ( const OSB_DB::Session session  )  [private]

Insert the OSB user object into the database.

Insert the OSB user into the database. On success, the function sets oid_.

Parameters:
session Database session to use.
Exceptions:
OsbException 
  • in case of OSB user data validation rules fail.
  • object version conflict.
  • if insert fails for any other (unknown) reason.

bool OSB_LIB::OsbUser::login ( const OSB_DB::Session session  )  [private]

Validate the user's credentials.

Parameters:
session Database session to use.
Returns:
true if valid.
Reads the user from the database and checks the password.

const std::string& OSB_LIB::OsbUser::loginName (  )  const [inline]

Definition at line 112 of file osbuser.h.

References loginName_.

const std::string& OSB_LIB::OsbUser::name (  )  const [inline]

Definition at line 114 of file osbuser.h.

References name_.

const long OSB_LIB::OsbUser::objVs (  )  const [inline]

Definition at line 111 of file osbuser.h.

References objVs_.

const Oid& OSB_LIB::OsbUser::oid (  )  const [inline]

Definition at line 110 of file osbuser.h.

References oid_.

const std::string& OSB_LIB::OsbUser::password (  )  const [inline]

Definition at line 113 of file osbuser.h.

References password_.

void OSB_LIB::OsbUser::read ( const OSB_DB::Session session  )  [private]

Read OSB user from the database.

Parameters:
session Database session to use.
Exceptions:
ObjectNotFound if the user does not exist in the database.
Uses oid() or, if not set, the loginName() to read the user from the database.

void OSB_LIB::OsbUser::remove ( const OSB_DB::Session session  )  [private]

Remove the OSB user object from the database.

Parameters:
session Database session to use.
Exceptions:
OsbException 
  • object version conflict.
  • if deletion fails for any other (unknown) reason.

void OSB_LIB::OsbUser::revoke ( const ModuleId  module  ) 

Revoke the access rights for a module.

Parameters:
module OSB module to remove from the user.
Removes module from grants() and clears defModule() if it is the default module of the user.

void OSB_LIB::OsbUser::revokeAll (  ) 

Revoke all access rights.

Removes all grants and clears defModule().

bool OSB_LIB::OsbUser::setDefModule ( const ModuleId  module  ) 

Set the default module for the user.

Parameters:
module New default OSB module.
Returns:
true if the default module was set,
false if the user has not granted a group for module.
See also:
grant().

void OSB_LIB::OsbUser::setEmail ( const std::string &  email  ) 

Set the user name.

Parameters:
email The new e-mail address for the user.
Exceptions:
OsbException if email is too long.

void OSB_LIB::OsbUser::setLoginName ( const std::string &  loginName  ) 

Set the login name.

Parameters:
loginName The new login name for the user, it must be unique (checked during insert() or update()).
Exceptions:
OsbException if loginName is empty or too long.

void OSB_LIB::OsbUser::setName ( const std::string &  name  ) 

Set the user name.

Parameters:
name The new name for the user.
Exceptions:
OsbException if name is too long.

void OSB_LIB::OsbUser::setPassword ( const std::string &  newPw,
const std::string &  oldPw 
)

Set the password.

Parameters:
newPw The new password of the user.
oldPw The old password of the user,
if empty it is not validated.
Exceptions:
OsbException if the old password is not correct.

void OSB_LIB::OsbUser::setPw ( const std::string &  pw  )  [private]

Set the user's password.

void OSB_LIB::OsbUser::update ( const OSB_DB::Session session  )  [private]

Update the OSB user object in the database.

Parameters:
session Database session to use.
Exceptions:
OsbException 
  • in case of OSB user data validation rules fail.
  • object version conflict.
  • if the update fails for any other (unknown) reason.

Id<UserGroup> OSB_LIB::OsbUser::userGroup ( ModuleId  module  )  const

Check if a OSB module is available and get user group.

Parameters:
module The module to query.
Returns:
The object id of the group that defines the user's access rights for module.
It is not set if the user is not allowed the use the module.


Friends And Related Function Documentation

friend class OSB_DB::OsbUserGw [friend]

This will access all the private members.

Definition at line 81 of file osbuser.h.

friend class UserMgmtCfg [friend]

Allow to call database functions.

Definition at line 83 of file osbuser.h.


Member Data Documentation

ModuleId OSB_LIB::OsbUser::defModule_ [private]

Default module of the user.

Definition at line 311 of file osbuser.h.

Referenced by defModule().

std::string OSB_LIB::OsbUser::email_ [private]

Email address of OSB user.

Definition at line 307 of file osbuser.h.

Referenced by email().

Grants OSB_LIB::OsbUser::grants_ [private]

List of modules and related user groups for the user.

Definition at line 309 of file osbuser.h.

std::string OSB_LIB::OsbUser::loginName_ [private]

Login name of OSB user.

Definition at line 301 of file osbuser.h.

Referenced by loginName().

std::string OSB_LIB::OsbUser::name_ [private]

Full name of OSB user.

Definition at line 305 of file osbuser.h.

Referenced by name().

long OSB_LIB::OsbUser::objVs_ [private]

Object version.

Definition at line 299 of file osbuser.h.

Referenced by objVs().

Oid OSB_LIB::OsbUser::oid_ [private]

Unique object identifier for the OSB users.

Definition at line 297 of file osbuser.h.

Referenced by oid().

std::string OSB_LIB::OsbUser::password_ [private]

Password of OSB user: it is always encrypted.

Definition at line 303 of file osbuser.h.

Referenced by password().


The documentation for this class was generated from the following file:
Generated on Sat Sep 2 14:12:20 2006 for OSB Library by  doxygen 1.4.7