@@ -13,6 +13,8 @@ import { ChatAdapter } from '../../ChatComposite';
1313import { ChatButtonWithUnreadMessagesBadge } from '../../CallWithChatComposite/ChatButtonWithUnreadMessagesBadge' ;
1414import { BaseCustomStyles , ControlBarButtonStyles } from '@internal/react-components' ;
1515import { ControlBar } from '@internal/react-components' ;
16+ /* @conditional -compile-remove(rooms) */
17+ import { _usePermissions } from '@internal/react-components' ;
1618import { Microphone } from '../../CallComposite/components/buttons/Microphone' ;
1719import { Camera } from '../../CallComposite/components/buttons/Camera' ;
1820import { ScreenShare } from '../../CallComposite/components/buttons/ScreenShare' ;
@@ -234,6 +236,21 @@ export const CommonCallControlBar = (props: CommonCallControlBarProps & Containe
234236 < > </ >
235237 ) ;
236238
239+ /* @conditional -compile-remove(rooms) */
240+ const rolePermissions = _usePermissions ( ) ;
241+
242+ let screenShareButtonIsEnabled = isEnabled ( options ?. screenShareButton ) ;
243+ /* @conditional -compile-remove(rooms) */
244+ screenShareButtonIsEnabled = rolePermissions . screenShare && screenShareButtonIsEnabled ;
245+
246+ let microphoneButtonIsEnabled = isEnabled ( options ?. microphoneButton ) ;
247+ /* @conditional -compile-remove(rooms) */
248+ microphoneButtonIsEnabled = rolePermissions . microphoneButton && microphoneButtonIsEnabled ;
249+
250+ let cameraButtonIsEnabled = isEnabled ( options ?. cameraButton ) ;
251+ /* @conditional -compile-remove(rooms) */
252+ cameraButtonIsEnabled = rolePermissions . cameraButton && cameraButtonIsEnabled ;
253+
237254 return (
238255 < div ref = { controlBarSizeRef } >
239256 < CallAdapterProvider adapter = { props . callAdapter } >
@@ -275,7 +292,7 @@ export const CommonCallControlBar = (props: CommonCallControlBarProps & Containe
275292 */ }
276293 < div ref = { controlBarContainerRef } >
277294 < ControlBar layout = "horizontal" styles = { centerContainerStyles } >
278- { isEnabled ( options . microphoneButton ) && (
295+ { microphoneButtonIsEnabled && (
279296 < Microphone
280297 displayType = { options . displayType }
281298 styles = { commonButtonStyles }
@@ -284,7 +301,7 @@ export const CommonCallControlBar = (props: CommonCallControlBarProps & Containe
284301 disabled = { props . disableButtonsForHoldScreen || isDisabled ( options . microphoneButton ) }
285302 />
286303 ) }
287- { isEnabled ( options . cameraButton ) && (
304+ { cameraButtonIsEnabled && (
288305 < Camera
289306 displayType = { options . displayType }
290307 styles = { commonButtonStyles }
@@ -296,7 +313,7 @@ export const CommonCallControlBar = (props: CommonCallControlBarProps & Containe
296313 />
297314 ) }
298315 { props . mobileView && isEnabled ( options ?. chatButton ) && chatButton }
299- { isEnabled ( options . screenShareButton ) && (
316+ { screenShareButtonIsEnabled && (
300317 < ScreenShare
301318 option = { options . screenShareButton }
302319 displayType = { options . displayType }
0 commit comments