Browse Source
Merge pull request #8445 from nextcloud/feature/add-capability-to-toggle-recording
pull/8449/head
Joas Schilling
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with
46 additions and
4 deletions
docs/capabilities.md
docs/settings.md
lib/Capabilities.php
lib/Config.php
tests/php/CapabilitiesTest.php
@ -108,5 +108,7 @@ title: Capabilities
## 16
* `breakout-rooms-v1` - Whether breakout-rooms API v1 is available
* `config => call => breakout-rooms` - Whether breakout rooms are enabled on this instance
* `avatar` - Avatar of conversation
* `recording-v1` - Call recording is available.
* `config => call => breakout-rooms` - Whether breakout rooms are enabled on this instance
* `config => call => recording` - Whether calls can be recorded (requires the High-performance backend server)
@ -88,6 +88,7 @@ Option legend:
| `hide_signaling_warning` | string< br > `yes` or `no` | `no` | 🖌️ | Flag that allows to suppress the warning that an HPB should be configured |
| `signaling_dev` | string< br > `yes` or `no` | `no` | | Developer flag that allows to suppress various requirements like a Redis server when using the HPB |
| `breakout_rooms` | string< br > `yes` or `no` | `yes` | | Whether or not breakout rooms are allowed (Will only prevent creating new breakout rooms. Existing conversations are not modified.) |
| `call_recording` | string< br > `yes` or `no` | `yes` | | Enable call recording |
| `federation_enabled` | string< br > `yes` or `no` | `no` | | 🏗️ *Work in progress:* Whether or not federation with this instance is allowed |
| `conversations_files` | string< br > `1` or `0` | `1` | 🖌️ | Whether the files app integration is enabled allowing to start conversations in the right sidebar |
| `conversations_files_public_shares` | string< br > `1` or `0` | `1` | 🖌️ | Whether the public share integration is enabled allowing to start conversations in the right sidebar on the public share page (Requires `conversations_files` also to be enabled) |
@ -113,6 +113,7 @@ class Capabilities implements IPublicCapability {
'send-call-notification' ,
'talk-polls' ,
'breakout-rooms-v1' ,
'recording-v1' ,
'avatar' ,
],
'config' => [
@ -122,12 +123,15 @@ class Capabilities implements IPublicCapability {
'call' => [
'enabled' => (( int ) $this -> serverConfig -> getAppValue ( 'spreed' , 'start_calls' , Room :: START_CALL_EVERYONE )) !== Room :: START_CALL_NOONE ,
'breakout-rooms' => $this -> talkConfig -> isBreakoutRoomsEnabled (),
'recording' => $this -> talkConfig -> isRecordingEnabled (),
],
'chat' => [
'max-length' => ChatManager :: MAX_CHAT_LENGTH ,
'read-privacy' => Participant :: PRIVACY_PUBLIC ,
],
'conversations' => [],
'conversations' => [
'can-create' => $user instanceof IUser && ! $this -> talkConfig -> isNotAllowedToCreateConversations ( $user )
],
'previews' => [
'max-gif-size' => ( int ) $this -> serverConfig -> getAppValue ( 'spreed' , 'max-gif-size' , '3145728' ),
],
@ -151,8 +155,6 @@ class Capabilities implements IPublicCapability {
$capabilities [ 'config' ][ 'chat' ][ 'read-privacy' ] = $this -> talkConfig -> getUserReadPrivacy ( $user -> getUID ());
}
$capabilities [ 'config' ][ 'conversations' ][ 'can-create' ] = $user instanceof IUser && ! $this -> talkConfig -> isNotAllowedToCreateConversations ( $user );
$pubKey = $this -> talkConfig -> getSignalingTokenPublicKey ();
if ( $pubKey ) {
$capabilities [ 'config' ][ 'signaling' ][ 'hello-v2-token-key' ] = $pubKey ;
@ -136,6 +136,13 @@ class Config {
return $this -> canEnableSIP [ $user -> getUID ()];
}
public function isRecordingEnabled () : bool {
$isSignalingInternal = $this -> getSignalingMode () === self :: SIGNALING_INTERNAL ;
$recordingAllowed = $this -> config -> getAppValue ( 'spreed' , 'call_recording' , 'yes' ) === 'yes' ;
return ! $isSignalingInternal && $recordingAllowed ;
}
public function isDisabledForUser ( IUser $user ) : bool {
$allowedGroups = $this -> getAllowedTalkGroupIds ();
if ( empty ( $allowedGroups )) {
@ -122,6 +122,7 @@ class CapabilitiesTest extends TestCase {
'send-call-notification' ,
'talk-polls' ,
'breakout-rooms-v1' ,
'recording-v1' ,
'avatar' ,
'message-expiration' ,
'reactions' ,
@ -169,6 +170,7 @@ class CapabilitiesTest extends TestCase {
'call' => [
'enabled' => true ,
'breakout-rooms' => false ,
'recording' => false ,
],
'chat' => [
'max-length' => 32000 ,
@ -270,6 +272,7 @@ class CapabilitiesTest extends TestCase {
'call' => [
'enabled' => false ,
'breakout-rooms' => true ,
'recording' => false ,
],
'chat' => [
'max-length' => 32000 ,
@ -344,4 +347,31 @@ class CapabilitiesTest extends TestCase {
$data = $capabilities -> getCapabilities ();
$this -> assertEquals ( 'this-is-the-key' , $data [ 'spreed' ][ 'config' ][ 'signaling' ][ 'hello-v2-token-key' ]);
}
/**
* @ dataProvider dataTestConfigRecording
*/
public function testConfigRecording ( bool $enabled ) : void {
$capabilities = new Capabilities (
$this -> serverConfig ,
$this -> talkConfig ,
$this -> commentsManager ,
$this -> userSession ,
$this -> appManager
);
$this -> talkConfig -> expects ( $this -> once ())
-> method ( 'isRecordingEnabled' )
-> willReturn ( $enabled );
$data = $capabilities -> getCapabilities ();
$this -> assertEquals ( $data [ 'spreed' ][ 'config' ][ 'call' ][ 'recording' ], $enabled );
}
public function dataTestConfigRecording () : array {
return [
[ true ],
[ false ],
];
}
}