GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — admin-panel ( 9a8a6a...21f867 )
by Jesus
03:54
created

ApplicationHelper.home_page()   A

Complexity

Conditions 3

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
dl 0
loc 5
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
require 'bbb_api'
20
21
module ApplicationHelper
22
  include MeetingsHelper
23
  include BbbApi
24
25
  # Gets all configured omniauth providers.
26
  def configured_providers
27
    Rails.configuration.providers.select do |provider|
28
      Rails.configuration.send("omniauth_#{provider}")
29
    end
30
  end
31
32
  # Determines which providers can show a login button in the login modal.
33
  def iconset_providers
34
    configured_providers & [:google, :twitter, :microsoft_office365]
35
  end
36
37
  # Generates the login URL for a specific provider.
38
  def omniauth_login_url(provider)
39
    "#{Rails.configuration.relative_url_root}/auth/#{provider}"
40
  end
41
42
  # Determine if Greenlight is configured to allow user signups.
43
  def allow_user_signup?
44
    Rails.configuration.allow_user_signup
45
  end
46
47
  # Determines if the BigBlueButton endpoint is the default.
48
  def bigbluebutton_endpoint_default?
49
    Rails.configuration.bigbluebutton_endpoint_default == Rails.configuration.bigbluebutton_endpoint
50
  end
51
52
  # Returns language selection options
53
  def language_options
54
    locales = I18n.available_locales
55
    language_opts = [['<<<< ' + t("language_default") + ' >>>>', "default"]]
56
    locales.each do |locale|
57
      language_name = t("language_name", locale: locale)
58
      language_name = locale.to_s if locale != :en && language_name == 'English'
59
      language_opts.push([language_name, locale.to_s])
60
    end
61
    language_opts.sort
62
  end
63
64
  # Parses markdown for rendering.
65
  def markdown(text)
66
    markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML,
67
      no_intra_emphasis: true,
68
      fenced_code_blocks: true,
69
      disable_indented_code_blocks: true,
70
      autolink: true,
71
      tables: true,
72
      underline: true,
73
      highlight: true)
74
75
    markdown.render(text).html_safe
76
  end
77
78
  def allow_greenlight_accounts?
79
    return Rails.configuration.allow_user_signup unless Rails.configuration.loadbalanced_configuration
80
    return false unless @user_domain && !@user_domain.empty? && Rails.configuration.allow_user_signup
81
    # No need to retrieve the provider info if the provider is whitelisted
82
    return true if launcher_allow_user_signup_whitelisted?(@user_domain)
83
    # Proceed with retrieving the provider info
84
    begin
85
      provider_info = retrieve_provider_info(@user_domain, 'api2', 'getUserGreenlightCredentials')
86
      provider_info['provider'] == 'greenlight'
87
    rescue => e
88
      logger.info e
89
      false
90
    end
91
  end
92
93
  # Return all the translations available in the client side through javascript
94
  def current_translations
95
    @translations ||= I18n.backend.send(:translations)
96
    @translations[I18n.locale].with_indifferent_access[:javascript] || {}
97
  end
98
99
  # Returns the page that the logo redirects to when clicked on
100
  def home_page
101
    return root_path unless current_user
102
    return admins_path if current_user.has_role? :super_admin
103
    current_user.main_room
104
  end
105
end
106