Admin panel (#496)
* Added the administrator role and functionality that comes with it (#403) * GRN-20: Added roles to the user model * GRN-75: Added a view for admins to see their users * GRN-77: Added Edit/Delete/Promote ability for admins * GRN-71: Added admin account by default * Changed the way locales are shown * Updated the rest of the locales * Changed the way available_locales are defined * Updated locales in Russian * Updated locaales for German * Update user.rb * Update admins.js * GRN-15: Added the ability to change color and image from admin interface (#425) * GRN-20: Added roles to the user model * GRN-75: Added a view for admins to see their users * GRN-77: Added Edit/Delete/Promote ability for admins * GRN-71: Added admin account by default * Changed the way locales are shown * Updated the rest of the locales * Changed the way available_locales are defined * Updated locales in Russian * Updated locaales for German * GRN-15: Added the ability for admins to customize color and image * Update user.rb * Update user.rb * Update routes.rb * Update admins_controller.rb * GRN-87:Added a super admin role and made changes to how to the design works (#430) * GRN-20: Added roles to the user model * GRN-75: Added a view for admins to see their users * GRN-77: Added Edit/Delete/Promote ability for admins * GRN-71: Added admin account by default * Changed the way locales are shown * Updated the rest of the locales * Changed the way available_locales are defined * Updated locales in Russian * Updated locaales for German * GRN-15: Added the ability for admins to customize color and image * Added the super admin and completed the design tab * Update user.rb * Update themes_controller_spec.rb * Update routes.rb * Update admins_controller.rb * Removed duplicated code that broke the build after last merge * GRN-78: Restructured some of the views to make the UI more consistent and responsive (#435) * GRN-20: Added roles to the user model * GRN-75: Added a view for admins to see their users * GRN-77: Added Edit/Delete/Promote ability for admins * GRN-71: Added admin account by default * GRN-15: Added the ability for admins to customize color and image * Added the super admin and completed the design tab * GRN-78: Cleaned up buttons and moved signin to its own page * GRN-78: Moved the Rooms and Recordings link to nav bar * Merge fix * Views restructure fix (#458) * Added cache to gitlab-ci.yml * Restructured seed * GRN2-99 -> GRN2-106: UI cleanup and refactoring (#478) * GRN2-98: Change Fullname to Full name * GRN2-105: Changed View Users to Manage Users * GRN2-101/103: Updated email to match branding * GRN2-100: Updated Email Sent flash to be more descriptive * GRN2-104: Redirect user to sign in page w/ flash after clicking activation link * GRN2-102: Changed the wording in the verification email * GRN2-99: Added email form validation * GRN2-106: Cleaned up Users list front end * Fixes to rake and admin password validator for passing rubocop * GRN2-113: Fixed issues with admin panel (#479) * GRN2-116: Code clean up after restructure of views (#482) * Removed unused references * Rubocop * Added pagination to admin view (#483) * GRN2-114: Added the ability for admins to ban/unban users (#487) * Added the ability for admins to ban and unban users * Update sessions_helper.rb * Merge branch 'master' into admin-panel (#492) * Updated rubocop gem * Updated rubocop and fixed issues (#490) * Rubocop fixes * GRN2-122: Updated sign in flow for admins and switch design tab to site settings (#489) * Switched design tab to site settings * Update _header with spaces instead of tabs * Added more test cases to increase coverage (#494)v2
parent
b9efff586a
commit
9f74b0e2c0
@ -0,0 +1,97 @@ |
||||
// BigBlueButton open source conferencing system - http://www.bigbluebutton.org/.
|
||||
//
|
||||
// Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below).
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Lesser General Public License as published by the Free Software
|
||||
// Foundation; either version 3.0 of the License, or (at your option) any later
|
||||
// version.
|
||||
//
|
||||
// BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
// PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License along
|
||||
// with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
$(document).on('turbolinks:load', function(){ |
||||
var controller = $("body").data('controller'); |
||||
var action = $("body").data('action'); |
||||
|
||||
// Only run on the admins page.
|
||||
if (controller == "admins" && action == "index") { |
||||
// show the modal with the correct form action url
|
||||
$(".delete-user").click(function(data){ |
||||
var uid = $(data.target).closest("tr").data("user-uid") |
||||
$("#delete-confirm").parent().attr("action", "/u/" + uid) |
||||
}) |
||||
|
||||
// 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() |
||||
|
||||
// Update the color in the database and reload the page
|
||||
$.post($("#coloring-path").val(), {color: color}).done(function(data) { |
||||
location.reload() |
||||
}); |
||||
}); |
||||
|
||||
// Submit search if the user hits enter
|
||||
$("#search-input").keypress(function(key) { |
||||
var keyPressed = key.which |
||||
if (keyPressed == 13) { |
||||
searchPage() |
||||
} |
||||
}) |
||||
|
||||
// Add listeners for sort
|
||||
$("th[data-order]").click(function(data){ |
||||
var header_elem = $(data.target) |
||||
|
||||
if(header_elem.data('order') === 'asc'){ // asc
|
||||
header_elem.data('order', 'desc'); |
||||
} |
||||
else if(header_elem.data('order') === 'desc'){ // desc
|
||||
header_elem.data('order', 'none'); |
||||
} |
||||
else{ // none
|
||||
header_elem.data('order', 'asc'); |
||||
} |
||||
|
||||
var search = $("#search-input").val() |
||||
window.location.replace(window.location.pathname + "?page=1&search=" + search + "&column=" + header_elem.data("header") + "&direction="+ header_elem.data('order')) |
||||
}) |
||||
} |
||||
|
||||
// Only run on the admins edit user page.
|
||||
if (controller == "admins" && action == "edit_user") { |
||||
$("#users").click(function(data){ |
||||
var url = $("body").data("relative-root") |
||||
if (!url.endsWith("/")) { |
||||
url += "/" |
||||
} |
||||
url += "admins" |
||||
|
||||
window.location.href = url |
||||
}) |
||||
} |
||||
}); |
||||
|
||||
// Change the branding image to the image provided
|
||||
function changeBrandingImage(path) { |
||||
var url = $("#branding-url").val() |
||||
$.post(path, {url: url}) |
||||
} |
||||
|
||||
// Searches the user table for the given string
|
||||
function searchPage() { |
||||
var search = $("#search-input").val() |
||||
|
||||
window.location.replace(window.location.pathname + "?page=1&search=" + search) |
||||
} |
||||
|
||||
// Clears the search bar
|
||||
function clearSearch() { |
||||
window.location.replace(window.location.pathname + "?page=1") |
||||
} |
@ -0,0 +1,32 @@ |
||||
// BigBlueButton open source conferencing system - http://www.bigbluebutton.org/. |
||||
// |
||||
// Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below). |
||||
// |
||||
// This program is free software; you can redistribute it and/or modify it under the |
||||
// terms of the GNU Lesser General Public License as published by the Free Software |
||||
// Foundation; either version 3.0 of the License, or (at your option) any later |
||||
// version. |
||||
// |
||||
// BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY |
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
||||
// PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
||||
// |
||||
// You should have received a copy of the GNU Lesser General Public License along |
||||
// with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. |
||||
|
||||
#users-table { |
||||
.user-role:hover { |
||||
cursor: default; |
||||
} |
||||
} |
||||
|
||||
#clear-search { |
||||
z-index: 9; |
||||
position: absolute; |
||||
right: 55px; |
||||
top: 8px; |
||||
|
||||
&:hover { |
||||
cursor: pointer; |
||||
} |
||||
} |
@ -0,0 +1,125 @@ |
||||
.btn-primary, |
||||
.btn-primary:visited, |
||||
.btn-primary i { |
||||
background-color: $primary-color !important; |
||||
border-color: $primary-color !important; |
||||
color: white !important; |
||||
} |
||||
|
||||
.btn-primary:active, |
||||
.btn-primary:active:focus, |
||||
.btn-primary:active:hover, |
||||
.btn-primary:focus, |
||||
.btn-primary:hover, |
||||
.btn-primary:hover i { |
||||
background-color: $primary-color-darken !important; |
||||
border-color: $primary-color-darken !important; |
||||
color: white !important; |
||||
} |
||||
|
||||
a { |
||||
color: $primary-color !important; |
||||
} |
||||
|
||||
.oauth-signin { |
||||
color: white !important; |
||||
|
||||
&:hover * { |
||||
color: white !important; |
||||
} |
||||
} |
||||
|
||||
.btn-outline-primary { |
||||
border-color: $primary-color !important; |
||||
color: $primary-color !important; |
||||
|
||||
&:hover { |
||||
background: $primary-color !important; |
||||
color: white !important; |
||||
} |
||||
|
||||
&:focus { |
||||
box-shadow: 0 0 0 2px $primary-color-lighten; |
||||
} |
||||
} |
||||
|
||||
.header { |
||||
& .avatar { |
||||
background-color: $primary-color !important; |
||||
color: white !important; |
||||
} |
||||
|
||||
& a:hover:not(.btn) { |
||||
color: $primary-color !important; |
||||
} |
||||
|
||||
& .header-nav { |
||||
border-color: $primary-color !important; |
||||
} |
||||
|
||||
& .header-nav.active { |
||||
color: $primary-color !important; |
||||
} |
||||
} |
||||
|
||||
.dropdown-item { |
||||
color: #6e7687 !important; |
||||
&:hover { |
||||
color: $primary-color !important; |
||||
} |
||||
&:active { |
||||
background-color: $primary-color-lighten !important; |
||||
} |
||||
} |
||||
|
||||
input:focus, select:focus { |
||||
box-shadow: 0 0 5px $primary-color !important; |
||||
border-color: $primary-color !important; |
||||
} |
||||
|
||||
.list-group-item.active { |
||||
background-color: $primary-color-lighten !important; |
||||
|
||||
&, .list-group-item.active * { |
||||
color: $primary-color !important; |
||||
} |
||||
} |
||||
|
||||
.text-primary { |
||||
color: $primary-color !important; |
||||
} |
||||
|
||||
.bg-primary { |
||||
background-color: $primary-color !important; |
||||
} |
||||
|
||||
.btn-danger { |
||||
color: white !important; |
||||
} |
||||
|
||||
#clear-search { |
||||
&:hover { |
||||
color: $primary-color-darken !important; |
||||
} |
||||
} |
||||
|
||||
.pagination { |
||||
.page-item { |
||||
&.active a { |
||||
color:white !important; |
||||
background-color: $primary-color !important; |
||||
} |
||||
|
||||
& a { |
||||
border-color: $primary-color !important; |
||||
} |
||||
|
||||
& a:hover { |
||||
background-color: $primary-color-lighten !important; |
||||
} |
||||
|
||||
& a:focus { |
||||
box-shadow: 0 0 3px $primary-color !important; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,101 @@ |
||||
# frozen_string_literal: true |
||||
|
||||
# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/. |
||||
# |
||||
# Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below). |
||||
# |
||||
# This program is free software; you can redistribute it and/or modify it under the |
||||
# terms of the GNU Lesser General Public License as published by the Free Software |
||||
# Foundation; either version 3.0 of the License, or (at your option) any later |
||||
# version. |
||||
# |
||||
# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY |
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
||||
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU Lesser General Public License along |
||||
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. |
||||
|
||||
class AdminsController < ApplicationController |
||||
include Pagy::Backend |
||||
authorize_resource class: false |
||||
before_action :find_user, only: [:edit_user, :promote, :demote, :ban_user, :unban_user] |
||||
before_action :verify_admin_of_user, only: [:edit_user, :promote, :demote, :ban_user, :unban_user] |
||||
before_action :find_setting, only: [:branding, :coloring] |
||||
|
||||
# GET /admins |
||||
def index |
||||
@search = params[:search] || "" |
||||
@order_column = params[:column] && params[:direction] != "none" ? params[:column] : "created_at" |
||||
@order_direction = params[:direction] && params[:direction] != "none" ? params[:direction] : "DESC" |
||||
puts @order_direction.to_s |
||||
|
||||
if Rails.configuration.loadbalanced_configuration |
||||
@pagy, @users = pagy(User.without_role(:super_admin) |
||||
.where(provider: user_settings_provider) |
||||
.where.not(id: current_user.id) |
||||
.admins_search(@search) |
||||
.admins_order(@order_column, @order_direction)) |
||||
else |
||||
@pagy, @users = pagy(User.where.not(id: current_user.id) |
||||
.admins_search(@search) |
||||
.admins_order(@order_column, @order_direction)) |
||||
end |
||||
end |
||||
|
||||
# GET /admins/edit/:user_uid |
||||
def edit_user |
||||
render "admins/index", locals: { setting_id: "account" } |
||||
end |
||||
|
||||
# POST /admins/promote/:user_uid |
||||
def promote |
||||
@user.add_role :admin |
||||
redirect_to admins_path, flash: { success: I18n.t("administrator.flash.promoted") } |
||||
end |
||||
|
||||
# POST /admins/demote/:user_uid |
||||
def demote |
||||
@user.remove_role :admin |
||||
redirect_to admins_path, flash: { success: I18n.t("administrator.flash.demoted") } |
||||
end |
||||
|
||||
# POST /admins/branding |
||||
def branding |
||||
@settings.update_value("Branding Image", params[:url]) |
||||
redirect_to admins_path |
||||
end |
||||
|
||||
# POST /admins/color |
||||
def coloring |
||||
@settings.update_value("Primary Color", params[:color]) |
||||
redirect_to admins_path(setting: "site_settings") |
||||
end |
||||
|
||||
# POST /admins/ban/:user_uid |
||||
def ban_user |
||||
@user.add_role :denied |
||||
redirect_to admins_path, flash: { success: I18n.t("administrator.flash.banned") } |
||||
end |
||||
|
||||
# POST /admins/unban/:user_uid |
||||
def unban_user |
||||
@user.remove_role :denied |
||||
redirect_to admins_path, flash: { success: I18n.t("administrator.flash.unbanned") } |
||||
end |
||||
|
||||
private |
||||
|
||||
def find_user |
||||
@user = User.find_by!(uid: params[:user_uid]) |
||||
end |
||||
|
||||
def find_setting |
||||
@settings = Setting.find_or_create_by!(provider: user_settings_provider) |
||||
end |
||||
|
||||
def verify_admin_of_user |
||||
redirect_to admins_path, |
||||
flash: { alert: I18n.t("administrator.flash.unauthorized") } unless current_user.admin_of?(@user) |
||||
end |
||||
end |
@ -0,0 +1,44 @@ |
||||
# frozen_string_literal: true |
||||
|
||||
# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/. |
||||
# |
||||
# Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below). |
||||
# |
||||
# This program is free software; you can redistribute it and/or modify it under the |
||||
# terms of the GNU Lesser General Public License as published by the Free Software |
||||
# Foundation; either version 3.0 of the License, or (at your option) any later |
||||
# version. |
||||
# |
||||
# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY |
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
||||
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU Lesser General Public License along |
||||
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. |
||||
|
||||
class ThemesController < ApplicationController |
||||
before_action :provider_settings |
||||
|
||||
# GET /primary |
||||
def index |
||||
color = @settings.get_value("Primary Color") || Rails.configuration.primary_color_default |
||||
file_name = Rails.root.join('app', 'assets', 'stylesheets', 'utilities', '_primary_themes.scss') |
||||
@file_contents = File.read(file_name) |
||||
|
||||
# Include the variables and covert scss file to css |
||||
@compiled = Sass::Engine.new("$primary-color:#{color};" \ |
||||
"$primary-color-lighten:lighten(#{color}, 40%);" \ |
||||
"$primary-color-darken:darken(#{color}, 10%);" + |
||||
@file_contents, syntax: :scss).render |
||||
|
||||
respond_to do |format| |
||||
format.css { render body: @compiled } |
||||
end |
||||
end |
||||
|
||||
private |
||||
|
||||
def provider_settings |
||||
@settings = Setting.find_or_create_by(provider: user_settings_provider) |
||||
end |
||||
end |
@ -0,0 +1,21 @@ |
||||
# frozen_string_literal: true |
||||
|
||||
# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/. |
||||
# |
||||
# Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below). |
||||
# |
||||
# This program is free software; you can redistribute it and/or modify it under the |
||||
# terms of the GNU Lesser General Public License as published by the Free Software |
||||
# Foundation; either version 3.0 of the License, or (at your option) any later |
||||
# version. |
||||
# |
||||
# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY |
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
||||
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU Lesser General Public License along |
||||
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. |
||||
|
||||
module AdminsHelper |
||||
include Pagy::Frontend |
||||
end |
@ -0,0 +1,42 @@ |
||||
# frozen_string_literal: true |
||||
|
||||
# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/. |
||||
# |
||||
# Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below). |
||||
# |
||||
# This program is free software; you can redistribute it and/or modify it under the |
||||
# terms of the GNU Lesser General Public License as published by the Free Software |
||||
# Foundation; either version 3.0 of the License, or (at your option) any later |
||||
# version. |
||||
# |
||||
# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY |
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
||||
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU Lesser General Public License along |
||||
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. |
||||
|
||||
module ThemingHelper |
||||
# Returns the logo based on user's provider |
||||
def logo_image |
||||
Setting.find_or_create_by(provider: user_settings_provider) |
||||
.get_value("Branding Image") || Rails.configuration.branding_image_default |
||||
end |
||||
|
||||
# Returns the primary color based on user's provider |
||||
def user_color |
||||
Setting.find_or_create_by(provider: user_settings_provider) |
||||
.get_value("Primary Color") || Rails.configuration.primary_color_default |
||||
end |
||||
|
||||
# Returns the user's provider in the settings context |
||||
def user_settings_provider |
||||
if Rails.configuration.loadbalanced_configuration && !current_user&.has_role?(:super_admin) |
||||
current_user.provider |
||||
elsif Rails.configuration.loadbalanced_configuration |
||||
@user_domain |
||||
else |
||||
"greenlight" |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,33 @@ |
||||
# frozen_string_literal: true |
||||
|
||||
# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/. |
||||
# |
||||
# Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below). |
||||
# |
||||
# This program is free software; you can redistribute it and/or modify it under the |
||||
# terms of the GNU Lesser General Public License as published by the Free Software |
||||
# Foundation; either version 3.0 of the License, or (at your option) any later |
||||
# version. |
||||
# |
||||
# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY |
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
||||
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU Lesser General Public License along |
||||
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. |
||||
|
||||
class Ability |
||||
include CanCan::Ability |
||||
|
||||
def initialize(user) |
||||
if !user |
||||
cannot :manage, AdminsController |
||||
elsif user.has_role? :super_admin |
||||
can :manage, :all |
||||
elsif user.has_role? :admin |
||||
can :manage, :all |
||||
elsif user.has_role? :user |
||||
cannot :manage, AdminsController |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,21 @@ |
||||
# frozen_string_literal: true |
||||
|
||||
# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/. |
||||
# |
||||
# Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below). |
||||
# |
||||
# This program is free software; you can redistribute it and/or modify it under the |
||||
# terms of the GNU Lesser General Public License as published by the Free Software |
||||
# Foundation; either version 3.0 of the License, or (at your option) any later |
||||
# version. |
||||
# |
||||
# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY |
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
||||
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU Lesser General Public License along |
||||
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. |
||||
|
||||
class Feature < ApplicationRecord |
||||
belongs_to :setting |
||||
end |
@ -0,0 +1,31 @@ |
||||
# frozen_string_literal: true |
||||
|
||||
# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/. |
||||
# |
||||
# Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below). |
||||
# |
||||
# This program is free software; you can redistribute it and/or modify it under the |
||||
# terms of the GNU Lesser General Public License as published by the Free Software |
||||
# Foundation; either version 3.0 of the License, or (at your option) any later |
||||
# version. |
||||
# |
||||
# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY |
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
||||
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU Lesser General Public License along |
||||
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. |
||||
|
||||
class Role < ApplicationRecord |
||||
has_and_belongs_to_many :users, join_table: :users_roles |
||||
|
||||
belongs_to :resource, |
||||
polymorphic: true, |
||||
optional: true |
||||
|
||||
validates :resource_type, |
||||
inclusion: { in: Rolify.resource_types }, |
||||
allow_nil: true |
||||
|
||||
scopify |
||||
end |
@ -0,0 +1,43 @@ |
||||
# frozen_string_literal: true |
||||
|
||||
# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/. |
||||
# |
||||
# Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below). |
||||
# |
||||
# This program is free software; you can redistribute it and/or modify it under the |
||||
# terms of the GNU Lesser General Public License as published by the Free Software |
||||
# Foundation; either version 3.0 of the License, or (at your option) any later |
||||
# version. |
||||
# |
||||
# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY |
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
||||
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU Lesser General Public License along |
||||
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. |
||||
|
||||
class Setting < ApplicationRecord |
||||
has_many :features |
||||
|
||||
# Updates the value of the feature and enables it |
||||
def update_value(name, value) |
||||
feature = features.find_or_create_by!(name: name) |
||||
|
||||
feature.update_attributes(value: value, enabled: true) |
||||
end |
||||
|
||||
# Returns the value if enabled or the default if not enabled |
||||
def get_value(name) |
||||
feature = features.find_or_create_by!(name: name) |
||||
if feature[:enabled] |
||||
feature[:value] |
||||
else |
||||
case name |
||||
when "Branding Image" |
||||
Rails.configuration.branding_image_default |
||||
when "Primary Color" |
||||
Rails.configuration.primary_color_default |
||||
end |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,42 @@ |
||||
<% |
||||
# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/. |
||||
# Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below). |
||||
# This program is free software; you can redistribute it and/or modify it under the |
||||
# terms of the GNU Lesser General Public License as published by the Free Software |
||||
# Foundation; either version 3.0 of the License, or (at your option) any later |
||||
# version. |
||||
# |
||||
# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY |
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
||||
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
||||
# You should have received a copy of the GNU Lesser General Public License along |
||||
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. |
||||
%> |
||||
<div class="container pt-6"> |
||||
<%= render "shared/components/subtitle", subtitle: t("administrator.title"), search: false %> |
||||
|
||||
<div class="row"> |
||||
<div class="col-lg-3 mb-4"> |
||||
<div class="list-group list-group-transparent mb-0"> |
||||
<button id="users" class="list-group-item list-group-item-action setting-btn <%= "active" if !params[:setting] || params[:setting] == "users"%>"> |
||||
<span class="icon mr-3"><i class="fas fa-users"></i></span><%= t("administrator.users.title") %> |
||||
</button> |
||||
<button id="site_settings" class="list-group-item list-group-item-action setting-btn <%= "active" if params[:setting] == "site_settings"%>"> |
||||
<span class="icon mr-4"><i class="fas fa-cogs"></i></span><%= t("administrator.site_settings.title") %> |
||||
</button> |
||||
</div> |
||||
</div> |
||||
|
||||
|
||||
<div class="col-lg-9"> |
||||
<% if defined?(setting_id) && setting_id == "account" %> |
||||
<%= render "shared/settings/setting_view", setting_id: "account", setting_title: t("administrator.users.edit.title") %> |
||||
<% else %> |
||||
<%= render "shared/settings/setting_view", admin_view: true, setting_id: "users", setting_title: t("administrator.users.title") %> |
||||
<%= render "shared/settings/setting_view", admin_view: true, setting_id: "site_settings", setting_title: t("administrator.site_settings.subtitle") %> |
||||
<% end %> |
||||
|
||||
<%= render "shared/modals/delete_account_modal", delete_location: "/" %> |
||||
</div> |
||||
</div> |
||||
</div> |
@ -0,0 +1,20 @@ |
||||
<% |
||||
# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/. |
||||
# Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below). |
||||
# This program is free software; you can redistribute it and/or modify it under the |
||||
# terms of the GNU Lesser General Public License as published by the Free Software |
||||
# Foundation; either version 3.0 of the License, or (at your option) any later |
||||
# version. |
||||
# |
||||
# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY |
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
||||
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
||||
# You should have received a copy of the GNU Lesser General Public License along |
||||
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. |
||||
%> |
||||
|
||||
<div class="container text-center pt-9"> |
||||
<div class="display-1 text-muted mb-5">401</div> |
||||
<h1 class="h2 mb-3"><%= t("errors.unauthorized.message") %></h1> |
||||
<p class="h4 text-muted font-weight-normal mb-7"><%= t("errors.unauthorized.help") %></p> |
||||
</div> |