Expand permissions/role system. Clients are now provisioned with their roles when they join and will have features enabled/disabled based on their permissions.
This commit is contained in:
@@ -1,11 +1,9 @@
|
||||
import * as userRoles from './userRoles';
|
||||
|
||||
const initialState =
|
||||
{
|
||||
id : null,
|
||||
picture : null,
|
||||
isMobile : false,
|
||||
roles : [ userRoles.ALL ],
|
||||
roles : [ 'normal' ], // Default role
|
||||
canSendMic : false,
|
||||
canSendWebcam : false,
|
||||
canShareScreen : false,
|
||||
|
||||
@@ -21,7 +21,16 @@ const initialState =
|
||||
joined : false,
|
||||
muteAllInProgress : false,
|
||||
stopAllVideoInProgress : false,
|
||||
closeMeetingInProgress : false
|
||||
closeMeetingInProgress : false,
|
||||
userRoles : { NORMAL: 'normal' }, // Default role
|
||||
permissionsFromRoles : {
|
||||
CHANGE_ROOM_LOCK : [],
|
||||
PROMOTE_PEER : [],
|
||||
SEND_CHAT : [],
|
||||
SHARE_SCREEN : [],
|
||||
SHARE_FILE : [],
|
||||
MODERATE_ROOM : []
|
||||
}
|
||||
};
|
||||
|
||||
const room = (state = initialState, action) =>
|
||||
@@ -175,6 +184,20 @@ const room = (state = initialState, action) =>
|
||||
case 'CLOSE_MEETING_IN_PROGRESS':
|
||||
return { ...state, closeMeetingInProgress: action.payload.flag };
|
||||
|
||||
case 'SET_USER_ROLES':
|
||||
{
|
||||
const { userRoles } = action.payload;
|
||||
|
||||
return { ...state, userRoles };
|
||||
}
|
||||
|
||||
case 'SET_PERMISSIONS_FROM_ROLES':
|
||||
{
|
||||
const { permissionsFromRoles } = action.payload;
|
||||
|
||||
return { ...state, permissionsFromRoles };
|
||||
}
|
||||
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
export const ADMIN = 'admin';
|
||||
export const MODERATOR = 'moderator';
|
||||
export const AUTHENTICATED = 'authenticated';
|
||||
export const ALL = 'normal';
|
||||
Reference in New Issue
Block a user