MODERATE_FILES role can clean all files in a room, fixes #209

This commit is contained in:
Håvar Aambø Fosstveit
2020-04-22 01:07:16 +02:00
parent 7340621b6e
commit e28b6cdc5d
25 changed files with 239 additions and 25 deletions
+2
View File
@@ -235,6 +235,8 @@ module.exports =
SHARE_SCREEN : [ userRoles.NORMAL ],
// The role(s) have permission to share files
SHARE_FILE : [ userRoles.NORMAL ],
// The role(s) have permission to moderate files
MODERATE_FILES : [ userRoles.MODERATOR ],
// The role(s) have permission to moderate room (e.g. kick user)
MODERATE_ROOM : [ userRoles.MODERATOR ]
},
+18
View File
@@ -1178,6 +1178,24 @@ class Room extends EventEmitter
break;
}
case 'moderator:clearFileSharing':
{
if (
!peer.roles.some((role) => config.permissionsFromRoles.MODERATE_FILES.includes(role))
)
throw new Error('peer not authorized');
this._fileHistory = [];
// Spread to others
this._notification(peer.socket, 'moderator:clearFileSharing', null, true);
// Return no error
cb();
break;
}
case 'raiseHand':
{
const { raisedHand } = request.data;