From b951f6a565b2348ba3019e97529ce7e60beda130 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tom=20K=C3=A4sler?= <tom.kaesler@mni.thm.de>
Date: Fri, 2 Aug 2019 01:18:45 +0200
Subject: [PATCH] Refactor access logic

Use authentication service to determine access
TODO: weave moderator role into that
---
 src/app/components/shared/room-list/room-list.component.ts | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/app/components/shared/room-list/room-list.component.ts b/src/app/components/shared/room-list/room-list.component.ts
index 579379358..71a9bc081 100644
--- a/src/app/components/shared/room-list/room-list.component.ts
+++ b/src/app/components/shared/room-list/room-list.component.ts
@@ -42,15 +42,15 @@ export class RoomListComponent implements OnInit {
 
   getRooms(): void {
     this.roomService.getParticipantRooms().subscribe(rooms => this.updateRoomList(rooms));
-    this.roomService.getCreatorRooms().subscribe(rooms => this.updateRoomList(rooms, true));
+    this.roomService.getCreatorRooms().subscribe(rooms => this.updateRoomList(rooms));
   }
 
-  updateRoomList(rooms: Room[], isOwner: boolean = false) {
+  updateRoomList(rooms: Room[]) {
     this.rooms = this.rooms.concat(rooms);
     this.closedRooms = this.rooms.filter(room => room.closed);
     this.roomsWithRole = this.rooms.map(room => {
       const roomWithRole: RoomRoleMixin = <RoomRoleMixin>room;
-      if (isOwner) {
+      if (this.authenticationService.hasAccess(room.shortId, UserRole.CREATOR)) {
         roomWithRole.role = UserRole.CREATOR;
       } else {
         // TODO: acknowledge the other role option too
-- 
GitLab