GRN2-253: Added the ability to share rooms across multiple users (#912)
* Added ability to share rooms with other users * Fixed testcasesv2
parent
8cbfc3f730
commit
967130e57c
@ -0,0 +1,54 @@ |
||||
# frozen_string_literal: true |
||||
|
||||
# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/. |
||||
# |
||||
# Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below). |
||||
# |
||||
# This program is free software; you can redistribute it and/or modify it under the |
||||
# terms of the GNU Lesser General Public License as published by the Free Software |
||||
# Foundation; either version 3.0 of the License, or (at your option) any later |
||||
# version. |
||||
# |
||||
# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY |
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
||||
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU Lesser General Public License along |
||||
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. |
||||
|
||||
module Populator |
||||
extend ActiveSupport::Concern |
||||
|
||||
# Returns a list of rooms that are in the same context of the current user |
||||
def server_rooms_list |
||||
if Rails.configuration.loadbalanced_configuration |
||||
Room.includes(:owner).where(users: { provider: @user_domain }) |
||||
.admins_search(@search) |
||||
.admins_order(@order_column, @order_direction) |
||||
else |
||||
Room.all.admins_search(@search).admins_order(@order_column, @order_direction) |
||||
end |
||||
end |
||||
|
||||
# Returns list of rooms needed to get the recordings on the server |
||||
def rooms_list_for_recordings |
||||
if Rails.configuration.loadbalanced_configuration |
||||
Room.includes(:owner).where(users: { provider: @user_domain }).pluck(:bbb_id) |
||||
else |
||||
Room.pluck(:bbb_id) |
||||
end |
||||
end |
||||
|
||||
# Returns a list of users that are in the same context of the current user |
||||
def shared_user_list |
||||
roles_can_appear = [] |
||||
Role.where(provider: @user_domain).each do |role| |
||||
roles_can_appear << role.name if role.get_permission("can_appear_in_share_list") && role.name != "super_admin" |
||||
end |
||||
|
||||
initial_list = User.where.not(uid: current_user.uid).with_highest_priority_role(roles_can_appear) |
||||
|
||||
return initial_list unless Rails.configuration.loadbalanced_configuration |
||||
initial_list.where(provider: @user_domain) |
||||
end |
||||
end |
@ -0,0 +1,5 @@ |
||||
# frozen_string_literal: true |
||||
|
||||
class SharedAccess < ApplicationRecord |
||||
belongs_to :room |
||||
end |
@ -0,0 +1,48 @@ |
||||
<% |
||||
# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/. |
||||
# Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below). |
||||
# This program is free software; you can redistribute it and/or modify it under the |
||||
# terms of the GNU Lesser General Public License as published by the Free Software |
||||
# Foundation; either version 3.0 of the License, or (at your option) any later |
||||
# version. |
||||
# |
||||
# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY |
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
||||
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
||||
# You should have received a copy of the GNU Lesser General Public License along |
||||
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. |
||||
%> |
||||
|
||||
<div id="room-block" data-room-uid="<%= room.uid %>" data-room-settings=<%= room.room_settings %> data-room-access-code="<%= room.access_code %>" class="card"> |
||||
<div class="card-body p-1"> |
||||
<table class="table table-hover table-vcenter text-wrap table-no-border"> |
||||
<tbody class="no-border-top"> |
||||
<td> |
||||
<span class="stamp stamp-md bg-primary"> |
||||
<i class="fas fa-share-alt"></i> |
||||
</span> |
||||
</td> |
||||
<td> |
||||
<div id="room-name"> |
||||
<h4 contenteditable="false" class="m-0 force-text-normal" ><%= room.name %></h4> |
||||
</div> |
||||
<div class="small text-muted text-break"> |
||||
<%= t("room.shared_by", email: room.owner.name) %> |
||||
</div> |
||||
</td> |
||||
<td class="text-right"> |
||||
<div class="item-action dropdown" data-display="static"> |
||||
<a href="javascript:void(0)" data-toggle="dropdown" data-display="static" class="icon"> |
||||
<i class="fas fa-ellipsis-v px-4"></i> |
||||
</a> |
||||
<div class="dropdown-menu dropdown-menu-right dropdown-menu-md-left"> |
||||
<a href="" data-toggle="modal" data-target="#removeAccessModal" class="remove-share-room dropdown-item" data-path="<%= room_remove_shared_access_path(room) %>"> |
||||
<i class="dropdown-icon far fa-trash-alt"></i> <%= t("remove") %> |
||||
</a> |
||||
</div> |
||||
</div> |
||||
</td> |
||||
</tbody> |
||||
</table> |
||||
</div> |
||||
</div> |
@ -0,0 +1,39 @@ |
||||
<% |
||||
# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/. |
||||
# Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below). |
||||
# This program is free software; you can redistribute it and/or modify it under the |
||||
# terms of the GNU Lesser General Public License as published by the Free Software |
||||
# Foundation; either version 3.0 of the License, or (at your option) any later |
||||
# version. |
||||
# |
||||
# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY |
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
||||
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
||||
# You should have received a copy of the GNU Lesser General Public License along |
||||
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. |
||||
%> |
||||
|
||||
<div class="modal fade" id="removeAccessModal" tabindex="-1" role="dialog"> |
||||
<div class="modal-dialog modal-dialog-centered" role="document"> |
||||
<div class="modal-content text-center"> |
||||
<div class="modal-body"> |
||||
<div class="card-body p-6"> |
||||
<div class="card-title"> |
||||
<h3><%= t("modal.remove_shared.title")%></h3> |
||||
</div> |
||||
|
||||
<%= button_to "/", method: :delete, id: "remove-shared-confirm", class: "btn btn-danger my-1 btn-del-room" do %> |
||||
<%= hidden_field_tag :user_id, current_user.id %> |
||||
<%= t("modal.remove_shared.delete") %> |
||||
<% end %> |
||||
|
||||
</div> |
||||
<div class="card-footer"> |
||||
<p id="delete-footer"> |
||||
<%= t("modal.remove_shared.warning").html_safe %> |
||||
</p> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
@ -0,0 +1,45 @@ |
||||
<% |
||||
# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/. |
||||
# Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below). |
||||
# This program is free software; you can redistribute it and/or modify it under the |
||||
# terms of the GNU Lesser General Public License as published by the Free Software |
||||
# Foundation; either version 3.0 of the License, or (at your option) any later |
||||
# version. |
||||
# |
||||
# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY |
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
||||
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
||||
# You should have received a copy of the GNU Lesser General Public License along |
||||
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. |
||||
%> |
||||
|
||||
<div class="modal fade" id="shareRoomModal" tabindex="-1" role="dialog"> |
||||
<div class="modal-dialog modal-dialog-centered" role="document"> |
||||
<div class="modal-content text-center"> |
||||
<div class="modal-body"> |
||||
<div class="card-body p-6"> |
||||
<div class="card-title"> |
||||
<h3><%= t("modal.share_access.title") %></h3> |
||||
</div> |
||||
<select class="selectpicker" title="<%= t("modal.share_access.select") %>..." data-live-search="true" data-virtual-scroll="true" > |
||||
<% @user_list.each do |user| %> |
||||
<option value="<%= user.uid %>" data-subtext="<%= user.uid %>" ><%= user.name %></option> |
||||
<% end %> |
||||
</select> |
||||
<div class="mt-5 text-left"> |
||||
<label class="form-label"><%= t("modal.share_access.list") %></label> |
||||
<ul id="user-list" class="list-group"> |
||||
</ul> |
||||
</div> |
||||
<div class="mt-6"> |
||||
<button id="save-access" class="btn btn-primary btn-block" onclick="saveAccessChanges()" ><%= t("modal.share_access.save") %></button> |
||||
<button class="btn btn-secondary text-primary btn-block" onclick="$('#shareRoomModal').modal('hide')"><%= t("modal.share_access.cancel_changes") %></button> |
||||
</div> |
||||
</div> |
||||
<div class="card-footer"> |
||||
<p><%= t("modal.share_access.footer") %></p> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
@ -0,0 +1,12 @@ |
||||
# frozen_string_literal: true |
||||
|
||||
class CreateSharedAccesses < ActiveRecord::Migration[5.2] |
||||
def change |
||||
create_table :shared_accesses do |t| |
||||
t.belongs_to :room, foreign_key: true |
||||
t.references :user, foreign_key: true |
||||
|
||||
t.timestamps |
||||
end |
||||
end |
||||
end |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in new issue