usermgmt.h

Go to the documentation of this file.
00001 // OSB library ************************************************ -*- C++ -*-
00006 /*
00007   AUTHOR(S): Stephan Broennimann (vb)
00008 
00009   RCS information
00010    $Name: OSB_060808 $
00011    $Revision: 1.10.2.1 $
00012 
00013   License
00014    OSB rating and billing library for communication networks
00015    Copyright (C) 2004, 2005, 2006  OSB systems
00016 
00017    This file may be distributed and/or modify under the terms of the
00018    GNU General Public License (GPL) as published by the Free Software
00019    Foundation which is provided in the file LICENSE.GPL included in the
00020    packaging of this file.
00021 
00022    The file is distributed in the hope that it will be useful, but WITHOUT
00023    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00024    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00025    for more details.
00026 
00027    Holders of a OSB Commercial License may use this file under the terms
00028    and conditions of this commercial license.
00029  */
00030 #ifndef _USERMGMT_H_
00031 #define _USERMGMT_H_
00032 
00033 // ************************************************************************
00034 // included header files
00035 // + standard includes
00036 #include <map>
00037 
00038 // + libraries
00039 
00040 // + local headers
00041 #include "modules.h"
00042 #include "osbaccess.h"
00043 #include "osbuser.h"
00044 #include "osbusrgrp.h"
00045 
00046 // + class declarations
00047 namespace OSB_DB {
00048     class Session;
00049 }
00050 
00051 // ************************************************************************
00052 // namespace extensions
00053 namespace OSB_LIB {
00054 
00055 // ************************************************************************
00056 // forward declarations
00057 
00058 // ************************************************************************
00059 // class definitions
00063     class UserMgmtCfg {
00064     public:
00066         static UserMgmtCfg& instance();
00067 
00068     public:
00070 
00071 
00079         bool allowed(
00080             const OsbUser::Oid& userId,
00081             const ModuleId&     module
00082         );
00092         bool allowed(
00093             const OsbUser::Oid& userId,
00094             const ModuleId&     module,
00095             const std::string&  rootTag
00096         );
00098 
00099     public:
00101 
00102 
00103         const Modules& modules() const;
00111         const Module& get(ModuleId id) const;
00118         void readModules(const OSB_DB::Session& session);
00125         void readModuleAccess(const OSB_DB::Session& session);
00134         void expModuleAccess(std::ostream& os) const;
00136 
00138 
00139 
00151         void insert(
00152             const OSB_DB::Session& session,
00153                   ModAccess&       access
00154         );
00155 
00164         void remove(
00165             const OSB_DB::Session& session,
00166                   ModAccess        access
00167         );
00169 
00170     public:
00172 
00173 
00186         bool login(
00187             const OSB_DB::Session& session,
00188                   OsbUser&         user
00189         );
00197         const OsbUser& get(const OsbUser::Oid& userId) const;
00198 
00200         const Users& users() const;
00201 
00210         const OsbUser& read(
00211             const OSB_DB::Session& session,
00212             const OsbUser::Oid&    userId
00213         );
00214 
00216         void readUsers(const OSB_DB::Session& session);
00218         bool usersRead() const;
00219 
00233         void save(
00234             const OSB_DB::Session& session,
00235                   OsbUser&         user
00236         );
00237 
00251         bool remove(
00252             const OSB_DB::Session& session,
00253             const OsbUser::Oid     userId
00254         );
00256 
00257     public:
00259 
00260 
00261         const UserGroups& groups() const;
00269         const UserGroup& get(const UserGroup::Oid& grpId) const;
00270 
00277         void readGroups(const OSB_DB::Session& session);
00278 
00292         void save(
00293             const OSB_DB::Session& session,
00294                   UserGroup&       grp
00295         );
00296 
00310         bool remove(
00311             const OSB_DB::Session& session,
00312             const UserGroup::Oid   grpId
00313         );
00315 
00317 
00318 
00331         void insert(
00332             const OSB_DB::Session& session,
00333                   GrpAccess&       access
00334         );
00335 
00344         void remove(
00345             const OSB_DB::Session& session,
00346                   GrpAccess        access
00347         );
00349 
00350     private:
00357         void readGroupAccess(
00358             const OSB_DB::Session& session,
00359             const ModuleId         moduleId
00360         );
00361 
00362     private:
00364         UserMgmtCfg();
00366         ~UserMgmtCfg();
00368         UserMgmtCfg(const UserMgmtCfg&);
00369 
00370     private:
00375         struct Destroy {
00377             ~Destroy();
00378         };                              // struct Destroy
00380         friend struct Destroy;
00381 
00382     private:
00384         Modules modules_;
00386         Users users_;
00388         UserGroups groups_;
00389 
00390     private:
00392         static UserMgmtCfg* instance_;
00394         static Destroy destroy_;
00395     };                                  // class UserMgmtCfg
00396 }                                       // namespace OSB_LIB
00397 
00398 // ************************************************************************
00399 // inline definitions
00400 namespace OSB_LIB {
00401 }                                       // namespace OSB_LIB
00402 #endif                                  // #ifndef _USERMGMT_H_

Generated on Sat Sep 2 14:06:35 2006 for OSB Library by  doxygen 1.4.7