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 — v2.4-alpha ( acb141...84c1dc )
by Ahmad
04:48
created

AuthValues.auth_name()   A

Complexity

Conditions 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
c 1
b 0
f 0
dl 0
loc 8
rs 10
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 AuthValues
20
  extend ActiveSupport::Concern
21
22
  # Provider attributes.
23
  def auth_name(auth)
24
    case auth['provider']
25
    when :office365
26
      auth['info']['display_name']
27
    else
28
      auth['info']['name']
29
    end
30
  end
31
32
  def auth_username(auth)
33
    case auth['provider']
34
    when :google
35
      auth['info']['email'].split('@').first
36
    when :bn_launcher
37
      auth['info']['username']
38
    else
39
      auth['info']['nickname']
40
    end
41
  end
42
43
  def auth_email(auth)
44
    auth['info']['email']
45
  end
46
47
  def auth_image(auth)
48
    case auth['provider']
49
    when :twitter
50
      auth['info']['image'].gsub("http", "https").gsub("_normal", "")
51
    else
52
      auth['info']['image']
53
    end
54
  end
55
56
  def auth_roles(user, auth)
57
    unless auth['info']['roles'].nil?
58
      roles = auth['info']['roles'].split(',')
59
60
      role_provider = auth['provider'] == "bn_launcher" ? auth['info']['customer'] : "greenlight"
61
      roles.each do |role_name|
62
        role = Role.where(provider: role_provider, name: role_name).first
63
        user.roles << role unless role.nil?
64
      end
65
    end
66
  end
67
end
68