@ai-matrx/meet 0.11.52 → 0.11.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -3551,6 +3551,7 @@ function consentPending(policy, role, recordingOn, given) {
3551
3551
  function mayAdmitNow(role, participants, policy) {
3552
3552
  if (role === "none") return false;
3553
3553
  if (role === "host" || role === "cohost") return true;
3554
+ if (role === "viewer") return false;
3554
3555
  const hostIn = participants.some((p) => p.role === "host" || p.role === "cohost");
3555
3556
  return !hostIn && policy.headlessPowers === "members_admit";
3556
3557
  }
@@ -5255,6 +5256,17 @@ function createMeetingSession(options) {
5255
5256
  }
5256
5257
  return identity.userId;
5257
5258
  }
5259
+ function requireAdmitterUser(operation) {
5260
+ const snapshot = store.snapshot();
5261
+ if (identity.userId === null || !mayAdmitNow(effectiveRole(snapshot), snapshot.participants, snapshot.livePolicy)) {
5262
+ throw new MeetError(
5263
+ "forbidden",
5264
+ `${operation}: this participant may not let people in`,
5265
+ "Only a host or co-host admits people, unless the meeting has no host in it and lets members admit."
5266
+ );
5267
+ }
5268
+ return identity.userId;
5269
+ }
5258
5270
  function requireMeeting(operation) {
5259
5271
  const meeting = store.snapshot().meeting;
5260
5272
  if (meeting === null) {
@@ -5661,7 +5673,7 @@ function createMeetingSession(options) {
5661
5673
  meetingChannel.requestBackfill("manual");
5662
5674
  },
5663
5675
  async admit(entry, admitted) {
5664
- const by = requireHostUser("meet.admit");
5676
+ const by = requireAdmitterUser("meet.admit");
5665
5677
  const meeting = requireMeeting("meet.admit");
5666
5678
  const row = await repository.decideAdmission({
5667
5679
  meetingId: meeting.id,
@@ -5679,7 +5691,7 @@ function createMeetingSession(options) {
5679
5691
  hint();
5680
5692
  },
5681
5693
  async undeny(entry) {
5682
- const by = requireHostUser("meet.undeny");
5694
+ const by = requireAdmitterUser("meet.undeny");
5683
5695
  const meeting = requireMeeting("meet.undeny");
5684
5696
  const row = await repository.decideAdmission({
5685
5697
  meetingId: meeting.id,
@@ -5692,7 +5704,7 @@ function createMeetingSession(options) {
5692
5704
  hint();
5693
5705
  },
5694
5706
  async admitAll() {
5695
- const by = requireHostUser("meet.admitAll");
5707
+ const by = requireAdmitterUser("meet.admitAll");
5696
5708
  const meeting = requireMeeting("meet.admitAll");
5697
5709
  const rows = await repository.admitAll(meeting.id, by);
5698
5710
  for (const row of rows) {