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.
Passed
Pull Request — master (#569)
by
unknown
03:18
created

ApplicationHelper.auth0_logout_url()   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
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
  # Generates the logout URL for omniauth_auth0
43
  def auth0_logout_url()
44
    "https://#{ENV['AUTH0_DOMAIN']}/logout?returnTo=#{logout_url}&client_id=#{ENV['AUTH0_ID']}"
45
  end
46
47
  # Determine if Greenlight is configured to allow user signups.
48
  def allow_user_signup?
49
    Rails.configuration.allow_user_signup
50
  end
51
52
  # Determines if the BigBlueButton endpoint is the default.
53
  def bigbluebutton_endpoint_default?
54
    Rails.configuration.bigbluebutton_endpoint_default == Rails.configuration.bigbluebutton_endpoint
55
  end
56
57
  # Returns language selection options
58
  def language_options
59
    locales = I18n.available_locales
60
    language_opts = [['<<<< ' + t("language_default") + ' >>>>', "default"]]
61
    locales.each do |locale|
62
      language_name = t("language_name", locale: locale)
63
      language_name = locale.to_s if locale != :en && language_name == 'English'
64
      language_opts.push([language_name, locale.to_s])
65
    end
66
    language_opts.sort
67
  end
68
69
  # Parses markdown for rendering.
70
  def markdown(text)
71
    markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML,
72
      no_intra_emphasis: true,
73
      fenced_code_blocks: true,
74
      disable_indented_code_blocks: true,
75
      autolink: true,
76
      tables: true,
77
      underline: true,
78
      highlight: true)
79
80
    markdown.render(text).html_safe
81
  end
82
83
  def allow_greenlight_accounts?
84
    return Rails.configuration.allow_user_signup unless Rails.configuration.loadbalanced_configuration
85
    return false unless @user_domain && !@user_domain.empty? && Rails.configuration.allow_user_signup
86
    # Proceed with retrieving the provider info
87
    begin
88
      provider_info = retrieve_provider_info(@user_domain, 'api2', 'getUserGreenlightCredentials')
89
      provider_info['provider'] == 'greenlight'
90
    rescue => e
91
      logger.info e
92
      false
93
    end
94
  end
95
96
  # Return all the translations available in the client side through javascript
97
  def current_translations
98
    @translations ||= I18n.backend.send(:translations)
99
    @translations[I18n.locale].with_indifferent_access[:javascript] || {}
100
  end
101
102
  # Returns the page that the logo redirects to when clicked on
103
  def home_page
104
    return root_path unless current_user
105
    return admins_path if current_user.has_role? :super_admin
106
    current_user.main_room
107
  end
108
end
109