ICF 3.1.1.10
Technical documentation of ICF Libraries
CUserLoginComp.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// ICF includes
10#include <imod/TModelWrap.h>
13#include <iauth/ILogin.h>
14#include <iauth/IUsersManager.h>
16
17
18namespace iauth
19{
20
26 virtual public ILogin,
27 virtual public IRightsProvider
28{
29public:
31
32 I_BEGIN_COMPONENT(CUserLoginComp);
33 I_REGISTER_INTERFACE(IRightsProvider);
34 I_REGISTER_INTERFACE(ILogin);
35 I_ASSIGN_MULTI_0(m_userLevelsCompPtr, "UserLevels", "User levels", true);
36 I_ASSIGN(m_usersManagerCompPtr, "UsersManager", "Users manager", true, "UsersManager");
37 I_ASSIGN(m_passwordChangerCompPtr, "PasswordChanger", "Passwort manager", false, "PasswordChanger");
38 I_ASSIGN(m_defaultUserNameAttrPtr, "DefaultUserName", "Name of user will be automatically logged in", false, "Default");
39 I_END_COMPONENT;
40
41 // reimplemented (iauth::ILogin)
42 CUser* GetLoggedUser() const override;
43 bool Login(const QString& userName, const QString& password) override;
44 bool Logout() override;
45
46 // reimplemented (iauth::IRightsProvider)
48 const QByteArray& operationId,
49 bool beQuiet = false) const override;
50
51protected:
52 // reimplemented (icomp::CComponentBase)
53 void OnComponentCreated() override;
54
55private:
56 I_MULTIREF(IRightsProvider, m_userLevelsCompPtr);
57 I_REF(IUsersManager, m_usersManagerCompPtr);
58 I_REF(IPasswordChanger, m_passwordChangerCompPtr);
59 I_ATTR(QByteArray, m_defaultUserNameAttrPtr);
60
61 QString m_loggedUserName;
62};
63
64
65} // namespace iauth
66
67
Implementation of user login allowing to get rights for current logged user.
CUser * GetLoggedUser() const override
Returns the currently logged on user.
icomp::CComponentBase BaseClass
void OnComponentCreated() override
bool HasRight(const QByteArray &operationId, bool beQuiet=false) const override
Checks if user has rights for specific operation.
bool Login(const QString &userName, const QString &password) override
Log in user.
bool Logout() override
Log in user.
Provide management of users.
Base class for component implementation.
Contains implementations of interfaces and components related to right management.

© Witold Gantzke and Kirill Lepskiy