Skip to content

Commit

Permalink
Merge branch 'master' into GRN2-6-3
Browse files Browse the repository at this point in the history
  • Loading branch information
farhatahmad committed May 17, 2019
2 parents 553b667 + adf4b68 commit a49cfc8
Show file tree
Hide file tree
Showing 39 changed files with 684 additions and 38 deletions.
33 changes: 25 additions & 8 deletions app/assets/javascripts/admins.js
Expand Up @@ -31,15 +31,32 @@ $(document).on('turbolinks:load', function(){
$("#delete-confirm").parent().attr("action", url)
})

// Change the color of the color inputs when the color is changed
$(".colorinput-input").change(function(data) {
// Get the color from the input
var color = $(data.target).val()
$('.colorinput').ColorPicker({
onHide: function (colpkr) {
var colour = $("#user-colour").val();

// Update the color in the database and reload the page
$.post($("#coloring-path").val(), {color: color}).done(function(data) {
location.reload()
});
// Update the color in the database and reload the page
$.post($("#coloring-path").val(), {color: colour}).done(function(data) {
location.reload()
});
},

onSubmit: function(hsb, hex, rgb, el) {
$.post($("#coloring-path").val(), {color: '#' + hex}).done(function(data) {
location.reload()
});
},

onBeforeShow: function () {
var colour = $("#user-colour").val();

$(this).ColorPickerSetColor(colour);
},

onChange: function (hsb, hex, rgb) {
$('.colorinput span').css('backgroundColor', '#' + hex);
$("#user-colour").val('#' + hex);
}
});
}

Expand Down
1 change: 1 addition & 0 deletions app/assets/javascripts/application.js
Expand Up @@ -31,4 +31,5 @@
//= require tabler
//= require tabler.plugins
//= require jquery_ujs
//= require colorpicker
//= require_tree .
4 changes: 4 additions & 0 deletions app/assets/stylesheets/admins.scss
Expand Up @@ -30,3 +30,7 @@
cursor: pointer;
}
}

#branding-image{
z-index: auto;
}
1 change: 1 addition & 0 deletions app/assets/stylesheets/application.scss
Expand Up @@ -33,6 +33,7 @@
@import "tabler/variables";
@import "bootstrap";
@import "tabler-custom";
@import "colorpicker";

@import "utilities/variables";
@import "admins";
Expand Down
2 changes: 0 additions & 2 deletions app/helpers/application_helper.rb
Expand Up @@ -78,8 +78,6 @@ def markdown(text)
def allow_greenlight_accounts?
return Rails.configuration.allow_user_signup unless Rails.configuration.loadbalanced_configuration
return false unless @user_domain && !@user_domain.empty? && Rails.configuration.allow_user_signup
# No need to retrieve the provider info if the provider is whitelisted
return true if launcher_allow_user_signup_whitelisted?(@user_domain)
# Proceed with retrieving the provider info
begin
provider_info = retrieve_provider_info(@user_domain, 'api2', 'getUserGreenlightCredentials')
Expand Down
5 changes: 2 additions & 3 deletions app/models/user.rb
Expand Up @@ -200,9 +200,8 @@ def name_chunk

def greenlight_account?
return true unless provider # For testing cases when provider is set to null
return provider == "greenlight" unless Rails.configuration.loadbalanced_configuration
# No need to retrive the provider info if the provider is whitelisted
return true if launcher_allow_user_signup_whitelisted?(provider)
return true if provider == "greenlight"
return false unless Rails.configuration.loadbalanced_configuration
# Proceed with fetching the provider info
provider_info = retrieve_provider_info(provider, 'api2', 'getUserGreenlightCredentials')
provider_info['provider'] == 'greenlight'
Expand Down
8 changes: 4 additions & 4 deletions app/views/shared/admin_settings/_site_settings.html.erb
Expand Up @@ -22,7 +22,7 @@
<div class="input-group">
<input id="branding-url" type="text" class="form-control" value="<%= logo_image %>">
<span class="input-group-append">
<button onclick="changeBrandingImage('<%= admin_branding_path %>')" class="btn btn-primary" type="button"><%= t("administrator.site_settings.branding.change") %></button>
<button id="branding-image" onclick="changeBrandingImage('<%= admin_branding_path %>')" class="btn btn-primary" type="button"><%= t("administrator.site_settings.branding.change") %></button>
</span>
</div>
</div>
Expand All @@ -36,12 +36,12 @@
<div class="row gutters-xs">
<div class="col-auto">
<input id="coloring-path" value="<%= admin_coloring_path %>" hidden>
<label class="colorinput">
<input name="color" type="color" value="<%= user_color %>" class="colorinput-input" />
<input id="user-colour" value="<%= user_color %>" hidden/>
<div class="colorinput">
<span class="colorinput-color" style="background: <%= user_color %>;">
<i class="p-1 fas fa-paint-brush"></i>
</span>
</label>
</div>
</div>
</div>
</div>
Expand Down
3 changes: 1 addition & 2 deletions config/application.rb
Expand Up @@ -48,7 +48,7 @@ class Application < Rails::Application
config.gl_callback_url = ENV["GL_CALLBACK_URL"]

# Default credentials (test-install.blindsidenetworks.com/bigbluebutton).
config.bigbluebutton_endpoint_default = "http://test-install.blindsidenetworks.com/bigbluebutton/"
config.bigbluebutton_endpoint_default = "http://test-install.blindsidenetworks.com/bigbluebutton/api/"
config.bigbluebutton_secret_default = "8cd8ef52e8e101574e400365b55e11a6"

# Use standalone BigBlueButton server.
Expand All @@ -66,7 +66,6 @@ class Application < Rails::Application
config.loadbalancer_endpoint = ENV["LOADBALANCER_ENDPOINT"]
config.loadbalancer_secret = ENV["LOADBALANCER_SECRET"]
config.launcher_secret = ENV["LAUNCHER_SECRET"]
config.launcher_allow_user_signup = ENV["LAUNCHER_ALLOW_GREENLIGHT_ACCOUNTS"]

# Fix endpoint format if required.
config.loadbalancer_endpoint += "/" unless config.bigbluebutton_endpoint.ends_with?("/")
Expand Down
6 changes: 0 additions & 6 deletions lib/bbb_api.rb
Expand Up @@ -73,10 +73,4 @@ def encode_bbb_url(base_url, secret, params, route = 'getUser')
def remove_slash(s)
s.nil? ? nil : s.chomp("/")
end

def launcher_allow_user_signup_whitelisted?(provider)
return false unless Rails.configuration.launcher_allow_user_signup
whitelist = Rails.configuration.launcher_allow_user_signup.split(',')
whitelist.include?(provider)
end
end
2 changes: 1 addition & 1 deletion lib/tasks/configuration.rake
Expand Up @@ -24,7 +24,7 @@ namespace :conf do
# Tests the checksum on the getMeetings api call
print "Checking Secret"
checksum = Digest::SHA1.hexdigest("getMeetings#{ENV['BIGBLUEBUTTON_SECRET']}")
test_request("#{ENV['BIGBLUEBUTTON_ENDPOINT']}api/getMeetings?checksum=#{checksum}")
test_request("#{ENV['BIGBLUEBUTTON_ENDPOINT']}getMeetings?checksum=#{checksum}")
passed

if ENV['ALLOW_MAIL_NOTIFICATIONS'] == 'true'
Expand Down
12 changes: 0 additions & 12 deletions spec/helpers/application_helper_spec.rb
Expand Up @@ -65,20 +65,9 @@
expect(helper.allow_greenlight_accounts?).to eql(false)
end

it "allows if user_domain is white listed" do
allow(Rails.configuration).to receive(:loadbalanced_configuration).and_return(true)
allow(Rails.configuration).to receive(:allow_user_signup).and_return(true)
allow(helper).to receive(:launcher_allow_user_signup_whitelisted?).and_return(true)

@user_domain = "provider1"

expect(helper.allow_greenlight_accounts?).to eql(true)
end

it "allows if user provider is set to greenlight" do
allow(Rails.configuration).to receive(:loadbalanced_configuration).and_return(true)
allow(Rails.configuration).to receive(:allow_user_signup).and_return(true)
allow(helper).to receive(:launcher_allow_user_signup_whitelisted?).and_return(false)
allow(helper).to receive(:retrieve_provider_info).and_return("provider" => "greenlight")

@user_domain = "provider1"
Expand All @@ -89,7 +78,6 @@
it "doesnt allow if user provider is not set to greenlight" do
allow(Rails.configuration).to receive(:loadbalanced_configuration).and_return(true)
allow(Rails.configuration).to receive(:allow_user_signup).and_return(true)
allow(helper).to receive(:launcher_allow_user_signup_whitelisted?).and_return(false)
allow(helper).to receive(:retrieve_provider_info).and_return("provider" => "google")

@user_domain = "provider1"
Expand Down
Binary file added vendor/assets/images/colourPicker/blank.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added vendor/assets/images/colourPicker/custom_hex.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added vendor/assets/images/colourPicker/custom_hsb_h.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added vendor/assets/images/colourPicker/custom_indic.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added vendor/assets/images/colourPicker/custom_rgb_b.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added vendor/assets/images/colourPicker/custom_rgb_r.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added vendor/assets/images/colourPicker/custom_submit.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added vendor/assets/images/colourPicker/select.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added vendor/assets/images/colourPicker/select2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added vendor/assets/images/colourPicker/slider.png

0 comments on commit a49cfc8

Please sign in to comment.