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)
This commit is contained in:
Jesus Federico
2019-05-03 13:05:12 -04:00
committed by GitHub
parent b9efff586a
commit 9f74b0e2c0
85 changed files with 2286 additions and 203 deletions

View File

@ -88,12 +88,6 @@ module Greenlight
# Configure custom banner message.
config.banner_message = ENV['BANNER_MESSAGE']
# Configure custom branding image.
config.branding_image = ENV['BRANDING_IMAGE'] || "https://raw.githubusercontent.com/bigbluebutton/greenlight/master/app/assets/images/logo_with_text.png"
# Show/Hide cutomization tab in user settings
config.allow_custom_branding = (ENV['ALLOW_CUSTOM_BRANDING'] == "true")
# Enable/disable recording thumbnails.
config.recording_thumbnails = (ENV['RECORDING_THUMBNAILS'] != "false")
@ -102,5 +96,17 @@ module Greenlight
# The maximum number of rooms included in one bbbapi call
config.pagination_number = ENV['PAGINATION_NUMBER'].to_i.zero? ? 25 : ENV['PAGINATION_NUMBER'].to_i
# Default branding image if the user does not specify one
config.branding_image_default = "https://raw.githubusercontent.com/bigbluebutton/greenlight/master/app/assets/images/logo_with_text.png"
# Default primary color if the user does not specify one
config.primary_color_default = "#467fcf"
# Default admin password
config.admin_password_default = ENV['ADMIN_PASSWORD'] || 'administrator'
# Number of rows to display per page
config.pagination_rows = ENV['NUMBER_OF_ROWS'].to_i.zero? ? 10 : ENV['NUMBER_OF_ROWS'].to_i
end
end

146
config/initializers/pagy.rb Normal file
View File

@ -0,0 +1,146 @@
# frozen_string_literal: true
# frozen_string_literal: true
# Pagy initializer file (2.1.5)
# Customize only what you really need and notice that Pagy works also without any of the following lines.
# Should you just cherry pick part of this file, please maintain the require-order of the extras
# Extras
# See https://ddnexus.github.io/pagy/extras
# Backend Extras
# Array extra: Paginate arrays efficiently, avoiding expensive array-wrapping and without overriding
# See https://ddnexus.github.io/pagy/extras/array
# require 'pagy/extras/array'
# Countless extra: Paginate without any count, saving one query per rendering
# See https://ddnexus.github.io/pagy/extras/countless
# require 'pagy/extras/countless'
# Pagy::VARS[:cycle] = false # default
# Elasticsearch Rails extra: Paginate `ElasticsearchRails::Results` objects
# See https://ddnexus.github.io/pagy/extras/elasticsearch_rails
# require 'pagy/extras/elasticsearch_rails'
# Searchkick extra: Paginate `Searchkick::Results` objects
# See https://ddnexus.github.io/pagy/extras/searchkick
# require 'pagy/extras/searchkick'
# Frontend Extras
# Bootstrap extra: Add nav, responsive and compact helpers and templates for Bootstrap pagination
# See https://ddnexus.github.io/pagy/extras/bootstrap
require 'pagy/extras/bootstrap'
# Bulma extra: Add nav, responsive and compact helpers and templates for Bulma pagination
# See https://ddnexus.github.io/pagy/extras/bulma
# require 'pagy/extras/bulma'
# Foundation extra: Add nav, responsive and compact helpers and templates for Foundation pagination
# See https://ddnexus.github.io/pagy/extras/foundation
# require 'pagy/extras/foundation'
# Materialize extra: Nav, responsive and compact helpers for Materialize pagination
# See https://ddnexus.github.io/pagy/extras/materialize
# require 'pagy/extras/materialize'
# Plain extra: Add responsive and compact nav plain helpers
# Notice: the other frontend extras add their own framework-styled versions,
# so require this extra only if you need the plain unstyled version
# See https://ddnexus.github.io/pagy/extras/plain
# require 'pagy/extras/plain'
# Semantic extra: Nav, responsive and compact helpers for Semantic UI pagination
# See https://ddnexus.github.io/pagy/extras/semantic
# require 'pagy/extras/semantic'
# Breakpoints var used by the responsive nav helpers
# See https://ddnexus.github.io/pagy/extras/plain#breakpoints
# Pagy::VARS[:breakpoints] = { 0 => [2,3,3,2], 540 => [3,5,5,3], 720 => [5,7,7,5] }
# Feature Extras
# Headers extra: http response headers (and other helpers) useful for API pagination
# See http://ddnexus.github.io/pagy/extras/headers
# require 'pagy/extras/headers'
# Pagy::VARS[:headers] = { page: 'Current-Page', items: 'Page-Items',
# count: 'Total-Count', pages: 'Total-Pages' } # default
# Support extra: Extra support for features like: incremental, infinite, auto-scroll pagination
# See https://ddnexus.github.io/pagy/extras/support
# require 'pagy/extras/support'
# Items extra: Allow the client to request a custom number of items per page with an optional selector UI
# See https://ddnexus.github.io/pagy/extras/items
# require 'pagy/extras/items'
# Pagy::VARS[:items_param] = :items # default
# Pagy::VARS[:max_items] = 100 # default
# Overflow extra: Allow for easy handling of overflowing pages
# See https://ddnexus.github.io/pagy/extras/overflow
# require 'pagy/extras/overflow'
# Pagy::VARS[:overflow] = :empty_page # default (other options: :last_page and :exception)
# Trim extra: Remove the page=1 param from links
# See https://ddnexus.github.io/pagy/extras/trim
# require 'pagy/extras/trim'
# Pagy Variables
# See https://ddnexus.github.io/pagy/api/pagy#variables
# All the Pagy::VARS are set for all the Pagy instances but can be overridden
# per instance by just passing them to Pagy.new or the #pagy controller method
# Instance variables
# See https://ddnexus.github.io/pagy/api/pagy#instance-variables
Pagy::VARS[:items] = Rails.configuration.pagination_rows # default
# Other Variables
# See https://ddnexus.github.io/pagy/api/pagy#other-variables
# Pagy::VARS[:size] = [1,4,4,1] # default
# Pagy::VARS[:page_param] = :page # default
# Pagy::VARS[:params] = {} # default
# Pagy::VARS[:anchor] = '#anchor' # example
# Pagy::VARS[:link_extra] = 'data-remote="true"' # example
# Pagy::VARS[:item_path] = 'activerecord.models.product' # example
# Rails
# Rails: extras assets path required by the compact and responsive navs, and the items extra
# See https://ddnexus.github.io/pagy/extras#javascript
# Rails.application.config.assets.paths << Pagy.root.join('javascripts')
# I18n
# Pagy internal I18n: ~18x faster using ~10x less memory than the i18n gem
# See https://ddnexus.github.io/pagy/api/frontend#i18n
# Notice: No need to configure anything in this section if your app uses only "en"
# or if you use the i18n extra below
#
# Examples:
# load the "de" built-in locale:
# Pagy::I18n.load(locale: 'de')
#
# load the "de" locale defined in the custom file at :filepath:
# Pagy::I18n.load(locale: 'de', filepath: 'path/to/pagy-de.yml')
#
# load the "de", "en" and "es" built-in locales:
# (the first passed :locale will be used also as the default_locale)
# Pagy::I18n.load({locale: 'de'},
# {locale: 'en'},
# {locale: 'es'})
#
# load the "en" built-in locale, a custom "es" locale,
# and a totally custom locale complete with a custom :pluralize proc:
# (the first passed :locale will be used also as the default_locale)
# Pagy::I18n.load({locale: 'en'},
# {locale: 'es', filepath: 'path/to/pagy-es.yml'},
# {locale: 'xyz', # not built-in
# filepath: 'path/to/pagy-xyz.yml',
# pluralize: lambda{|count| ... } )
# I18n extra: uses the standard i18n gem which is ~18x slower using ~10x more memory
# than the default pagy internal i18n (see above)
# See https://ddnexus.github.io/pagy/extras/i18n
# require 'pagy/extras/i18n'

View File

@ -0,0 +1,12 @@
# frozen_string_literal: true
Rolify.configure do |config|
# By default ORM adapter is ActiveRecord. uncomment to use mongoid
# config.use_mongoid
# Dynamic shortcuts for User class (user.is_admin? like methods). Default is: false
# config.use_dynamic_shortcuts
# Configuration to remove roles from database once the last resource is removed. Default is: true
# config.remove_role_if_empty = false
end

View File

@ -21,6 +21,47 @@ en:
attributes:
user:
accepted_terms: "Terms and Conditions"
administrator:
site_settings:
branding:
change: Change Image
info: Change the branding image that appears in the top left corner
placeholder: Image Url...
title: Branding Image
color:
info: Change the primary color used across the website
title: Primary Color
subtitle: Customize Greenlight
title: Site Settings
flash:
banned: User has been successfully banned.
unbanned: User has been successfully unbanned.
delete: User deleted successfully
delete_fail: Failed to delete user
demoted: User has been successfully demoted
promoted: User has been successfully promoted
unauthorized: You are not authorized to perform actions on this user
title: Organization Settings
users:
edit:
title: Edit User Details
settings:
ban: Ban User
delete: Delete
demote: Demote to User
edit: Edit
promote: Promote to Admin
unban: Unban User
table:
authenticator: Authenticator
created: Created
name: Name
not_found: No users match your search
no_users: No users found
role: Role
uid: User ID
username: Username
title: Manage Users
bigbluebutton: BigBlueButton
bigbluebutton_exception: Oops, there was an error when starting the meeting!
cancel: Cancel
@ -28,11 +69,12 @@ en:
cookie_info: Cookies help us deliver our services. By using our services, you agree to our use of cookies.
cookie_button: I Agree
copy: Copy
default_admin: You are still using the default password for this account. Please click <a href="%{edit_link}">here</a> to change it
delete: Delete
delivery_error: An error occured during email delivery. Please contact an administrator!
docs: Documentation
email: Email
email_sent: Email Sent! (Please check your Spam folder if you haven't received it)
email_sent: Your %{email_type} email has been sent! (Please check your Spam folder if you haven't received it)
enter_your_name: Enter your name!
errors:
internal:
@ -46,10 +88,15 @@ en:
This may be because you haven't updated to Greenlight 2.0.
upgrade: Show me how to upgrade to 2.0!
version: We've released a new version of Greenlight, but your database isn't compatible.
messages:
blank: can't be blank
not_found:
message: Whoops! Looks like we can't find that.
help: Is it possible its been removed?
title: Errors
unauthorized:
message: You do not have access to this application
help: If you believe this is a mistake, please contact your system administrator.
unprocessable:
message: Oops! Request is unprocessable.
help: Unfortunately this isn't a valid request.
@ -69,11 +116,12 @@ en:
go_back: Go back
greenlight: Greenlight
header:
create_room: Create Room
all_recordings: All Recordings
dropdown:
account_settings: Organization
help: Need help?
home: Home Room
settings: Settings
home: Home
settings: Profile
signout: Sign out
home_room: Home Room
info_update_success: Information successfully updated.
@ -98,6 +146,7 @@ en:
language_default: Default (browser language)
ldap_error: Unable to connect to the LDAP server. Please check your LDAP configuration in the env file and ensure your server is running.
login: Sign in
login_title: Sign in to your account
mailer:
user:
password_reset:
@ -108,8 +157,9 @@ en:
expire: This link will expire in two hours.
ignore: You can safely ignore this email if you did not request a password reset.
verify_email:
welcome: Welcome to %{bigbluebutton}, %{name}!
success: You have successfully registered your %{bigbluebutton} account. Your username is %{email}.
welcome: Welcome to your personal space, %{name}!
success: Leveraging %{bigbluebutton}, you can create your own rooms to host sessions and collaborate with others.
username: Your username is %{email}.
verify: To verify your account, just click the button below.
verify_text: 'To verify your account, just follow this link: %{url}'
verify_link: Verify Account
@ -118,13 +168,14 @@ en:
modal:
create_room:
auto_join: Automatically join me into the room.
create: Create Room
free_delete: You will be free to delete this room at any time.
name_placeholder: Enter a room name...
not_blank: Room name cannot be blank.
title: Create New Room
delete_account:
confirm: Are you sure you want to delete your account?
delete: I'm sure, delete my account.
confirm: Are you sure you want to delete this account?
delete: I'm sure, delete this account.
keep: Actually, I'll keep it.
warning: This decision is final. You will <b>not</b> be able to recover associated data.
delete_room:
@ -160,6 +211,7 @@ en:
microsoft_office365: Office 365
twitter: Twitter
recording:
all_recordings: All Recordings
email: Email Recording
no_recordings: This room has no %{inject}recordings.
no_user_recordings: You currently have no recordings.
@ -183,7 +235,13 @@ en:
password: New Password
confirm: New Password Confirmation
update: Update Password
roles:
administrator: Administrator
banned: Banned
super_admin: Super Admin
user: User
room:
create_room: Create a Room
create_room_error: There was an error creating the room
create_room_success: Room created successfully
invited: You have been invited to join
@ -192,7 +250,7 @@ en:
last_session: Last session on %{session}
owner: Owner
no_sessions: This room has no sessions, yet!
recordings: Recordings
recordings: Room Recordings
sessions: Sessions
settings: Room Settings
start: Start
@ -204,7 +262,7 @@ en:
auto: You will automatically join when the meeting starts.
settings:
account:
fullname: Fullname
fullname: Full name
language: Language
provider: Provider
image: Image
@ -216,17 +274,14 @@ en:
disclaimer: If you choose to delete your account, it will <b>NOT</b> be recoverable. All information regarding your account, including settings, rooms, and recording will be removed.
subtitle: Permanently Delete your Account
title: Delete Account
design:
not_supported: Customization not currently supported.
subtitle: Customize Greenlight
title: Design
password:
confirmation: New Password Confirmation
new: New Password
old: Old Password
subtitle: Change your Password
title: Password
title: Settings
title: Profile
search: Search
signup:
password_confirm: Password Confirmation
subtitle: Create an Account
@ -249,3 +304,4 @@ en:
resend: Resend verification email
signin: Please sign in to access your account.
title: Verify your email
verification: Verification

View File

@ -20,17 +20,37 @@ Rails.application.routes.draw do
get 'health_check', to: 'health_check/health_check#index'
# Error routes.
match '/404', to: 'errors#not_found', via: :all
match '/401', to: 'errors#unauthorized', via: :all, as: :unauthorized
match '/404', to: 'errors#not_found', via: :all, as: :not_found
match '/422', to: 'errors#unprocessable', via: :all
match '/500', to: 'errors#internal_error', via: :all
match '/500', to: 'errors#internal_error', via: :all, as: :internal_error
# Signup routes.
# Signin/Signup routes.
get '/signin', to: 'users#signin', as: :signin
get '/signup', to: 'users#new', as: :signup
post '/signup', to: 'users#create', as: :create_user
# Redirect to terms page
match '/terms', to: 'users#terms', via: [:get, :post]
# Admin resouces
resources :admins, only: [:index]
scope '/admins' do
post '/branding', to: 'admins#branding', as: :admin_branding
post '/coloring', to: 'admins#coloring', as: :admin_coloring
post '/signup', to: 'admins#signup', as: :admin_signup
get '/edit/:user_uid', to: 'admins#edit_user', as: :admin_edit_user
post '/promote/:user_uid', to: 'admins#promote', as: :admin_promote
post '/demote/:user_uid', to: 'admins#demote', as: :admin_demote
post '/ban/:user_uid', to: 'admins#ban_user', as: :admin_ban
post '/unban/:user_uid', to: 'admins#unban_user', as: :admin_unban
end
scope '/themes' do
get '/primary', to: 'themes#index', as: :themes_primary
end
# Password reset resources.
resources :password_resets, only: [:new, :create, :edit, :update]