mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2026-05-14 17:07:48 +00:00
feat: Backend reports default permissions.
When any of the backend is used 'anonymous', 'jitsi-anonymous', 'internal_hashed', 'internal_plain', 'cyrus' and a participant becomes a moderator, because of external module or because set from jicofo we send to client with the self-presence about becoming moderator a default set of permissions which can be controlled via prosody config. If using 'token' authentication the above applies only if there is a token and the token does not contain context.features.
This commit is contained in:
@@ -45,14 +45,12 @@ export function getJwtName(state: IReduxState) {
|
||||
*
|
||||
* @param {IReduxState} state - The app state.
|
||||
* @param {string} feature - The feature we want to check.
|
||||
* @param {boolean} ifNoToken - Default value if there is no token.
|
||||
* @param {boolean} ifNotInFeatures - Default value if features prop exists but does not have the {@code feature}.
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function isJwtFeatureEnabled(
|
||||
state: IReduxState,
|
||||
feature: ParticipantFeaturesKey,
|
||||
ifNoToken: boolean,
|
||||
ifNotInFeatures: boolean
|
||||
) {
|
||||
const { jwt } = state['features/base/jwt'];
|
||||
@@ -67,14 +65,12 @@ export function isJwtFeatureEnabled(
|
||||
jwt,
|
||||
localParticipantFeatures: features,
|
||||
feature,
|
||||
ifNoToken,
|
||||
ifNotInFeatures
|
||||
});
|
||||
}
|
||||
|
||||
interface IIsJwtFeatureEnabledStatelessParams {
|
||||
feature: ParticipantFeaturesKey;
|
||||
ifNoToken: boolean;
|
||||
ifNotInFeatures: boolean;
|
||||
jwt?: string;
|
||||
localParticipantFeatures?: IParticipantFeatures;
|
||||
@@ -86,7 +82,6 @@ interface IIsJwtFeatureEnabledStatelessParams {
|
||||
* @param {string | undefined} jwt - The jwt token.
|
||||
* @param {ILocalParticipant} localParticipantFeatures - The features of the local participant.
|
||||
* @param {string} feature - The feature we want to check.
|
||||
* @param {boolean} ifNoToken - Default value if there is no token.
|
||||
* @param {boolean} ifNotInFeatures - Default value if features is missing
|
||||
* or prop exists but does not have the {@code feature}.
|
||||
* @returns {boolean}
|
||||
@@ -95,18 +90,9 @@ export function isJwtFeatureEnabledStateless({
|
||||
jwt,
|
||||
localParticipantFeatures: features,
|
||||
feature,
|
||||
ifNoToken,
|
||||
ifNotInFeatures
|
||||
}: IIsJwtFeatureEnabledStatelessParams) {
|
||||
if (!jwt) {
|
||||
return ifNoToken;
|
||||
}
|
||||
|
||||
if (typeof features === 'undefined') {
|
||||
return ifNoToken;
|
||||
}
|
||||
|
||||
if (typeof features[feature] === 'undefined') {
|
||||
if (!jwt || typeof features?.[feature] === 'undefined') {
|
||||
return ifNotInFeatures;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user