Wire space listener email invites and restyle Meet index pages.
Deploy Ladill Meet / deploy (push) Successful in 42s
Deploy Ladill Meet / deploy (push) Successful in 42s
Enforce invite-only room access, validate invite emails on create, assign attendee role for listener invitations, and add invite UI on the room show page. Redesign meetings, rooms, conferences, and webinars indexes to match the Events hero, stats cards, and icon list layout. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Services\Meet;
|
||||
|
||||
use App\Models\Member;
|
||||
use App\Models\Organization;
|
||||
use App\Models\Room;
|
||||
use App\Models\User;
|
||||
@@ -13,7 +14,7 @@ class SecurityPolicyService
|
||||
{
|
||||
$org = $room->organization;
|
||||
$policy = $this->mergedPolicy($org, $room);
|
||||
$kind = $room->isConference() ? 'conference' : 'meeting';
|
||||
$kind = $room->isConference() ? 'conference' : ($room->isSpace() ? 'room' : 'meeting');
|
||||
|
||||
if ($policy['org_only'] && ! $user) {
|
||||
return [false, "This {$kind} requires a Ladill account."];
|
||||
@@ -31,6 +32,10 @@ class SecurityPolicyService
|
||||
}
|
||||
}
|
||||
|
||||
if ($room->isSpace() && $room->setting('invite_only', false) && ! $this->canJoinInviteOnlyRoom($room, $user, $email)) {
|
||||
return [false, 'This room is private. Ask the host for an invitation.'];
|
||||
}
|
||||
|
||||
if ($room->passcode && ! session()->get("meet.passcode.{$room->uuid}")) {
|
||||
return [false, 'passcode_required'];
|
||||
}
|
||||
@@ -46,6 +51,39 @@ class SecurityPolicyService
|
||||
return [true, null];
|
||||
}
|
||||
|
||||
public function canJoinInviteOnlyRoom(Room $room, ?User $user, ?string $email): bool
|
||||
{
|
||||
if ($user && $this->isHost($room, $user)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($user && $room->organization_id) {
|
||||
$isMember = Member::query()
|
||||
->where('organization_id', $room->organization_id)
|
||||
->where('user_ref', $user->ownerRef())
|
||||
->exists();
|
||||
|
||||
if ($isMember) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$speakerRefs = (array) $room->setting('speaker_refs', []);
|
||||
if (in_array($user->ownerRef(), $speakerRefs, true)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
$email = strtolower(trim((string) ($email ?? $user?->email ?? '')));
|
||||
if ($email === '') {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $room->invitations()
|
||||
->whereRaw('LOWER(email) = ?', [$email])
|
||||
->whereIn('status', ['pending', 'accepted'])
|
||||
->exists();
|
||||
}
|
||||
|
||||
public function isHost(Room $room, ?User $user): bool
|
||||
{
|
||||
return $user && $user->ownerRef() === $room->host_user_ref;
|
||||
|
||||
Reference in New Issue
Block a user