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