mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 12:37:51 +02:00
Use WordPress user roles as domain groups
This commit is contained in:
parent
3a43283e7b
commit
60048162c0
2 changed files with 8 additions and 18 deletions
|
@ -531,7 +531,6 @@ SharedNodePointer DomainGatekeeper::processAgentConnectRequest(const NodeConnect
|
||||||
nodeConnection.senderSockAddr)) {
|
nodeConnection.senderSockAddr)) {
|
||||||
// User's domain identity is confirmed.
|
// User's domain identity is confirmed.
|
||||||
verifiedDomainUsername = domainUsername;
|
verifiedDomainUsername = domainUsername;
|
||||||
getDomainGroupMemberships(verifiedDomainUsername);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// User's domain identity didn't check out.
|
// User's domain identity didn't check out.
|
||||||
|
@ -1108,20 +1107,6 @@ void DomainGatekeeper::getIsGroupMemberErrorCallback(QNetworkReply* requestReply
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DomainGatekeeper::getDomainGroupMemberships(const QString& domainUserName) {
|
|
||||||
|
|
||||||
// ####### TODO: Get user's domain group memberships (WordPress roles) from domain. [plugin groups]
|
|
||||||
// This may be able to be provided at the same time as the "authenticate user" call to the domain API, in which case
|
|
||||||
// a copy of some of the following code can be made there. However, this code is still needed for refreshing groups.
|
|
||||||
|
|
||||||
// ####### TODO: Check how often this method and the WordPress API is called. [plugin groups]
|
|
||||||
|
|
||||||
QStringList wordpressGroupsForUser;
|
|
||||||
wordpressGroupsForUser << "silVER" << "gold" << "coal";
|
|
||||||
_domainGroupMemberships[domainUserName] = wordpressGroupsForUser;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void DomainGatekeeper::getDomainOwnerFriendsList() {
|
void DomainGatekeeper::getDomainOwnerFriendsList() {
|
||||||
JSONCallbackParameters callbackParams;
|
JSONCallbackParameters callbackParams;
|
||||||
callbackParams.callbackReceiver = this;
|
callbackParams.callbackReceiver = this;
|
||||||
|
@ -1282,13 +1267,19 @@ void DomainGatekeeper::requestDomainUserFinished() {
|
||||||
|
|
||||||
if (200 <= httpStatus && httpStatus < 300) {
|
if (200 <= httpStatus && httpStatus < 300) {
|
||||||
|
|
||||||
QString username = rootObject["username"].toString().toLower();
|
QString username = rootObject.value("username").toString().toLower();
|
||||||
if (_inFlightDomainUserIdentityRequests.contains(username)) {
|
if (_inFlightDomainUserIdentityRequests.contains(username)) {
|
||||||
// Success! Verified user.
|
// Success! Verified user.
|
||||||
_verifiedDomainUserIdentities.insert(username, _inFlightDomainUserIdentityRequests.value(username));
|
_verifiedDomainUserIdentities.insert(username, _inFlightDomainUserIdentityRequests.value(username));
|
||||||
_inFlightDomainUserIdentityRequests.remove(username);
|
_inFlightDomainUserIdentityRequests.remove(username);
|
||||||
|
|
||||||
// ####### TODO: Handle roles.
|
// User user's WordPress roles as domain groups.
|
||||||
|
QStringList domainUserGroups;
|
||||||
|
auto userRoles = rootObject.value("roles").toArray();
|
||||||
|
foreach (auto role, userRoles) {
|
||||||
|
domainUserGroups.append(role.toString());
|
||||||
|
}
|
||||||
|
_domainGroupMemberships[username] = domainUserGroups;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Failure.
|
// Failure.
|
||||||
|
|
|
@ -158,7 +158,6 @@ private:
|
||||||
DomainUserIdentities _inFlightDomainUserIdentityRequests; // Domain user identity requests currently in progress.
|
DomainUserIdentities _inFlightDomainUserIdentityRequests; // Domain user identity requests currently in progress.
|
||||||
DomainUserIdentities _verifiedDomainUserIdentities; // Verified domain users.
|
DomainUserIdentities _verifiedDomainUserIdentities; // Verified domain users.
|
||||||
|
|
||||||
void getDomainGroupMemberships(const QString& domainUserName);
|
|
||||||
QHash<QString, QStringList> _domainGroupMemberships; // <domainUserName, [domainGroupName]>
|
QHash<QString, QStringList> _domainGroupMemberships; // <domainUserName, [domainGroupName]>
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue