chack admin fix

This commit is contained in:
jusax23 2023-03-30 14:50:03 +02:00
parent d5a00164bb
commit 86748b97e0
Signed by: jusax23
GPG key ID: 499E2AA870C1CD41

View file

@ -86,14 +86,13 @@ export class Client {
let query = await select([rooms.roomID, rooms.owner, rooms.rights, roomMembers.admin], innerJoinUsing(rooms, roomMembers, rooms.roomID, roomMembers.roomID)) let query = await select([rooms.roomID, rooms.owner, rooms.rights, roomMembers.admin], innerJoinUsing(rooms, roomMembers, rooms.roomID, roomMembers.roomID))
.where(and( .where(and(
eq(rooms.name, name), eq(rooms.name, name),
eq(roomMembers.admin, true),
eq(roomMembers.name, this.name), eq(roomMembers.name, this.name),
eq(roomMembers.server, this.state == STATE.client ? "local" : this.server.tag) eq(roomMembers.server, this.state == STATE.client ? "local" : this.server.tag)
)) ))
.query(db); .query(db);
if (query.length == 0) return -1; if (query.length == 0) return -1;
if ( if (
query[0][roomMembers.admin] == 0 !query[0][roomMembers.admin]
&& query[0][rooms.owner] != this.accID && query[0][rooms.owner] != this.accID
&& !(query[0][rooms.rights] & roomRightRequires) && !(query[0][rooms.rights] & roomRightRequires)
) return -1; ) return -1;