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
Pull Request — master (#569)
by Jesus
03:57
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
require 'i18n/language/mapping'
21
22
module ApplicationHelper
23
  include MeetingsHelper
24
  include BbbApi
25
  include I18n::Language::Mapping
26
27
  # Gets all configured omniauth providers.
28
  def configured_providers
29
    Rails.configuration.providers.select do |provider|
30
      Rails.configuration.send("omniauth_#{provider}")
31
    end
32
  end
33
34
  # Determines which providers can show a login button in the login modal.
35
  def iconset_providers
36
    providers = configured_providers & [:google, :twitter, :office365, :ldap]
37
38
    providers.delete(:twitter) if session[:old_twitter_user_id]
39
40
    providers
41
  end
42
43
  # Generates the login URL for a specific provider.
44
  def omniauth_login_url(provider)
45
    if provider == :ldap
46
      ldap_signin_path
47
    else
48
      "#{Rails.configuration.relative_url_root}/auth/#{provider}"
49
    end
50
  end
51
52
  # Generates the logout URL for omniauth_auth0
53
  def auth0_logout_url
54
    "https://#{ENV['AUTH0_DOMAIN']}/logout?returnTo=#{logout_url}&client_id=#{ENV['AUTH0_ID']}"
55
  end
56
57
  # Determine if Greenlight is configured to allow user signups.
58
  def allow_user_signup?
59
    Rails.configuration.allow_user_signup
60
  end
61
62
  # Determines if the BigBlueButton endpoint is the default.
63
  def bigbluebutton_endpoint_default?
64
    Rails.configuration.bigbluebutton_endpoint_default == Rails.configuration.bigbluebutton_endpoint
65
  end
66
67
  # Returns language selection options
68
  def language_options
69
    locales = I18n.available_locales
70
    language_opts = [['<<<< ' + t("language_default") + ' >>>>', "default"]]
71
    locales.each do |locale|
72
      language_mapping = I18n::Language::Mapping.language_mapping_list[locale.to_s.gsub("_", "-")]
73
      language_opts.push([language_mapping["nativeName"], locale.to_s])
74
    end
75
    language_opts.sort
76
  end
77
78
  # Parses markdown for rendering.
79
  def markdown(text)
80
    markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML,
81
      no_intra_emphasis: true,
82
      fenced_code_blocks: true,
83
      disable_indented_code_blocks: true,
84
      autolink: true,
85
      tables: true,
86
      underline: true,
87
      highlight: true)
88
89
    markdown.render(text).html_safe
90
  end
91
92
  def allow_greenlight_accounts?
93
    return Rails.configuration.allow_user_signup unless Rails.configuration.loadbalanced_configuration
94
    return false unless @user_domain && !@user_domain.empty? && Rails.configuration.allow_user_signup
95
    # Proceed with retrieving the provider info
96
    begin
97
      provider_info = retrieve_provider_info(@user_domain, 'api2', 'getUserGreenlightCredentials')
98
      provider_info['provider'] == 'greenlight'
99
    rescue => e
100
      logger.info e
101
      false
102
    end
103
  end
104
105
  # Return all the translations available in the client side through javascript
106
  def current_translations
107
    @translations ||= I18n.backend.send(:translations)
108
    @translations[I18n.locale].with_indifferent_access[:javascript] || {}
109
  end
110
111
  # Returns the page that the logo redirects to when clicked on
112
  def home_page
113
    return root_path unless current_user
114
    return admins_path if current_user.has_role? :super_admin
115
    current_user.main_room
116
  end
117
end
118