Do not allow one2one calling yourself

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2018-02-13 18:20:57 +01:00
Родитель f26af8a267
Коммит 7fa8a97371
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 7076EA9751AACDDA
3 изменённых файлов: 22 добавлений и 0 удалений

Просмотреть файл

@ -339,6 +339,10 @@ class RoomController extends OCSController {
return new DataResponse([], Http::STATUS_NOT_FOUND);
}
if ($this->userId === $targetUserName) {
return new DataResponse([], Http::STATUS_FORBIDDEN);
}
// If room exists: Reuse that one, otherwise create a new one.
try {
$room = $this->manager->getOne2OneRoom($this->userId, $targetUser->getUID());

Просмотреть файл

@ -163,6 +163,19 @@ class FeatureContext implements Context, SnippetAcceptingContext {
self::$tokenToIdentifier[$response['token']] = $identifier;
}
/**
* @Then /^user "([^"]*)" tries to create room with (\d+)$/
*
* @param string $user
* @param int $statusCode
* @param TableNode|null $formData
*/
public function userTriesToCreateRoom($user, $statusCode, TableNode $formData = null) {
$this->setCurrentUser($user);
$this->sendRequest('POST', '/apps/spreed/api/v1/room', $formData);
$this->assertStatusCode($this->response, $statusCode);
}
/**
* @Then /^user "([^"]*)" joins room "([^"]*)" with (\d+)$/
*

Просмотреть файл

@ -9,6 +9,11 @@ Feature: one-to-one
Then user "participant2" is participant of the following rooms
Then user "participant3" is participant of the following rooms
Scenario: User1 invites user1 ... that should not work ...
When user "participant1" tries to create room with 403
| roomType | 1 |
| invite | participant1 |
Scenario: User1 invites user2 to a one2one room and user3 is not part of it
When user "participant1" creates room "room1"
| roomType | 1 |