CUserLoginComp.h
Go to the documentation of this file.
1 #ifndef iauth_CUserLoginComp_included
2 #define iauth_CUserLoginComp_included
3 
4 
5 // ACF includes
6 #include "imod/TModelWrap.h"
7 #include "icomp/CComponentBase.h"
8 
9 // ACF-Solutions includes
10 #include "iauth/IRightsProvider.h"
11 #include "iauth/ILogin.h"
12 #include "iauth/IUsersManager.h"
13 #include "iauth/IPasswordChanger.h"
14 
15 
16 namespace iauth
17 {
18 
23  public icomp::CComponentBase,
24  virtual public ILogin,
25  virtual public IRightsProvider
26 {
27 public:
29 
30  I_BEGIN_COMPONENT(CUserLoginComp);
31  I_REGISTER_INTERFACE(IRightsProvider);
32  I_REGISTER_INTERFACE(ILogin);
33  I_REGISTER_INTERFACE(ILogin);
34  I_ASSIGN_MULTI_0(m_userLevelsIfPtr, "UserLevels", "User levels", true);
35  I_ASSIGN(m_usersManagerIfPtr, "UsersManager", "Users manager", true, "UsersManager");
36  I_ASSIGN(m_passwordChangerIfPtr, "PasswordChanger", "Passwort manager", false, "PasswordChanger");
37  I_END_COMPONENT;
38 
39  // reimplemented (iauth::ILogin)
40  virtual CUser* GetLoggedUser() const;
41  virtual bool Login(const QString& userName, const QString& password);
42  virtual bool Logout();
43 
44  // reimplemented (iauth::IRightsProvider)
45  virtual bool HasRight(
46  const QByteArray& operationId,
47  bool beQuiet = false) const;
48 
49 private:
50  I_MULTIREF(IRightsProvider, m_userLevelsIfPtr);
51  I_REF(IUsersManager, m_usersManagerIfPtr);
52  I_REF(IPasswordChanger, m_passwordChangerIfPtr);
53 
54  QString m_loggedUserName;
55 };
56 
57 
58 } // namespace iauth
59 
60 
61 #endif // !iauth_CUserLoginComp_included
62 
63 
virtual CUser * GetLoggedUser() const
Returns the currently logged on user.
icomp::CComponentBase BaseClass
Implementation of user login allowing to get rights for current logged user.
virtual bool HasRight(const QByteArray &operationId, bool beQuiet=false) const
Checks if user has rights for specific operation.
virtual bool Logout()
Log in user.
virtual bool Login(const QString &userName, const QString &password)
Log in user.
Provide management of users.
Definition: IUsersManager.h:23

© 2007-2011 Witold Gantzke and Kirill Lepskiy