|
signon
8.40
|
00001 /* 00002 * This file is part of signon 00003 * 00004 * Copyright (C) 2009-2010 Nokia Corporation. 00005 * 00006 * Contact: Aurel Popirtac <ext-aurel.popirtac@nokia.com> 00007 * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> 00008 * 00009 * This library is free software; you can redistribute it and/or 00010 * modify it under the terms of the GNU Lesser General Public License 00011 * version 2.1 as published by the Free Software Foundation. 00012 * 00013 * This library is distributed in the hope that it will be useful, but 00014 * WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 * Lesser General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public 00019 * License along with this library; if not, write to the Free Software 00020 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 00021 * 02110-1301 USA 00022 */ 00023 #ifndef SIGNONIDENTITYINFO_H 00024 #define SIGNONIDENTITYINFO_H 00025 00026 #include <QMap> 00027 #include <QStringList> 00028 #include <QVariant> 00029 00030 #include "signond/signoncommon.h" 00031 00032 namespace SignonDaemonNS { 00033 00034 typedef QString MethodName; 00035 typedef QStringList MechanismsList; 00036 typedef QMap<MethodName, MechanismsList> MethodMap; 00037 00043 struct SignonIdentityInfo 00044 { 00045 SignonIdentityInfo(); 00046 SignonIdentityInfo(const QVariantMap &info); 00047 SignonIdentityInfo(const quint32 id, 00048 const QString &userName, 00049 const QString &password, 00050 const bool storePassword, 00051 const QString &caption, 00052 const MethodMap &methods, 00053 const QStringList &realms = QStringList(), 00054 const QStringList &accessControlList = QStringList(), 00055 const QStringList &ownerList = QStringList(), 00056 int type = 0, 00057 int refCount = 0, 00058 bool validated = false); 00059 00060 const QList<QVariant> toVariantList(); 00061 const QVariantMap toMap() const; 00062 00063 bool operator== (const SignonIdentityInfo &other) const; 00064 SignonIdentityInfo &operator=(const SignonIdentityInfo &other); 00065 00066 void setNew() { m_id = SIGNOND_NEW_IDENTITY; } 00067 bool isNew() const { return m_id == SIGNOND_NEW_IDENTITY; } 00068 void setId(quint32 id) { m_id = id; } 00069 quint32 id() const { return m_id; } 00070 00071 void setUserName(const QString &userName) { m_userName = userName; } 00072 QString userName() const { return m_userName; } 00073 void setUserNameSecret(bool secret) { m_isUserNameSecret = secret; } 00074 bool isUserNameSecret() const { return m_isUserNameSecret; } 00075 00076 void setPassword(const QString &password) { m_password = password; } 00077 QString password() const { return m_password; } 00078 bool storePassword() const { return m_storePassword; } 00079 00080 void setCaption(const QString &caption) { m_caption = caption; } 00081 QString caption() const { return m_caption; } 00082 00083 void setRealms(const QStringList &realms) { m_realms = realms; } 00084 QStringList realms() const { return m_realms; } 00085 00086 void setMethods(const MethodMap &methods) 00087 { m_methods = methods; } 00088 MethodMap methods() const { return m_methods; } 00089 00090 void setAccessControlList(const QStringList &acl) 00091 { m_accessControlList = acl; } 00092 QStringList accessControlList() const { return m_accessControlList; } 00093 00094 void setValidated(bool validated) { m_validated = validated; } 00095 bool validated() const { return m_validated; } 00096 00097 void setType(const int type) { m_type = type; } 00098 int type() const { return m_type; } 00099 00100 void setOwnerList(const QStringList &owner) { m_ownerList = owner; } 00101 QStringList ownerList() const { return m_ownerList; } 00102 00103 bool checkMethodAndMechanism(const QString &method, 00104 const QString &mechanism, 00105 QString &allowedMechanism); 00106 00107 private: 00108 quint32 m_id; 00109 QString m_userName; 00110 QString m_password; 00111 bool m_storePassword; 00112 QString m_caption; 00113 MethodMap m_methods; 00114 QStringList m_realms; 00115 QStringList m_accessControlList; 00116 QStringList m_ownerList; 00117 int m_type; 00118 int m_refCount; 00119 bool m_validated; 00120 bool m_isUserNameSecret; 00121 }; //struct SignonIdentityInfo 00122 00123 } //namespace SignonDaemonNS 00124 00125 Q_DECLARE_METATYPE(SignonDaemonNS::MethodMap) 00126 00127 #endif // SIGNONIDENTITYINFO_H