-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathobjectdata.cpp
More file actions
125 lines (109 loc) · 2.9 KB
/
Copy pathobjectdata.cpp
File metadata and controls
125 lines (109 loc) · 2.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#include "common.h"
#include "objectdata.h"
const char* attributeNames[]
{
"name",
"dn",
"cn",
"distinguishedName",
"showInAdvancedViewOnly",
"objectCategory",
"objectClass",
"objectGUID",
"objectSid",
"uSNChanged",
"uSNCreated",
"whenChanged",
"whenCreated",
"instanceType",
"adminCount",
"sAMAccountName",
"sAMAccountType",
"description",
"userAccountControl",
"codePage",
"countryCode",
"accountExpires",
"lastLogoff",
"lastLogon",
"logonCount",
"primaryGroupID",
"badPwdCount",
"badPasswordTime",
"pwdLastSet",
"member",
"memberOf",
"systemFlags",
"isCriticalSystemObject"
};
const char* attributeTypes[] {
"Boolean",
"Integer",
"Enumeration",
"LargeInteger",
"ObjectAccessPoint",
"ObjectDNString",
"ObjectORName",
"ObjectDNBinary",
"ObjectDSDN",
"ObjectPresentationAddress",
"ObjectReplicaLink",
"StringCase",
"StringIA5",
"StringNTSecDesc",
"StringNumeric",
"StringObjectIdentifier",
"StringOctet",
"StringPrintable",
"StringSid",
"StringTeletex",
"StringUnicode",
"StringUTCTime",
"StringGeneralizedTime"
};
QString attributeName(AttributeName attr)
{
if (attr >= UnknownAttr)
return QString("UknownAttributeName");
return QString(attributeNames[attr]);
}
QString attributeType(AttributeType attrType)
{
if (attrType >= UnknownAttributeType)
return QString("UnknownAttributeType");
return QString(attributeTypes[attrType]);
}
AttributeType attributeTypeByTypeName(QString type)
{
for (unsigned int attrType = 0; attrType < UnknownAttributeType; attrType++)
{
if (type == attributeTypes[attrType])
return (AttributeType) attrType;
}
return UnknownAttributeType;
}
ObjectData::ObjectData()
{
}
QVariant ObjectData::value(AttributeName attrType) const
{
// qDebug() << "ObjectData::value for attr: " << attrType;
const Attribute val(ObjectMap::value(attributeName(attrType)));
// qDebug() << "ObjectData::value size: " << val.size();
if (val.size() <= 0)
return QString("UnknownAttr");
return val.first();
}
void ObjectData::insert(AttributeName attrName, AttributeType attrType, QString val) {
QString attr = attributeName(attrName);
QString type = attributeType(attrType);
qDebug() << "ObjectData::insert for attrName: " << attrName << val << type;
ObjectMap::insert(attr, Attribute(val, attrType));
qDebug() << "ObjectData::insert inserted: " << values(attributeName(attrName));
}
void ObjectData::insert(QString attr, QString type, QString val) {
AttributeType attrType = attributeTypeByTypeName(type);
qDebug() << "ObjectData::insert for attr: " << attr << val << type;
ObjectMap::insert(attr, Attribute(val, attrType));
qDebug() << "ObjectData::insert inserted by name: " << values(attr);
}