-
-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: custom end meeting url with restriction #202
base: master
Are you sure you want to change the base?
Changes from all commits
bec283e
1917bf1
8218f97
b608a17
148b5d9
5707fc4
3d8efa7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -119,7 +119,8 @@ public function update( | |
bool $listenOnly, | ||
bool $mediaCheck, | ||
bool $cleanLayout, | ||
bool $joinMuted | ||
bool $joinMuted, | ||
string $logoutURL | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need some type of validation for the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This validation should also be done on the server side, otherwise an attacker could bypass the client logic. |
||
): DataResponse { | ||
$room = $this->service->find($id); | ||
|
||
|
@@ -137,13 +138,17 @@ public function update( | |
return new DataResponse(['message' => 'Not allowed to enable recordings.'], Http::STATUS_BAD_REQUEST); | ||
} | ||
|
||
if (!$restriction->getAllowLogoutURL() && $logoutURL !== $room->getLogoutURL()) { | ||
return new DataResponse(['message' => 'Not allowed to enable custom logout URLs'], Https::STATUS_BAD_REQUEST); | ||
} | ||
|
||
$disabledRoomTypes = \json_decode($restriction->getRoomTypes()); | ||
if ((in_array($access, $disabledRoomTypes) && $access !== $room->getAccess()) || !in_array($access, Room::ACCESS)) { | ||
return new DataResponse(['message' => 'Access type not allowed.'], Http::STATUS_BAD_REQUEST); | ||
} | ||
|
||
return $this->handleNotFound(function () use ($id, $name, $welcome, $maxParticipants, $record, $access, $everyoneIsModerator, $requireModerator, $moderatorToken, $listenOnly, $mediaCheck, $cleanLayout, $joinMuted) { | ||
return $this->service->update($id, $name, $welcome, $maxParticipants, $record, $access, $everyoneIsModerator, $requireModerator, $moderatorToken, $listenOnly, $mediaCheck, $cleanLayout, $joinMuted); | ||
return $this->handleNotFound(function () use ($id, $name, $welcome, $maxParticipants, $record, $access, $everyoneIsModerator, $requireModerator, $moderatorToken, $listenOnly, $mediaCheck, $cleanLayout, $joinMuted, $logoutURL) { | ||
return $this->service->update($id, $name, $welcome, $maxParticipants, $record, $access, $everyoneIsModerator, $requireModerator, $moderatorToken, $listenOnly, $mediaCheck, $cleanLayout, $joinMuted, $logoutURL); | ||
}); | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OCA\BigBlueButton\Migration; | ||
|
||
use Closure; | ||
use OCP\DB\ISchemaWrapper; | ||
use OCP\Migration\IOutput; | ||
use OCP\Migration\SimpleMigrationStep; | ||
|
||
/** | ||
* Auto-generated migration step: Please modify to your needs! | ||
*/ | ||
class Version000000Date20220316165602 extends SimpleMigrationStep { | ||
sualko marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/** | ||
* @param IOutput $output | ||
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` | ||
* @param array $options | ||
* @return null|ISchemaWrapper | ||
*/ | ||
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { | ||
$schema = $schemaClosure(); | ||
|
||
if ($schema->hasTable('bbb_rooms')) { | ||
$table = $schema->getTable('bbb_rooms'); | ||
|
||
if (!$table->hasColumn('logout_u_r_l')) { | ||
$table->addColumn('logout_u_r_l', 'string', [ | ||
'notnull' => false | ||
]); | ||
} | ||
} | ||
|
||
if ($schema->hasTable('bbb_restrictions')) { | ||
$table = $schema->getTable('bbb_restrictions'); | ||
|
||
if (!$table->hasColumn('allow_logout_u_r_l')) { | ||
$table->addColumn('allow_logout_u_r_l', 'boolean', [ | ||
'notnull' => false, | ||
'default' => false | ||
]); | ||
} | ||
} | ||
|
||
return $schema; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,12 +25,14 @@ public function testFindByGroupIds() { | |
$restriction0->setRoomTypes(\json_encode([Room::ACCESS_INTERNAL])); | ||
$restriction0->setMaxParticipants(50); | ||
$restriction0->setAllowRecording(false); | ||
$restriction0->setAllowLogoutURL(false); | ||
|
||
$restriction1 = new Restriction(); | ||
$restriction1->setRoomTypes(\json_encode([Room::ACCESS_INTERNAL, Room::ACCESS_INTERNAL_RESTRICTED])); | ||
$restriction1->setMaxRooms(10); | ||
$restriction1->setMaxParticipants(100); | ||
$restriction1->setAllowRecording(true); | ||
$restriction1->setAllowRecording(true); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should probably |
||
|
||
$this->mapper | ||
->expects($this->once()) | ||
|
@@ -48,5 +50,6 @@ public function testFindByGroupIds() { | |
$this->assertEquals(-1, $result->getMaxRooms()); | ||
$this->assertEquals(100, $result->getMaxParticipants()); | ||
$this->assertTrue($result->getAllowRecording()); | ||
$this->assertTrue($result->getAllowLogoutURL()); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably check if the logoutURL is empty. Anyway I would prefer to have the assignment at one place. Maybe