Completed
Branch scrut-fixes (283d0e)
by Ahmad
05:43
created

AdminsHelper.admin_invite_registration()   A

Complexity

Conditions 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
# frozen_string_literal: true
2
3
# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/.
4
#
5
# Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below).
6
#
7
# This program is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU Lesser General Public License as published by the Free Software
9
# Foundation; either version 3.0 of the License, or (at your option) any later
10
# version.
11
#
12
# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
15
#
16
# You should have received a copy of the GNU Lesser General Public License along
17
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
18
19
module AdminsHelper
20
  include Pagy::Frontend
21
22
  # Gets the email of the room owner to which the recording belongs to
23
  def recording_owner_email(room_id)
24
    Room.find_by(bbb_id: room_id).owner.email
25
  end
26
27
  def admin_invite_registration
28
    controller_name == "admins" && action_name == "index" &&
29
      @settings.get_value("Registration Method") == Rails.configuration.registration_methods[:invite]
30
  end
31
32
  def room_authentication_string
33
    if @settings.get_value("Room Authentication") == "true"
34
      I18n.t("administrator.site_settings.authentication.enabled")
35
    else
36
      I18n.t("administrator.site_settings.authentication.disabled")
37
    end
38
  end
39
40
  def recording_default_visibility_string
41
    if @settings.get_value("Default Recording Visibility") == "public"
42
      I18n.t("recording.visibility.public")
43
    else
44
      I18n.t("recording.visibility.unlisted")
45
    end
46
  end
47
48
  def registration_method_string
49
    case @settings.get_value("Registration Method")
50
    when Rails.configuration.registration_methods[:open]
51
        I18n.t("administrator.site_settings.registration.methods.open")
52
    when Rails.configuration.registration_methods[:invite]
53
        I18n.t("administrator.site_settings.registration.methods.invite")
54
    when Rails.configuration.registration_methods[:approval]
55
        I18n.t("administrator.site_settings.registration.methods.approval")
56
      end
57
  end
58
59
  def room_limit_number
60
    @settings.get_value("Room Limit").to_i
61
  end
62
63
  def edit_disabled
64
    @edit_disabled ||= @selected_role.priority <= current_user.highest_priority_role.priority
65
  end
66
end
67