ImagingTools Core SDK
IUserInfo.h
1// SPDX-License-Identifier: LGPL-2.1-or-later OR GPL-2.0-or-later OR GPL-3.0-or-later OR LicenseRef-ImtCore-Commercial
2#pragma once
3
4
5// ImtCore includes
6#include <imtauth/IUserGroupInfo.h>
7#include <imtauth/IUserBaseInfo.h>
8
9
10namespace imtauth
11{
12
13
18class IUserInfo: virtual public IUserBaseInfo
19{
20public:
21 enum MetaInfoTypes
22 {
23 MIT_EMAIL = MIT_ROLES + 1,
24 MIT_GROUPS,
25 MIT_SYSTEM_ID,
26 MIT_SYSTEM_NAME,
27 MIT_PASSWORD_HASH,
28 };
29
30 struct SystemInfo
31 {
32 QByteArray systemId;
33 QString systemName;
34 bool enabled = true;
35
36 bool operator == (const SystemInfo& other) const
37 {
38 return (systemId == other.systemId) && (systemName == other.systemName) && (enabled == other.enabled);
39 }
40
41 bool operator != (const SystemInfo& other) const
42 {
43 return !(*this == other);
44 }
45 };
46
47 typedef QList<SystemInfo> SystemInfoList;
48
52 virtual QByteArray GetPasswordHash() const = 0;
53
57 virtual void SetPasswordHash(const QByteArray& passwordHash) = 0;
58
62 virtual QString GetMail() const = 0;
63
67 virtual void SetMail(const QString& mail) = 0;
68
72 virtual bool IsAdmin() const = 0;
73
77 virtual IUserGroupInfo::GroupIds GetGroups() const = 0;
78
82 virtual void AddToGroup(const QByteArray& groupId) = 0;
83
87 virtual bool RemoveFromGroup(const QByteArray& groupId) = 0;
88
92 virtual SystemInfoList GetSystemInfos() const = 0;
93
97 virtual bool AddToSystem(SystemInfo systemInfo) = 0;
98
102 virtual bool RemoveFromSystem(const QByteArray& systemId) = 0;
103};
104
105
106typedef istd::TUniqueInterfacePtr<IUserInfo> IUserInfoUniquePtr;
107typedef istd::TSharedInterfacePtr<IUserInfo> IUserInfoSharedPtr;
108
109
110} // namespace imtauth
111
112
virtual bool IsAdmin() const =0
virtual bool RemoveFromGroup(const QByteArray &groupId)=0
virtual void AddToGroup(const QByteArray &groupId)=0
virtual IUserGroupInfo::GroupIds GetGroups() const =0
virtual QString GetMail() const =0
virtual QByteArray GetPasswordHash() const =0
virtual void SetPasswordHash(const QByteArray &passwordHash)=0
virtual bool AddToSystem(SystemInfo systemInfo)=0
virtual bool RemoveFromSystem(const QByteArray &systemId)=0
virtual SystemInfoList GetSystemInfos() const =0
virtual void SetMail(const QString &mail)=0