diff --git a/code/ryzom/server/src/shard_unifier_service/ring_session_manager.cpp b/code/ryzom/server/src/shard_unifier_service/ring_session_manager.cpp
index a2dc72b1c..2ed06065b 100644
--- a/code/ryzom/server/src/shard_unifier_service/ring_session_manager.cpp
+++ b/code/ryzom/server/src/shard_unifier_service/ring_session_manager.cpp
@@ -648,7 +648,7 @@ namespace RSMGR
 			userAccessPriv.clear();
 			CSString query;
 			query << "SELECT AccessPrivilege FROM permission";
-			query << " WHERE UId = " << userId << " AND DomainId = " << DomainId;
+			query << " WHERE UId = " << userId << " AND DomainId = (SELECT domain_id FROM domain WHERE domain_name = '" << DomainName << "')";
 
 			if (!_NelDb.query(query))
 			{