ICF 3.0.5.47
Technical documentation of ICF Libraries
CUsersManagerComp.h
Go to the documentation of this file.
1/********************************************************************************
2** This file is part of the ICF Framework. Copyright (C) Witold Gantzke & Kirill Lepskiy
3** ICF Framework may be used under the terms of the LGPL License v. 2.1 by the Free Software Foundation.
4********************************************************************************/
5
6#pragma once
7
8
9// Qt includes
10#include <QtCore/QVector>
11
12// ICF includes
13#include <iser/CArchiveTag.h>
15#include <iauth/IUsersManager.h>
16#include <iauth/CUser.h>
17
18
19namespace iauth
20{
21
22
28 virtual public IUsersManager
29{
30public:
32
33 I_BEGIN_COMPONENT(CUsersManagerComp);
34 I_REGISTER_INTERFACE(IUsersManager);
35 I_REGISTER_INTERFACE(iser::ISerializable);
36 I_ASSIGN_MULTI_0(m_userLevelNamesAttrPtr, "UserLevelNames", "Names of the user levels", false);
37 I_ASSIGN_MULTI_0(m_defaultUsersAttrPtr, "DefaultUsers", "List of default users", false);
38 I_ASSIGN_MULTI_0(m_defaultUserPasswordsAttrPtr, "DefaultUserPasswords", "List of default user passwords", false);
39 I_ASSIGN_MULTI_0(m_defaultUserLevelsAttrPtr, "DefaultUserLevels", "Default user levels", false);
40 I_END_COMPONENT;
41
43
44 // reimplemented (iauth::IUsersManager)
45 int GetUsersCount() const override;
46 int FindUserIndex(const QString& name) const override;
47 const CUser& GetUser(int index) const override;
48 CUser& GetUserRef(int index) override;
49 CUser* AddUser(const QString& name) override;
50 bool DeleteUser(const QString& name) override;
51 bool RenameUser(int userIndex, const QString& userName) override;
52 int GetUserGroupsCount() const override;
53 const QString& GetUserGroupName(int groupIndex) const override;
54
55 // reimplemented (iser::ISerializable)
56 bool Serialize(iser::IArchive& archive) override;
57
58protected:
59 // reimplemented (icomp::CComponentBase)
60 void OnComponentCreated() override;
61
62private:
63 I_MULTITEXTATTR(m_userLevelNamesAttrPtr);
64 I_MULTIATTR(QString, m_defaultUsersAttrPtr);
65 I_MULTIATTR(QString, m_defaultUserPasswordsAttrPtr);
66 I_MULTIATTR(int, m_defaultUserLevelsAttrPtr);
67
68 typedef QVector<CUser> Users;
69 Users m_users;
70
71 typedef QVector<QString> UserLevels;
72 UserLevels m_userLevels;
73};
74
75
76} // namespace iauth
77
78
Allows manage of list of users.
int GetUserGroupsCount() const override
Get number of user groups.
icomp::CComponentBase BaseClass
CUser * AddUser(const QString &name) override
Add a new user to the user list.
bool DeleteUser(const QString &name) override
Delete the user with the user name.
bool Serialize(iser::IArchive &archive) override
Load or store state of this object as a archive stream.
const CUser & GetUser(int index) const override
Get user using its index.
bool RenameUser(int userIndex, const QString &userName) override
The method renames the user.
void OnComponentCreated() override
const QString & GetUserGroupName(int groupIndex) const override
Get number of user groups.
CUser & GetUserRef(int index) override
Get reference to user object using its index.
int GetUsersCount() const override
Get number of users in this collection.
int FindUserIndex(const QString &name) const override
Search for user with specified name.
Provide management of users.
Base class for component implementation.
Represent input/output persistence archive.
Definition IArchive.h:33
Common class for all classes which objects can be archived or restored from archive.
#define I_MULTITEXTATTR(member)
Declare translatable multiple text attribute member.
Contains implementations of interfaces and components related to right management.

© Witold Gantzke and Kirill Lepskiy