@@ -208,8 +208,9 @@ static VPackBuilder QueryUser(aql::QueryRegistry* queryRegistry,
208
208
if (doc.isExternal ()) {
209
209
doc = doc.resolveExternals ();
210
210
}
211
-
212
- return VPackBuilder (doc);
211
+ VPackBuilder result;
212
+ result.add (doc);
213
+ return result;
213
214
}
214
215
215
216
static void ConvertLegacyFormat (VPackSlice doc, VPackBuilder& result) {
@@ -680,6 +681,7 @@ Result AuthInfo::removeAllUsers() {
680
681
Result res;
681
682
682
683
{
684
+ MUTEX_LOCKER (locker, _loadFromDBLock);
683
685
WRITE_LOCKER (guard, _authInfoLock);
684
686
685
687
for (auto const & pair : _authInfo) {
@@ -698,7 +700,6 @@ Result AuthInfo::removeAllUsers() {
698
700
699
701
// do not get into race conditions with loadFromDB
700
702
{
701
- MUTEX_LOCKER (locker, _loadFromDBLock);
702
703
_authInfo.clear ();
703
704
_authBasicCache.clear ();
704
705
_outdated = true ;
@@ -912,6 +913,17 @@ AuthLevel AuthInfo::canUseDatabase(std::string const& username,
912
913
return level;
913
914
}
914
915
916
+ AuthLevel AuthInfo::canUseDatabaseNoLock (std::string const & username,
917
+ std::string const & dbname) {
918
+ AuthLevel level = configuredDatabaseAuthLevelInternal (username, dbname, 0 );
919
+ static_assert (AuthLevel::RO < AuthLevel::RW, " ro < rw" );
920
+ if (level > AuthLevel::RO && !ServerState::writeOpsEnabled ()) {
921
+ return AuthLevel::RO;
922
+ }
923
+ return level;
924
+ }
925
+
926
+
915
927
// internal method called by configuredCollectionAuthLevel
916
928
// asserts that collection name is non-empty and already translated
917
929
// from collection id to name
@@ -986,6 +998,29 @@ AuthLevel AuthInfo::canUseCollection(std::string const& username,
986
998
return level;
987
999
}
988
1000
1001
+ AuthLevel AuthInfo::canUseCollectionNoLock (std::string const & username,
1002
+ std::string const & dbname,
1003
+ std::string const & coll) {
1004
+ if (coll.empty ()) {
1005
+ // no collection name given
1006
+ return AuthLevel::NONE;
1007
+ }
1008
+
1009
+ AuthLevel level;
1010
+ if (coll[0 ] >= ' 0' && coll[0 ] <= ' 9' ) {
1011
+ std::string tmpColl = DatabaseFeature::DATABASE->translateCollectionName (dbname, coll);
1012
+ level = configuredCollectionAuthLevelInternal (username, dbname, tmpColl, 0 );
1013
+ } else {
1014
+ level = configuredCollectionAuthLevelInternal (username, dbname, coll, 0 );
1015
+ }
1016
+
1017
+ static_assert (AuthLevel::RO < AuthLevel::RW, " ro < rw" );
1018
+ if (level > AuthLevel::RO && !ServerState::writeOpsEnabled ()) {
1019
+ return AuthLevel::RO;
1020
+ }
1021
+ return level;
1022
+ }
1023
+
989
1024
990
1025
991
1026
// public called from HttpCommTask.cpp and VstCommTask.cpp
0 commit comments