add data migration to change zoom user default settings

This commit is contained in:
bilal
2020-06-23 11:31:44 +02:00
parent f5068a3a7e
commit 219bc5abd1
2 changed files with 27 additions and 14 deletions

View File

@@ -0,0 +1,9 @@
class ChangeExistingZoomUsersSettings < ActiveRecord::DataMigration
def up
gateway = ZoomGateway.new
ZoomUser.find_each do |zu|
gateway.update_user_settings zu.api_id
end
end
end

View File

@@ -69,6 +69,23 @@ class ZoomGateway
parse_zoom_error(e)
end
# Update user with custom settings
def update_user_settings(user_id)
custom_defaults = {
id: user_id,
in_meeting: {
auto_saving_chat: true,
co_host: true,
non_verbal_feedback: true,
breakout_room: true,
group_hd: true,
far_end_camera_control: true,
allow_live_streaming: true
}
}
@client.user_settings_update custom_defaults
end
def create_host(host_email)
# Find role
host_role = @client.roles_list["roles"].try(:select) { |r| r["name"] == self.class.HOST_ROLE }.try(:first)
@@ -86,20 +103,7 @@ class ZoomGateway
type: self.class.USER_TYPE
})
# Update user with custom settings
custom_defaults = {
id: host_user["id"],
in_meeting: {
auto_saving_chat: true,
co_host: true,
non_verbal_feedback: true,
breakout_room: true,
group_hd: true,
far_end_camera_control: true,
allow_live_streaming: true
}
}
@client.user_settings_update custom_defaults
update_user_settings(host_user["id"])
# Assign role to user
@client.roles_assign role_id: host_role["id"], members: [{id: host_user["id"]}]