CUsersManagerComp.h
Go to the documentation of this file.
1 #ifndef iauth_CUsersManagerComp_included
2 #define iauth_CUsersManagerComp_included
3 
4 
5 // Qt includes
6 #include <QtCore/QVector>
7 
8 // ACF includes
9 #include "iser/CArchiveTag.h"
10 #include "icomp/CComponentBase.h"
11 
12 // ACF-Solutions includes
13 #include "iauth/IUsersManager.h"
14 #include "iauth/CUser.h"
15 
16 
17 namespace iauth
18 {
19 
20 
25  public icomp::CComponentBase,
26  virtual public IUsersManager
27 {
28 public:
30 
31  I_BEGIN_COMPONENT(CUsersManagerComp);
32  I_REGISTER_INTERFACE(IUsersManager);
33  I_REGISTER_INTERFACE(iser::ISerializable);
34  I_ASSIGN_MULTI_0(m_userLevelNamesAttrPtr, "UserLevelNames", "Names of the user levels", false);
35  I_ASSIGN_MULTI_0(m_defaultUsersAttrPtr, "DefaultUsers", "List of default users", false);
36  I_ASSIGN_MULTI_0(m_defaultUserPasswordsAttrPtr, "DefaultUserPasswords", "List of default user passwords", false);
37  I_ASSIGN_MULTI_0(m_defaultUserLevelsAttrPtr, "DefaultUserLevels", "Default user levels", false);
38  I_END_COMPONENT;
39 
40  void Reset();
41 
42  // reimplemented (iauth::IUsersManager)
43  virtual int GetUsersCount() const;
44  virtual int FindUserIndex(const QString& name) const;
45  virtual const CUser& GetUser(int index) const;
46  virtual CUser& GetUserRef(int index);
47  virtual CUser* AddUser(const QString& name);
48  virtual bool DeleteUser(const QString& name);
49  virtual bool RenameUser(int userIndex, const QString& userName);
50  virtual int GetUserGroupsCount() const;
51  virtual const QString& GetUserGroupName(int groupIndex) const;
52 
53  // reimplemented (iser::ISerializable)
54  virtual bool Serialize(iser::IArchive& archive);
55 
56 protected:
57  // reimplemented (icomp::CComponentBase)
58  virtual void OnComponentCreated();
59 
60 private:
61  I_MULTIATTR(QString, m_userLevelNamesAttrPtr);
62  I_MULTIATTR(QString, m_defaultUsersAttrPtr);
63  I_MULTIATTR(QString, m_defaultUserPasswordsAttrPtr);
64  I_MULTIATTR(int, m_defaultUserLevelsAttrPtr);
65 
66  typedef QVector<CUser> Users;
67  Users m_users;
68 
69  typedef QVector<QString> UserLevels;
70  UserLevels m_userLevels;
71 };
72 
73 
74 } // namespace iauth
75 
76 
77 #endif // !iauth_CUsersManagerComp_included
78 
79 
virtual bool Serialize(iser::IArchive &archive)
icomp::CComponentBase BaseClass
virtual int FindUserIndex(const QString &name) const
Search for user with specified name.
virtual void OnComponentCreated()
virtual const CUser & GetUser(int index) const
Get user using its index.
virtual CUser * AddUser(const QString &name)
Add a new user to the user list.
virtual int GetUsersCount() const
Get number of users in this collection.
virtual CUser & GetUserRef(int index)
Get reference to user object using its index.
Allows manage of list of users.
virtual bool RenameUser(int userIndex, const QString &userName)
The method renames the user.
virtual int GetUserGroupsCount() const
Get number of user groups.
virtual const QString & GetUserGroupName(int groupIndex) const
Get number of user groups.
virtual bool DeleteUser(const QString &name)
Delete the user with the user name.
Provide management of users.
Definition: IUsersManager.h:23

© 2007-2011 Witold Gantzke and Kirill Lepskiy