Passed
Push — master ( 6bc43d...2da2ee )
by Ahmad
07:04
created

AdminsHelper.room_is_running()   A

Complexity

Conditions 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
dl 0
loc 3
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 View Code Duplication
  def room_authentication_string
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
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 View Code Duplication
  def shared_access_string
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
41
    if @settings.get_value("Shared Access") == "true"
42
      I18n.t("administrator.site_settings.authentication.enabled")
43
    else
44
      I18n.t("administrator.site_settings.authentication.disabled")
45
    end
46
  end
47
48
  def recording_default_visibility_string
49
    if @settings.get_value("Default Recording Visibility") == "public"
50
      I18n.t("recording.visibility.public")
51
    else
52
      I18n.t("recording.visibility.unlisted")
53
    end
54
  end
55
56
  def registration_method_string
57
    case @settings.get_value("Registration Method")
58
    when Rails.configuration.registration_methods[:open]
59
        I18n.t("administrator.site_settings.registration.methods.open")
60
    when Rails.configuration.registration_methods[:invite]
61
        I18n.t("administrator.site_settings.registration.methods.invite")
62
    when Rails.configuration.registration_methods[:approval]
63
        I18n.t("administrator.site_settings.registration.methods.approval")
64
      end
65
  end
66
67
  def log_level_string
68
    case Rails.logger.level
69
    when 0
70
      t("administrator.site_settings.log_level.debug")
71
    when 1
72
      t("administrator.site_settings.log_level.info")
73
    when 2
74
      t("administrator.site_settings.log_level.warn")
75
    when 3
76
      t("administrator.site_settings.log_level.error")
77
    when 4
78
      t("administrator.site_settings.log_level.fatal")
79
    when 5
80
      t("administrator.site_settings.log_level.unknown")
81
    end
82
  end
83
84
  def room_limit_number
85
    @settings.get_value("Room Limit").to_i
86
  end
87
88
  def edit_disabled
89
    @edit_disabled ||= @selected_role.priority <= current_user.highest_priority_role.priority
90
  end
91
92
  # Get the room status to display in the Server Rooms table
93
  def room_is_running(id)
94
    @running_room_bbb_ids.include?(id)
95
  end
96
end
97