Skip to content
Draft
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
14 changes: 14 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,20 @@ MAIL_FROM_NAME="${APP_NAME}"
#OIDC_CLIENT_SECRET=
#OIDC_SCOPES=profile,email

# Meeting summaries (recap)
# Master switch for the room setting and the room type fields (also requires RECAP_SERVICE_URL and RECAP_FRONTEND_TOKEN)
#RECAP_ENABLED=false
# Prefix of the BBB meta parameters (meta_<prefix>-*), must equal the prefix of the recording exporter
# Lowercase letter followed by 1-15 lowercase letters or digits; an invalid prefix disables the feature
#RECAP_META_PREFIX=recap
# Base URL of the meeting summary service; the feature stays off without it
#RECAP_SERVICE_URL=https://recap.example.org
# Bearer token of this front end at the meeting summary service; the feature stays off without it
#RECAP_FRONTEND_TOKEN=
# Timeouts in seconds for requests to the meeting summary service
#RECAP_SERVER_TIMEOUT=10
#RECAP_SERVER_CONNECT_TIMEOUT=20

# Enabled locales
# Comma separated list, e.g. de,en
# If unset all available locales are enabled (lang + resources/custom/lang)
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Option to enforce light or dark color mode ([#3557])
- Popover to show dial-in number and pin during a running meeting ([#1143], [#1810])
- Option to disable recordings using the `RECORDING_ENABLED` environment variable ([#3633], [#3635])
- Experimental AI meeting summaries using an external summary service, opted in by the room owner and configured per room type
- Meeting summaries tab in rooms to open, download, change access to and delete the summaries of past meetings

### Changed

Expand Down
3 changes: 3 additions & 0 deletions app/Auth/OIDC/OIDCProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ public function login(Request $request): User
// Get eloquent user (existing or new)
$user = $oidc_user->createOrFindEloquentModel('oidc');

// Store the subject identifier, it is used to identify the user in external services
$user->oidc_sub = $user_info['sub'];

// Sync attributes
$oidc_user->syncWithEloquentModel($user, config('services.oidc.mapping')->roles);

Expand Down
7 changes: 6 additions & 1 deletion app/Console/Commands/CleanupRecordingsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace App\Console\Commands;

use App\Enums\TimePeriod;
use App\Models\MeetingSummary;
use App\Models\Recording;
use App\Settings\RecordingSettings;
use Illuminate\Console\Command;
Expand All @@ -24,7 +25,7 @@ class CleanupRecordingsCommand extends Command
*
* @var string
*/
protected $description = 'Remove recordings after retention period';
protected $description = 'Remove recordings and meeting summaries after retention period';

/**
* Execute the console command.
Expand All @@ -42,6 +43,10 @@ public function handle()
Recording::where('start', '<', $day)->get()->each(function ($recording) {
$recording->delete();
});

// Meeting summaries follow the retention period of the recordings
Log::info('Removing meeting summaries older than '.$day);
MeetingSummary::where('start', '<', $day)->delete();
}
}
}
117 changes: 117 additions & 0 deletions app/Http/Controllers/api/v1/MeetingSummaryController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<?php

declare(strict_types=1);

namespace App\Http\Controllers\api\v1;

use App\Enums\RecordingAccess;
use App\Http\Controllers\Controller;
use App\Http\Requests\MeetingSummaryIndexRequest;
use App\Http\Requests\UpdateMeetingSummaryRequest;
use App\Http\Resources\MeetingSummaryResource;
use App\Models\MeetingSummary;
use App\Models\Room;
use App\Settings\GeneralSettings;
use Illuminate\Http\Resources\Json\AnonymousResourceCollection;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\Facades\Log;
use Symfony\Component\HttpFoundation\HeaderUtils;

class MeetingSummaryController extends Controller
{
/**
* Columns of the list, without the summary text
*
* @var list<string>
*/
private const LIST_COLUMNS = ['id', 'room_id', 'meeting_id', 'access', 'start', 'end', 'document_url', 'delivered_at'];

public function index(Room $room, MeetingSummaryIndexRequest $request, GeneralSettings $generalSettings): AnonymousResourceCollection
{
$additional = [];

// Sort direction, fallback/default is newest first
$sortOrder = match ($request->query('sort_direction')) {
'asc' => 'ASC',
default => 'DESC',
};

// Filter, default is no filter
$filter = match ($request->query('filter')) {
'everyone_access' => RecordingAccess::EVERYONE,
'participant_access' => RecordingAccess::PARTICIPANT,
'moderator_access' => RecordingAccess::MODERATOR,
'owner_access' => RecordingAccess::OWNER,
default => null,
};

$resource = $room->meetingSummaries()->select(self::LIST_COLUMNS)->orderBy('start', $sortOrder)->orderBy('id');

// If user is not allowed to view all summaries, only query summaries that should be visible to the user
if (! Gate::allows('viewAllMeetingSummaries', $room)) {
$allowedAccess = [RecordingAccess::EVERYONE];

if ($room->isModerator(Auth::user())) {
$allowedAccess[] = RecordingAccess::MODERATOR;
$allowedAccess[] = RecordingAccess::PARTICIPANT;
} elseif ($room->isMember(Auth::user())) {
$allowedAccess[] = RecordingAccess::PARTICIPANT;
}

$resource = $resource->whereIn('access', $allowedAccess);
}

// count all before applying filters
$additional['meta']['total_no_filter'] = $resource->count();

if ($filter) {
$resource = $resource->where('access', $filter);
}

return MeetingSummaryResource::collection($resource->paginate($generalSettings->pagination_page_size))->additional($additional);
}

/**
* Download the summary text as a Markdown file; only for summaries stored in PILOS (not for document links)
*/
public function download(Room $room, MeetingSummary $meetingSummary, GeneralSettings $generalSettings): Response
{
$this->authorize('viewMeetingSummary', [$room, $meetingSummary]);

if ($meetingSummary->content === null) {
abort(404);
}

// ASCII file name from the room ID and the local start time, e.g. meeting-summary-abc-def-123-2026-11-12-0930.md
$timezone = Auth::user()?->timezone ?? $generalSettings->default_timezone;
$start = $meetingSummary->start->copy()->setTimezone($timezone)->format('Y-m-d-Hi');
$filename = preg_replace('/[^A-Za-z0-9_-]/', '-', 'meeting-summary-'.$room->id.'-'.$start).'.md';

// Same protection as room files: never rendered as a document, no active content if opened directly
return response($meetingSummary->content, 200, [
'Content-Type' => 'text/markdown; charset=utf-8',
'Content-Disposition' => HeaderUtils::makeDisposition(HeaderUtils::DISPOSITION_ATTACHMENT, $filename),
'Content-Security-Policy' => "default-src 'none'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'",
'X-Content-Type-Options' => 'nosniff',
]);
}

public function update(UpdateMeetingSummaryRequest $request, Room $room, MeetingSummary $meetingSummary): MeetingSummaryResource
{
$meetingSummary->access = $request->enum('access', RecordingAccess::class);
$meetingSummary->save();

return new MeetingSummaryResource($meetingSummary);
}

public function destroy(Room $room, MeetingSummary $meetingSummary): Response
{
Log::info('Deleted meeting summary {summary} in room {room}', ['room' => $room->getLogLabel(), 'summary' => $meetingSummary->getLogLabel()]);

$meetingSummary->delete();

return response()->noContent();
}
}
2 changes: 2 additions & 0 deletions app/Http/Controllers/api/v1/RoomController.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ public function getStartRequirements(Room $room)
{
$features = [
'recording' => config('recording.enabled') && $room->getRoomSetting('record'),
'recap' => (new RoomService($room))->isRecapActive(),
'attendance_recording' => $room->getRoomSetting('record_attendance'),
'streaming' => $room->streaming->enabled,
];
Expand All @@ -254,6 +255,7 @@ public function getJoinRequirements(Room $room)

$features = [
'recording' => $meeting?->record ?? false,
'recap' => $meeting?->recap ?? false,
'attendance_recording' => $meeting?->record_attendance ?? false,
'streaming' => $meeting ? $room->streaming->enabled_for_current_meeting : false,
];
Expand Down
6 changes: 6 additions & 0 deletions app/Http/Controllers/api/v1/RoomTypeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ public function update(RoomTypeRequest $request, RoomType $roomType)
$roomType->has_access_code_default = $request->has_access_code_default;
$roomType->has_access_code_enforced = $request->has_access_code_enforced;

$roomType->recap_type = $request->recap_type;
$roomType->recap_sink = $request->recap_sink;

$roomType->save();

if ($roomType->restrict) {
Expand Down Expand Up @@ -148,6 +151,9 @@ public function store(RoomTypeRequest $request)
$roomType->has_access_code_default = $request->has_access_code_default;
$roomType->has_access_code_enforced = $request->has_access_code_enforced;

$roomType->recap_type = $request->recap_type;
$roomType->recap_sink = $request->recap_sink;

$roomType->save();

if ($roomType->restrict) {
Expand Down
49 changes: 49 additions & 0 deletions app/Http/Requests/JoinMeetingRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,58 @@ private function getRecordingRules(): array
];
}

// Meeting summary without recording, the camera video is not recorded
if ($this->isSummaryOnly()) {
return [
'consent_record' => ['required', 'boolean', 'accepted'], // Consent to join meeting with meeting summary enabled
];
}

return [];
}

/**
* Custom messages for the meeting summary consent, which shares the field with the recording consent
*
* @return array<string, string>
*/
public function messages(): array
{
if ($this->isSummaryOnly()) {
return [
'consent_record.accepted' => __('validation.custom.consent_recap.accepted'),
];
}

return [];
}

/**
* Custom attribute names for the meeting summary consent, which shares the field with the recording consent
*
* @return array<string, string>
*/
public function attributes(): array
{
if ($this->isSummaryOnly()) {
return [
'consent_record' => __('validation.attributes.consent_recap'),
];
}

return [];
}

/**
* Whether the meeting creates a meeting summary without a recording
*/
private function isSummaryOnly(): bool
{
$meeting = $this->room->latestMeeting;

return ! $meeting?->record && (bool) $meeting?->recap;
}

private function getStreamingRules(): array
{
$streaming = $this->room->streaming;
Expand Down
25 changes: 25 additions & 0 deletions app/Http/Requests/MeetingSummaryIndexRequest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

declare(strict_types=1);

namespace App\Http\Requests;

use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

class MeetingSummaryIndexRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array<string, ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'filter' => [Rule::in(['everyone_access', 'participant_access', 'moderator_access', 'owner_access'])],
'sort_direction' => [Rule::in(['asc', 'desc'])],
];
}
}
8 changes: 8 additions & 0 deletions app/Http/Requests/RoomTypeRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ public function rules()
$rules[$setting.'_enforced'] = ['required', 'boolean'];
}

// Meeting summaries (recap) can only be enforced off, never on
$rules['recap_default'][] = 'declined_if:recap_enforced,true';

// Meeting type and sink of the summaries, required if the room type offers summaries
$recapOffered = Room::isRecapEnabled() && ! $this->boolean('recap_enforced');
$rules['recap_type'] = [Rule::requiredIf($recapOffered), 'nullable', 'string', 'regex:/^[a-z][a-z0-9-]{0,62}$/'];
$rules['recap_sink'] = [Rule::requiredIf($recapOffered), 'nullable', 'string', 'regex:/^[a-z][a-z0-9-]{0,62}$/'];

if ($this->roomType) {
$rules['name'] = ['required', 'string', 'max:255', Rule::unique('room_types', 'name')->ignore($this->roomType->id)];
}
Expand Down
52 changes: 52 additions & 0 deletions app/Http/Requests/StartMeetingRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace App\Http\Requests;

use App\Services\RoomService;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Context;

Expand Down Expand Up @@ -46,9 +47,60 @@ private function getRecordingRules(): array
];
}

// Meeting summary without recording, the camera video is not recorded
if ($this->isSummaryOnly()) {
return [
'consent_record' => ['required', 'boolean', 'accepted'], // Consent to join meeting with meeting summary enabled
];
}

return [];
}

/**
* Custom messages for the meeting summary consent, which shares the field with the recording consent
*
* @return array<string, string>
*/
public function messages(): array
{
if ($this->isSummaryOnly()) {
return [
'consent_record.accepted' => __('validation.custom.consent_recap.accepted'),
];
}

return [];
}

/**
* Custom attribute names for the meeting summary consent, which shares the field with the recording consent
*
* @return array<string, string>
*/
public function attributes(): array
{
if ($this->isSummaryOnly()) {
return [
'consent_record' => __('validation.attributes.consent_recap'),
];
}

return [];
}

/**
* Whether the meeting creates a meeting summary without a recording
*/
private function isSummaryOnly(): bool
{
if ($this->room->getRoomSetting('record')) {
return false;
}

return (new RoomService($this->room))->isRecapActive();
}

private function getStreamingRules(): array
{
$streaming = $this->room->streaming;
Expand Down
Loading
Loading