Don't break existing configs
parent
c914cbcb9f
commit
92a0370499
|
|
@ -149,8 +149,8 @@ module.exports =
|
|||
// [ userRoles.MODERATOR, userRoles.AUTHENTICATED ]
|
||||
// This will allow all MODERATOR and AUTHENTICATED users access.
|
||||
requiredRolesForAccess : [ userRoles.ALL ],
|
||||
// When truthy, the room will be open to all users when the first
|
||||
// AUTHENTICATED or MODERATOR user joins the room.
|
||||
// When truthy, the room will be open to all users when as long as there
|
||||
// are allready users in the room
|
||||
activateOnHostJoin : true,
|
||||
// Mediasoup settings
|
||||
mediasoup :
|
||||
|
|
|
|||
|
|
@ -54,6 +54,12 @@ class Room extends EventEmitter
|
|||
// Locked flag.
|
||||
this._locked = false;
|
||||
|
||||
// Required roles to access
|
||||
this._requiredRoles = [ userRoles.ALL ];
|
||||
|
||||
if ('requiredRolesForAccess' in config)
|
||||
this._requiredRoles = config.requiredRolesForAccess;
|
||||
|
||||
// if true: accessCode is a possibility to open the room
|
||||
this._joinByAccesCode = true;
|
||||
|
||||
|
|
@ -135,7 +141,7 @@ class Room extends EventEmitter
|
|||
else
|
||||
{
|
||||
// If the user has a role in config.requiredRolesForAccess, let them in
|
||||
peer.roles.some((role) => config.requiredRolesForAccess.includes(role)) ?
|
||||
peer.roles.some((role) => this._requiredRoles.includes(role)) ?
|
||||
this._peerJoining(peer) :
|
||||
this._handleGuest(peer);
|
||||
}
|
||||
|
|
@ -181,7 +187,7 @@ class Room extends EventEmitter
|
|||
// If the user has a role in config.requiredRolesForAccess, let them in
|
||||
if (
|
||||
!this._locked &&
|
||||
peer.roles.some((role) => config.requiredRolesForAccess.includes(role))
|
||||
peer.roles.some((role) => this._requiredRoles.includes(role))
|
||||
)
|
||||
{
|
||||
this._lobby.promotePeer(peer.id);
|
||||
|
|
|
|||
Loading…
Reference in New Issue