mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 13:07:04 +02:00
code review -- applyPermissionsForUser to setPermissionsForUser, don't take input permissions as an argument
This commit is contained in:
parent
d69d5bff28
commit
8663b260f6
2 changed files with 8 additions and 8 deletions
|
@ -120,8 +120,8 @@ void DomainGatekeeper::processConnectRequestPacket(QSharedPointer<ReceivedMessag
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NodePermissions DomainGatekeeper::applyPermissionsForUser(bool isLocalUser,
|
NodePermissions DomainGatekeeper::setPermissionsForUser(bool isLocalUser, QString verifiedUsername) {
|
||||||
NodePermissions userPerms, QString verifiedUsername) {
|
NodePermissions userPerms;
|
||||||
userPerms.setAll(false);
|
userPerms.setAll(false);
|
||||||
|
|
||||||
if (isLocalUser) {
|
if (isLocalUser) {
|
||||||
|
@ -208,9 +208,9 @@ void DomainGatekeeper::updateNodePermissions() {
|
||||||
auto limitedNodeList = DependencyManager::get<LimitedNodeList>();
|
auto limitedNodeList = DependencyManager::get<LimitedNodeList>();
|
||||||
limitedNodeList->eachNode([this, limitedNodeList, &nodesToKill](const SharedNodePointer& node){
|
limitedNodeList->eachNode([this, limitedNodeList, &nodesToKill](const SharedNodePointer& node){
|
||||||
// the id and the username in NodePermissions will often be the same, but id is set before
|
// the id and the username in NodePermissions will often be the same, but id is set before
|
||||||
// authentication and username is only set once they user's key has been confirmed.
|
// authentication and verifiedUsername is only set once they user's key has been confirmed.
|
||||||
QString username = node->getPermissions().getVerifiedUserName();
|
QString verifiedUsername = node->getPermissions().getVerifiedUserName();
|
||||||
NodePermissions userPerms(NodePermissionsKey(username, 0));
|
NodePermissions userPerms(NodePermissionsKey(verifiedUsername, 0));
|
||||||
|
|
||||||
if (node->getPermissions().isAssignment) {
|
if (node->getPermissions().isAssignment) {
|
||||||
// this node is an assignment-client
|
// this node is an assignment-client
|
||||||
|
@ -224,7 +224,7 @@ void DomainGatekeeper::updateNodePermissions() {
|
||||||
const QHostAddress& addr = node->getLocalSocket().getAddress();
|
const QHostAddress& addr = node->getLocalSocket().getAddress();
|
||||||
bool isLocalUser = (addr == limitedNodeList->getLocalSockAddr().getAddress() ||
|
bool isLocalUser = (addr == limitedNodeList->getLocalSockAddr().getAddress() ||
|
||||||
addr == QHostAddress::LocalHost);
|
addr == QHostAddress::LocalHost);
|
||||||
userPerms = applyPermissionsForUser(isLocalUser, userPerms, username);
|
userPerms = setPermissionsForUser(isLocalUser, verifiedUsername);
|
||||||
}
|
}
|
||||||
|
|
||||||
node->setPermissions(userPerms);
|
node->setPermissions(userPerms);
|
||||||
|
@ -330,7 +330,7 @@ SharedNodePointer DomainGatekeeper::processAgentConnectRequest(const NodeConnect
|
||||||
return SharedNodePointer();
|
return SharedNodePointer();
|
||||||
}
|
}
|
||||||
|
|
||||||
userPerms = applyPermissionsForUser(isLocalUser, userPerms, verifiedUsername);
|
userPerms = setPermissionsForUser(isLocalUser, verifiedUsername);
|
||||||
|
|
||||||
if (!userPerms.can(NodePermissions::Permission::canConnectToDomain)) {
|
if (!userPerms.can(NodePermissions::Permission::canConnectToDomain)) {
|
||||||
sendConnectionDeniedPacket("You lack the required permissions to connect to this domain.",
|
sendConnectionDeniedPacket("You lack the required permissions to connect to this domain.",
|
||||||
|
|
|
@ -106,7 +106,7 @@ private:
|
||||||
QSet<QString> _domainOwnerFriends; // keep track of friends of the domain owner
|
QSet<QString> _domainOwnerFriends; // keep track of friends of the domain owner
|
||||||
QSet<QString> _inFlightGroupMembershipsRequests; // keep track of which we've already asked for
|
QSet<QString> _inFlightGroupMembershipsRequests; // keep track of which we've already asked for
|
||||||
|
|
||||||
NodePermissions applyPermissionsForUser(bool isLocalUser, NodePermissions userPerms, QString verifiedUsername);
|
NodePermissions setPermissionsForUser(bool isLocalUser, QString verifiedUsername);
|
||||||
void getGroupMemberships(const QString& username);
|
void getGroupMemberships(const QString& username);
|
||||||
// void getIsGroupMember(const QString& username, const QUuid groupID);
|
// void getIsGroupMember(const QString& username, const QUuid groupID);
|
||||||
void getDomainOwnerFriendsList();
|
void getDomainOwnerFriendsList();
|
||||||
|
|
Loading…
Reference in a new issue