mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
core: remove PRIV_REGISTER_USER for default user
This commit is contained in:
1 parent
6c5a73dae4
commit
eba6b7f484
3 files changed
+13
-2
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydrooj",
|
||||
"version": "3.11.18",
|
||||
"version": "3.11.19",
|
||||
"bin": "bin/hydrooj.js",
|
||||
"main": "src/loader",
|
||||
"module": "src/loader",
|
||||
|
||||
@@ -263,7 +263,6 @@ export const PRIV = {
|
||||
};
|
||||
|
||||
PRIV.PRIV_DEFAULT = PRIV.PRIV_USER_PROFILE
|
||||
+ PRIV.PRIV_REGISTER_USER
|
||||
+ PRIV.PRIV_READ_PRETEST_DATA_SELF
|
||||
+ PRIV.PRIV_CREATE_FILE
|
||||
+ PRIV.PRIV_DELETE_FILE_SELF
|
||||
|
||||
@@ -703,6 +703,18 @@ const scripts: UpgradeScript[] = [
|
||||
}
|
||||
return true;
|
||||
},
|
||||
async function _61_62() {
|
||||
const _FRESH_INSTALL_IGNORE = 1;
|
||||
const priv = +system.get('default.priv');
|
||||
if (priv & PRIV.PRIV_REGISTER_USER) {
|
||||
const udocs = await user.getMulti({ priv }).project({ _id: 1 }).toArray();
|
||||
for (const udoc of udocs) {
|
||||
await user.setById(udoc._id, { priv: priv - PRIV.PRIV_REGISTER_USER });
|
||||
}
|
||||
await system.set('default.priv', priv - PRIV.PRIV_REGISTER_USER);
|
||||
}
|
||||
return true;
|
||||
},
|
||||
];
|
||||
|
||||
export default scripts;
|
||||
Reference in new issue
Block a user