Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- Rate limiting to prevent Room-ID enumeration attacks ([#2518])
- Greenlight3 import command ([#2664])

### Changed

Expand Down
395 changes: 395 additions & 0 deletions app/Console/Commands/ImportGreenlight3Command.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/Http/Controllers/api/v1/RoomController.php
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ public function authenticate(Room $room, RoomAuthRequest $request)

$accessCode = $request->access_code;

if (is_numeric($accessCode) && $room->access_code == $accessCode) {
if ($room->access_code == $accessCode) {
// Generate new room auth token or retrieve existing one
$roomAuthToken = RoomAuthToken::firstOrCreate([
'room_id' => $room->id,
Expand Down
9 changes: 7 additions & 2 deletions app/Http/Requests/UpdateRoomSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,17 @@ public function rules()
*/
private function getAccessCodeValidationRule(): array
{
// Support keeping old 6-digit codes (Greenlight v2)
// Support keeping
// * old 6-digit numeric codes (Greenlight v2)
// * old 6-digit alphanumeric codes (Greenlight v3)
$current = $this->room->access_code ?? '';
$incoming = $this->str('access_code') ?? '';
$alphanumeric = $current == $incoming && ! is_numeric($current);
$digits = ($current == $incoming && strlen($current) == 6) ? 6 : 9;

$rules = ['numeric', 'digits:'.$digits, 'bail'];
$rules = $alphanumeric
? ['alpha_num:ascii', 'lowercase', 'size:6', 'bail']
: ['numeric', 'digits:'.$digits, 'bail'];

// Make sure that the given room type id is a number
if (is_numeric($this->input('room_type'))) {
Expand Down
3 changes: 2 additions & 1 deletion app/Models/Room.php
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,8 @@ public function getModeratorOnlyMessage()
$message = __('rooms.invitation.room', ['roomname' => $this->name, 'platform' => $appName]).'<br>';
$message .= __('rooms.invitation.link').': '.config('app.url').'/rooms/'.$this->id;
if ($this->access_code != null) {
$message .= '<br>'.__('rooms.invitation.code').': '.implode('-', str_split($this->access_code, 3));
$message .= '<br>'.__('rooms.invitation.code').': ';
$message .= $this->legacy_code ? $this->access_code : implode('-', str_split($this->access_code, 3));
}

return $message;
Expand Down
48 changes: 44 additions & 4 deletions docs/docs/administration/08-advanced/06-migrate-greenlight.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Migrate from Greenlight v2
description: Step by step guide to migrate from Greenlight v2 to PILOS
title: Migrate from Greenlight
description: Step by step guide to migrate from Greenlight to PILOS
---

PILOS provides an easy to use command to import all greenlight users (incl. ldap), rooms and shared accesses.
Expand All @@ -26,8 +26,17 @@ ports:

Also make sure the internal firewall of the OS and no external firewall is not blocking access to the port and from the host PILOS is running on.

If you want to import Room presentations, copy Greenlight's active storage directory to the PILOS app storage at `/storage/app/migration/presentations` and specify `--presentation-path=migration/presentations` at the command line.
Successfully imported presentation files will be moved to a different location.
Comment on lines +29 to +30
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is currently only possible for GL3 import. Move to GL3 section until added to GL2 import


## Running migration command

The command will output the process of the import and imforms about failed user, room and shared access import.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The command will output the process of the import and imforms about failed user, room and shared access import.
The command will output the process of the import and informs about failed user, room and shared access import.


**Note** If a room with the same room id already exists in PILOS it will NOT be imported and the shared accesses are ignored.

### Greenlight 2

```bash
docker compose exec app pilos-cli import:greenlight-v2 {host : ip or hostname of postgres database server}
{port : port of postgres database server}
Expand All @@ -42,9 +51,40 @@ docker compose exec app pilos-cli import:greenlight-v2 {host : ip or hostname
docker compose exec app pilos-cli import:greenlight-v2 localhost 5432 greenlight_production postgres 12345678
```

The command will output the process of the import and imforms about failed user, room and shared access import.
### Greenlight 3

**Note** If a room with the same room id already exists in PILOS it will NOT be imported and the shared accesses are ignored.
```
Usage:
import:greenlight-v3 [options] [--] <host> <port> <database> <username> <password>

Arguments:
host ip or hostname of postgres database server
port port of postgres database server
database greenlight database name, see greenlight .env variable DB_NAME
username greenlight database username, see greenlight .env variable DB_USERNAME
password greenlight database password, see greenlight .env variable DB_PASSWORD

Options:
--no-confirm do not ask if the import should be committed
--default-role[=DEFAULT-ROLE] default role for imported external users
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name of the default role ....

--room-type[=ROOM-TYPE] room type for imported rooms
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name of the room type ....

--presentation-path[=PRESENTATION-PATH] path to room presentations
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

relative to /storage/app/

```

**Example**

```bash
docker compose exec app pilos-cli import:greenlight-v3 \
--no-confirm \
--default-role=User \
--room-type=Meeting \
--presentation-path=migration/presentations \
pg-cluster.svc.cluster.local
5432
greenlight-db
greenlight-user
d4t4basePa$$Word
```

## Adjust nginx to redirect to PILOS (other host)

Expand Down
8 changes: 5 additions & 3 deletions resources/js/components/RoomShareButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,10 @@ const roomUrl = computed(() => {
});

const formattedAccessCode = computed(() => {
return String(props.room.access_code)
.match(/.{1,3}/g)
.join("-");
return isNaN(props.room.access_code)
? props.room.access_code
: String(props.room.access_code)
.match(/.{1,3}/g)
.join("-");
});
</script>
4 changes: 2 additions & 2 deletions resources/js/views/RoomsView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@
id="access-code"
v-model="accessCodeInput"
autofocus
:mask="room.legacy_code ? '999-999' : '999-999-999'"
:placeholder="room.legacy_code ? '123-456' : '123-456-789'"
:mask="room.legacy_code ? '******' : '999-999-999'"
:placeholder="room.legacy_code ? '123abc' : '123-456-789'"
:invalid="
accessCodeInvalid ||
formErrors.fieldInvalid('access_code')
Expand Down
6 changes: 6 additions & 0 deletions tests/Backend/Feature/api/v1/Room/RoomTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,12 @@ public function test_auth_with_access_code_guests()
'session_id' => $currentSession->id,
'type' => RoomAuthTokenType::CODE->value,
]);

// Try with legacy alphanumeric access code
$room->access_code = '012abc';
$room->save();
$this->postJson(route('api.v1.rooms.authenticate', ['room' => $room]), ['type' => RoomAuthTokenType::CODE->value, 'access_code' => $room->access_code])
->assertStatus(201);
}

/**
Expand Down
Loading
Loading