mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
更新权限节点
This commit is contained in:
1 parent
e092efca20
commit
b22082beba
16 files changed
+88
-87
No files matched your search
+17
-6
@@ -15,12 +15,23 @@ const coll = db.collection('domain');
|
||||
* @param {string} domainId
|
||||
* @param {number} owner
|
||||
*/
|
||||
function add(domainId, owner, name) {
|
||||
const tasks = [
|
||||
coll.insertOne({
|
||||
_id: domainId, owner, name, bulletin: '',
|
||||
}),
|
||||
];
|
||||
function add(domainId, owner, name, isEnsure = false) {
|
||||
const tasks = [];
|
||||
if (isEnsure) {
|
||||
tasks.push(
|
||||
coll.updateOne(
|
||||
{ _id: domainId },
|
||||
{ $set: { owner }, $setOnInsert: { name, bulletin: '' } },
|
||||
{ upsert: true },
|
||||
),
|
||||
);
|
||||
} else {
|
||||
tasks.push(
|
||||
coll.insertOne({
|
||||
_id: domainId, owner, name, bulletin: '',
|
||||
}),
|
||||
);
|
||||
}
|
||||
for (const id in builtin.BUILTIN_ROLES) {
|
||||
tasks.push(
|
||||
document.add(
|
||||
|
||||
Reference in new issue
Block a user