Skip to content

Commit d8857cb

Browse files
committed
Merge pull request #44 from owncloud/improve-graph
Add memberOf field to /users endpoint
1 parent 7f7c9cf commit d8857cb

File tree

4 files changed

+69
-10
lines changed

4 files changed

+69
-10
lines changed

client/OAIGroup.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,11 @@ class OAIGroupPrivate {
9191
bool created_on_behalf_of_isSet;
9292
bool created_on_behalf_of_isValid;
9393

94-
QList<OAIDirectoryObject> member_of;
94+
QList<OAIGroup> member_of;
9595
bool member_of_isSet;
9696
bool member_of_isValid;
9797

98-
QList<OAIDirectoryObject> members;
98+
QList<OAIUser> members;
9999
bool members_isSet;
100100
bool members_isValid;
101101

@@ -895,14 +895,14 @@ bool OAIGroup::is_created_on_behalf_of_Valid() const{
895895
return d->created_on_behalf_of_isValid;
896896
}
897897

898-
QList<OAIDirectoryObject> OAIGroup::getMemberOf() const {
898+
QList<OAIGroup> OAIGroup::getMemberOf() const {
899899
Q_D(const OAIGroup);
900900
if(!d){
901901
return {};
902902
}
903903
return d->member_of;
904904
}
905-
void OAIGroup::setMemberOf(const QList<OAIDirectoryObject> &member_of) {
905+
void OAIGroup::setMemberOf(const QList<OAIGroup> &member_of) {
906906
Q_D(OAIGroup);
907907
Q_ASSERT(d);
908908

@@ -927,14 +927,14 @@ bool OAIGroup::is_member_of_Valid() const{
927927
return d->member_of_isValid;
928928
}
929929

930-
QList<OAIDirectoryObject> OAIGroup::getMembers() const {
930+
QList<OAIUser> OAIGroup::getMembers() const {
931931
Q_D(const OAIGroup);
932932
if(!d){
933933
return {};
934934
}
935935
return d->members;
936936
}
937-
void OAIGroup::setMembers(const QList<OAIDirectoryObject> &members) {
937+
void OAIGroup::setMembers(const QList<OAIUser> &members) {
938938
Q_D(OAIGroup);
939939
Q_ASSERT(d);
940940

client/OAIGroup.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
#include "OAIDirectoryObject.h"
2828
#include "OAIDrive.h"
29+
#include "OAIUser.h"
2930
#include <QDateTime>
3031
#include <QList>
3132
#include <QSet>
@@ -36,6 +37,7 @@
3637

3738
namespace OpenAPI {
3839
class OAIDirectoryObject;
40+
class OAIUser;
3941
class OAIDrive;
4042

4143

@@ -133,13 +135,13 @@ class OAIGroup : public OAIObject {
133135
bool is_created_on_behalf_of_Set() const;
134136
bool is_created_on_behalf_of_Valid() const;
135137

136-
QList<OAIDirectoryObject> getMemberOf() const;
137-
void setMemberOf(const QList<OAIDirectoryObject> &member_of);
138+
QList<OAIGroup> getMemberOf() const;
139+
void setMemberOf(const QList<OAIGroup> &member_of);
138140
bool is_member_of_Set() const;
139141
bool is_member_of_Valid() const;
140142

141-
QList<OAIDirectoryObject> getMembers() const;
142-
void setMembers(const QList<OAIDirectoryObject> &members);
143+
QList<OAIUser> getMembers() const;
144+
void setMembers(const QList<OAIUser> &members);
143145
bool is_members_Set() const;
144146
bool is_members_Valid() const;
145147

client/OAIUser.cpp

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ class OAIUserPrivate {
9595
bool mobile_phone_isSet;
9696
bool mobile_phone_isValid;
9797

98+
QList<OAIGroup> member_of;
99+
bool member_of_isSet;
100+
bool member_of_isValid;
101+
98102
QString on_premises_distinguished_name;
99103
bool on_premises_distinguished_name_isSet;
100104
bool on_premises_distinguished_name_isValid;
@@ -260,6 +264,9 @@ void OAIUser::initializeModel() {
260264
d->mobile_phone_isSet = false;
261265
d->mobile_phone_isValid = false;
262266

267+
d->member_of_isSet = false;
268+
d->member_of_isValid = false;
269+
263270
d->on_premises_distinguished_name_isSet = false;
264271
d->on_premises_distinguished_name_isValid = false;
265272

@@ -391,6 +398,9 @@ void OAIUser::fromJsonObject(QJsonObject json) {
391398
d->mobile_phone_isValid = ::OpenAPI::fromJsonValue(d->mobile_phone, json[QString("mobilePhone")]);
392399
d->mobile_phone_isSet = !json[QString("mobilePhone")].isNull() && d->mobile_phone_isValid;
393400

401+
d->member_of_isValid = ::OpenAPI::fromJsonValue(d->member_of, json[QString("memberOf")]);
402+
d->member_of_isSet = !json[QString("memberOf")].isNull() && d->member_of_isValid;
403+
394404
d->on_premises_distinguished_name_isValid = ::OpenAPI::fromJsonValue(d->on_premises_distinguished_name, json[QString("onPremisesDistinguishedName")]);
395405
d->on_premises_distinguished_name_isSet = !json[QString("onPremisesDistinguishedName")].isNull() && d->on_premises_distinguished_name_isValid;
396406

@@ -522,6 +532,9 @@ QJsonObject OAIUser::asJsonObject() const {
522532
if (d->mobile_phone_isSet) {
523533
obj.insert(QString("mobilePhone"), ::OpenAPI::toJsonValue(d->mobile_phone));
524534
}
535+
if (d->member_of.size() > 0) {
536+
obj.insert(QString("memberOf"), ::OpenAPI::toJsonValue(d->member_of));
537+
}
525538
if (d->on_premises_distinguished_name_isSet) {
526539
obj.insert(QString("onPremisesDistinguishedName"), ::OpenAPI::toJsonValue(d->on_premises_distinguished_name));
527540
}
@@ -1135,6 +1148,38 @@ bool OAIUser::is_mobile_phone_Valid() const{
11351148
return d->mobile_phone_isValid;
11361149
}
11371150

1151+
QList<OAIGroup> OAIUser::getMemberOf() const {
1152+
Q_D(const OAIUser);
1153+
if(!d){
1154+
return {};
1155+
}
1156+
return d->member_of;
1157+
}
1158+
void OAIUser::setMemberOf(const QList<OAIGroup> &member_of) {
1159+
Q_D(OAIUser);
1160+
Q_ASSERT(d);
1161+
1162+
d->member_of = member_of;
1163+
d->member_of_isSet = true;
1164+
}
1165+
1166+
bool OAIUser::is_member_of_Set() const{
1167+
Q_D(const OAIUser);
1168+
if(!d){
1169+
return false;
1170+
}
1171+
1172+
return d->member_of_isSet;
1173+
}
1174+
1175+
bool OAIUser::is_member_of_Valid() const{
1176+
Q_D(const OAIUser);
1177+
if(!d){
1178+
return false;
1179+
}
1180+
return d->member_of_isValid;
1181+
}
1182+
11381183
QString OAIUser::getOnPremisesDistinguishedName() const {
11391184
Q_D(const OAIUser);
11401185
if(!d){
@@ -1931,6 +1976,11 @@ bool OAIUser::isSet() const {
19311976
break;
19321977
}
19331978

1979+
if (d->member_of.size() > 0) {
1980+
isObjectUpdated = true;
1981+
break;
1982+
}
1983+
19341984
if (d->on_premises_distinguished_name_isSet) {
19351985
isObjectUpdated = true;
19361986
break;

client/OAIUser.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <QJsonObject>
2626

2727
#include "OAIDrive.h"
28+
#include "OAIGroup.h"
2829
#include "OAIPasswordProfile.h"
2930
#include <QDateTime>
3031
#include <QList>
@@ -34,6 +35,7 @@
3435
#include "OAIObject.h"
3536

3637
namespace OpenAPI {
38+
class OAIGroup;
3739
class OAIPasswordProfile;
3840
class OAIDrive;
3941

@@ -137,6 +139,11 @@ class OAIUser : public OAIObject {
137139
bool is_mobile_phone_Set() const;
138140
bool is_mobile_phone_Valid() const;
139141

142+
QList<OAIGroup> getMemberOf() const;
143+
void setMemberOf(const QList<OAIGroup> &member_of);
144+
bool is_member_of_Set() const;
145+
bool is_member_of_Valid() const;
146+
140147
QString getOnPremisesDistinguishedName() const;
141148
void setOnPremisesDistinguishedName(const QString &on_premises_distinguished_name);
142149
bool is_on_premises_distinguished_name_Set() const;

0 commit comments

Comments
 (0)