Skip to content

Commit 405dba8

Browse files
committed
fix admins permission
1 parent 0ec55ca commit 405dba8

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

OpenFlow/src/DatabaseConnection.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,7 +1165,6 @@ export class DatabaseConnection extends events.EventEmitter {
11651165
span?.addEvent("CleanACL");
11661166
item = await this.CleanACL(item, user, collectionname, span);
11671167
if (collectionname === "users" && item._type === "user" && !NoderedUtil.IsNullEmpty(item._id)) {
1168-
Base.addRight(item, WellknownIds.admins, "admins", [Rights.full_control]);
11691168
Base.addRight(item, item._id, item.name, [Rights.full_control]);
11701169
Base.removeRight(item, item._id, [Rights.delete]);
11711170
span?.addEvent("ensureResource");
@@ -2491,17 +2490,17 @@ export class DatabaseConnection extends events.EventEmitter {
24912490
}
24922491
item._type = item._type.toLowerCase();
24932492
if (!item._acl) { item._acl = []; }
2494-
item._acl.forEach((a, index) => {
2495-
if (typeof a.rights === "string") {
2496-
item._acl[index].rights = (new Binary(Buffer.from(a.rights, "base64"), 0) as any);
2497-
}
2498-
});
24992493
if (item._acl.length === 0) {
25002494
Base.addRight(item, WellknownIds.admins, "admins", [Rights.full_control]);
25012495
}
25022496
if (Config.force_add_admins && item._id != WellknownIds.root) {
25032497
Base.addRight(item, WellknownIds.admins, "admins", [Rights.full_control], false);
25042498
}
2499+
item._acl.forEach((a, index) => {
2500+
if (typeof a.rights === "string") {
2501+
item._acl[index].rights = (new Binary(Buffer.from(a.rights, "base64"), 0) as any);
2502+
}
2503+
});
25052504
if (DatabaseConnection.collections_with_text_index.indexOf(collection) > -1) {
25062505
if (!NoderedUtil.IsNullEmpty(item.name)) {
25072506
var name: string = item.name.toLowerCase();

0 commit comments

Comments
 (0)