Skip to content

Commit

Permalink
feat(placeos/room-events): add list_users func (#461)
Browse files Browse the repository at this point in the history
* feat(placeos/room-events): add list_users func

* style(placeos/room-events): format

* chore(placeos/room-events): don't parse calendar resp internally

Co-authored-by: Stephen von Takach <[email protected]>

---------

Co-authored-by: Stephen von Takach <[email protected]>
  • Loading branch information
w-le and stakach authored Sep 22, 2023
1 parent 39bc758 commit f126d59
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions drivers/place/bookings.cr
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class Place::Bookings < PlaceOS::Driver
hide_meeting_details: false,
hide_meeting_title: false,
enable_end_meeting_button: false,
max_user_search_results: 20,

# use this to expose arbitrary fields to influx
# expose_for_analytics: {"binding" => "key->subkey"},
Expand All @@ -67,6 +68,7 @@ class Place::Bookings < PlaceOS::Driver
@include_cancelled_bookings : Bool = false
@application_permissions : Bool = false
@disable_book_now_host : Bool = false
@max_user_search_results : UInt32 = 20

@current_meeting_id : String = ""
@current_pending : Bool = false
Expand Down Expand Up @@ -106,6 +108,7 @@ class Place::Bookings < PlaceOS::Driver
@disable_book_now = book_now.nil? ? !bookable : !!book_now
@disable_end_meeting = !!setting?(Bool, :disable_end_meeting)
@disable_book_now_host = setting?(Bool, :disable_book_now_host) || false
@max_user_search_results = setting?(UInt32, :max_user_search_results) || 20_u32

pending_period = setting?(UInt32, :pending_period) || 5_u32
@pending_period = pending_period.minutes
Expand Down Expand Up @@ -208,6 +211,11 @@ class Place::Bookings < PlaceOS::Driver
schedule.in(1.seconds) { poll_events } unless (subscription = @subscription) && !subscription.expired?
end

# Allow apps to search for attendees (to add to new bookings) via driver instead of via staff-api (as some role based accounts may not have MS Graph access)
def list_users(query : String? = nil, limit : UInt32? = 20_u32)
calendar.list_users(query, limit)
end

def book_now(period_in_seconds : Int64, title : String? = nil, owner : String? = nil)
title ||= @default_title
starting = Time.utc.to_unix
Expand Down

0 comments on commit f126d59

Please sign in to comment.