Skip to content

fix: skip booking time restrictions for admin/owner users#2223

Merged
DonKoko merged 4 commits intomainfrom
copilot/fix-booking-restrictions-for-users
Dec 2, 2025
Merged

fix: skip booking time restrictions for admin/owner users#2223
DonKoko merged 4 commits intomainfrom
copilot/fix-booking-restrictions-for-users

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 1, 2025

Booking time restrictions (bufferStartTime, maxBookingLength) were being enforced for all user roles. These settings should only restrict BASE and SELF_SERVICE users—ADMIN and OWNER users should be exempt.

Changes

  • Schema updates (forms-schema.ts): Added isAdminOrOwner parameter to BookingFormSchema and ExtendBookingSchema. When true, bypasses buffer and max length validations while preserving working hours restrictions.

  • Client-side components: Pass isAdministratorOrOwner from useUserRoleHelper() hook to schemas in:

    • new-booking-form.tsx
    • edit-booking-form.tsx
    • extend-booking-dialog.tsx
    • create-booking-for-selected-assets-dialog.tsx
  • Server-side routes: Derive isAdminOrOwner from !isSelfServiceOrBase in:

    • bookings.new.tsx
    • bookings.$bookingId.overview.tsx

Example

const schema = BookingFormSchema({
  action: "new",
  workingHours,
  bookingSettings,
  isAdminOrOwner: true,  // bypasses bufferStartTime & maxBookingLength
});

Tests

Added 9 unit tests in forms-schema.test.ts covering restriction bypass for admin/owner and enforcement for base/self-service users.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • checkpoint.prisma.io
    • Triggering command: /usr/local/bin/node /usr/local/bin/node /home/REDACTED/work/shelf.nu/shelf.nu/node_modules/prisma/build/child {"product":"prisma","version":"6.19.0","cli_install_type":"local","information":"","local_timestamp":"2025-12-01T13:37:29Z","project_hash":"e6fa372b","cli_path":"/home/REDACTED/work/shelf.nu/shelf.nu/node_modules/.bin/prisma","cli_path_hash":"39199cc4","end (dns block)
    • Triggering command: /usr/local/bin/node /usr/local/bin/node /home/REDACTED/work/shelf.nu/shelf.nu/node_modules/prisma/build/child {"product":"prisma","version":"6.19.0","cli_install_type":"local","information":"","local_timestamp":"2025-12-01T13:49:42Z","project_hash":"e6fa372b","cli_path":"/home/REDACTED/work/shelf.nu/shelf.nu/node_modules/.bin/prisma","cli_path_hash":"39199cc4","end (dns block)
    • Triggering command: /usr/local/bin/node /usr/local/bin/node /home/REDACTED/work/shelf.nu/shelf.nu/node_modules/prisma/build/child {"product":"prisma","version":"6.19.0","cli_install_type":"local","information":"","local_timestamp":"2025-12-01T13:51:37Z","project_hash":"e6fa372b","cli_path":"/home/REDACTED/work/shelf.nu/shelf.nu/node_modules/.bin/prisma","cli_path_hash":"39199cc4","end (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Bug: Booking time restrictions affect OWNER and ADMIN users and they shouldn't</issue_title>
<issue_description>The settings inside the Booking time restrictions section in the workspace settings are currently affecting all user types and they shouldn't. ADMIN and OWNER should be able to create bookings without those restrictions.</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@vercel
Copy link
Copy Markdown

vercel bot commented Dec 1, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
shelf-docs Ignored Ignored Preview Dec 2, 2025 1:28pm

Added `isAdminOrOwner` parameter to `BookingFormSchema` and `ExtendBookingSchema`
that bypasses bufferStartTime and maxBookingLength validations for ADMIN/OWNER
users while still enforcing them for BASE/SELF_SERVICE users.

Updated all client-side components and server-side routes to pass the user role
information to the schemas.

Co-authored-by: DonKoko <7840007+DonKoko@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix booking time restrictions for OWNER and ADMIN users fix: skip booking time restrictions for admin/owner users Dec 1, 2025
Copilot AI requested a review from DonKoko December 1, 2025 14:02
@DonKoko DonKoko marked this pull request as ready for review December 2, 2025 12:26
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@DonKoko DonKoko merged commit 651f451 into main Dec 2, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Booking time restrictions affect OWNER and ADMIN users and they shouldn't

2 participants