mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
core: fix set user role
This commit is contained in:
1 parent
a996b6b155
commit
5000b977d1
2 files changed
+3
-2
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydrooj",
|
||||
"version": "2.24.6",
|
||||
"version": "2.24.7",
|
||||
"bin": "bin/hydrooj.js",
|
||||
"main": "dist/loader.js",
|
||||
"typings": "dist/loader.d.ts",
|
||||
|
||||
@@ -114,7 +114,8 @@ class DomainModel {
|
||||
static async setUserRole(domainId: string, uid: MaybeArray<number>, role: string) {
|
||||
if (!(uid instanceof Array)) {
|
||||
const res = await collUser.findOneAndUpdate({ domainId, uid }, { $set: { role } }, { upsert: true, returnOriginal: false });
|
||||
deleteUserCache(res.value);
|
||||
const udoc = await UserModel.getById(domainId, uid);
|
||||
deleteUserCache(udoc);
|
||||
return res;
|
||||
}
|
||||
const filter = { domainId, uid: { $in: uid } };
|
||||
|
||||
Reference in new issue
Block a user