Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(placeos/room-events): add list_users func #461

Merged
merged 3 commits into from
Sep 22, 2023
Merged
Changes from 2 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
12 changes: 10 additions & 2 deletions drivers/place/bookings.cr
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ class Place::Bookings < PlaceOS::Driver
room_image: "https://domain.com/room_image.svg",
sensor_mac: "device-mac",

hide_meeting_details: false,
hide_meeting_title: false,
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).get.as_a
w-le marked this conversation as resolved.
Show resolved Hide resolved
end

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