+
+<%= render "shared/modals/invite_user_modal" %>
diff --git a/app/views/shared/components/_admins_role.html.erb b/app/views/shared/components/_admins_role.html.erb
new file mode 100644
index 00000000..baa42abb
--- /dev/null
+++ b/app/views/shared/components/_admins_role.html.erb
@@ -0,0 +1,36 @@
+<%
+# 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 .
+%>
+
+<% if roles.include?("denied")%>
+
+<% elsif roles.include?("pending") %>
+
+<% elsif roles.include?("super_admin") %>
+
+<% elsif roles.include?("admin") %>
+
+<% else %>
+
+<% end %>
\ No newline at end of file
diff --git a/app/views/shared/components/_admins_tags.html.erb b/app/views/shared/components/_admins_tags.html.erb
new file mode 100644
index 00000000..a1e6142d
--- /dev/null
+++ b/app/views/shared/components/_admins_tags.html.erb
@@ -0,0 +1,57 @@
+<%
+# 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 .
+%>
+
+
\ No newline at end of file
diff --git a/app/views/shared/components/_subtitle.html.erb b/app/views/shared/components/_subtitle.html.erb
index 29870f89..f051494a 100644
--- a/app/views/shared/components/_subtitle.html.erb
+++ b/app/views/shared/components/_subtitle.html.erb
@@ -14,12 +14,20 @@
%>
..." value="<%= @search %>">
<% unless @search.blank? %>
@@ -28,7 +36,7 @@
<% end %>
-
diff --git a/app/views/shared/modals/_invite_user_modal.html.erb b/app/views/shared/modals/_invite_user_modal.html.erb
new file mode 100644
index 00000000..b7680877
--- /dev/null
+++ b/app/views/shared/modals/_invite_user_modal.html.erb
@@ -0,0 +1,44 @@
+<%
+# 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 .
+%>
+
+
+
+
+
+
+
+
<%= t("modal.invite_user.title") %>
+
+
+ <%= form_for(:invite_user, url: invite_user_path) do |f| %>
+
diff --git a/app/views/user_mailer/approval_user_signup.html.erb b/app/views/user_mailer/approval_user_signup.html.erb
new file mode 100644
index 00000000..fafae3b3
--- /dev/null
+++ b/app/views/user_mailer/approval_user_signup.html.erb
@@ -0,0 +1,43 @@
+<%
+# 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 .
+%>
+
+
diff --git a/app/views/user_mailer/approval_user_signup.text.erb b/app/views/user_mailer/approval_user_signup.text.erb
new file mode 100644
index 00000000..418f08d6
--- /dev/null
+++ b/app/views/user_mailer/approval_user_signup.text.erb
@@ -0,0 +1,27 @@
+<%
+# 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 .
+%>
+
+<%= t('mailer.user.approve.signup.subject') %>
+
+<%= t('mailer.user.approve.signup.info') %>
+
+<%= t('mailer.user.approve.signup.username', name: @user.name, email: @user.email) %>
+
+<%= t('mailer.user.approve.signup.more-info') %>
+
+<%= @url %>
\ No newline at end of file
diff --git a/app/views/user_mailer/approve_user.html.erb b/app/views/user_mailer/approve_user.html.erb
new file mode 100644
index 00000000..a66f918c
--- /dev/null
+++ b/app/views/user_mailer/approve_user.html.erb
@@ -0,0 +1,43 @@
+<%
+# 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 .
+%>
+
+
diff --git a/app/views/user_mailer/approve_user.text.erb b/app/views/user_mailer/approve_user.text.erb
new file mode 100644
index 00000000..3d039952
--- /dev/null
+++ b/app/views/user_mailer/approve_user.text.erb
@@ -0,0 +1,27 @@
+<%
+# 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 .
+%>
+
+<%= t('mailer.user.approve.subject') %>
+
+<%= t('mailer.user.approve.info') %>
+
+<%= t('mailer.user.approve.username', email: @user.email) %>
+
+<%= t('mailer.user.approve.signin') %>
+
+<%= @url %>
\ No newline at end of file
diff --git a/app/views/user_mailer/invite_email.html.erb b/app/views/user_mailer/invite_email.html.erb
new file mode 100644
index 00000000..d9921528
--- /dev/null
+++ b/app/views/user_mailer/invite_email.html.erb
@@ -0,0 +1,43 @@
+<%
+# 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 .
+%>
+
+
diff --git a/app/views/user_mailer/invite_email.text.erb b/app/views/user_mailer/invite_email.text.erb
new file mode 100644
index 00000000..991ec71d
--- /dev/null
+++ b/app/views/user_mailer/invite_email.text.erb
@@ -0,0 +1,27 @@
+<%
+# 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 .
+%>
+
+<%= t('mailer.user.invite.subject') %>
+
+<%= t('mailer.user.invite.info', name: @name) %>
+
+<%= t('mailer.user.invite.username', email: @email) %>
+
+<%= t('mailer.user.invite.signup') %>
+
+<%= @url %>
diff --git a/app/views/user_mailer/invite_user_signup.html.erb b/app/views/user_mailer/invite_user_signup.html.erb
new file mode 100644
index 00000000..2a950e78
--- /dev/null
+++ b/app/views/user_mailer/invite_user_signup.html.erb
@@ -0,0 +1,39 @@
+<%
+# 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 .
+%>
+
+
diff --git a/app/views/user_mailer/invite_user_signup.text.erb b/app/views/user_mailer/invite_user_signup.text.erb
new file mode 100644
index 00000000..2f61d9af
--- /dev/null
+++ b/app/views/user_mailer/invite_user_signup.text.erb
@@ -0,0 +1,25 @@
+<%
+# 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 .
+%>
+
+<%= t('mailer.user.invite.signup.subject') %>
+
+<%= t('mailer.user.invite.signup.info') %>
+
+<%= t('mailer.user.invite.signup.username', name: @user.name, email: @user.email) %>
+
+<%= @url %>
\ No newline at end of file
diff --git a/app/views/user_mailer/user_demoted.html.erb b/app/views/user_mailer/user_demoted.html.erb
new file mode 100644
index 00000000..21c18b93
--- /dev/null
+++ b/app/views/user_mailer/user_demoted.html.erb
@@ -0,0 +1,39 @@
+<%
+# 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 .
+%>
+
+
diff --git a/app/views/user_mailer/user_demoted.text.erb b/app/views/user_mailer/user_demoted.text.erb
new file mode 100644
index 00000000..275ddb7d
--- /dev/null
+++ b/app/views/user_mailer/user_demoted.text.erb
@@ -0,0 +1,26 @@
+<%
+# 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 .
+%>
+
+
+<%= t('mailer.user.demoted.subtitle') %>
+
+<%= t('mailer.user.demoted.info', url: @url) %>
+
+<%= t('mailer.user.demoted.more-info') %>
+
+<%= @root_url %>
diff --git a/app/views/user_mailer/user_promoted.html.erb b/app/views/user_mailer/user_promoted.html.erb
new file mode 100644
index 00000000..9121af0a
--- /dev/null
+++ b/app/views/user_mailer/user_promoted.html.erb
@@ -0,0 +1,39 @@
+<%
+# 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 .
+%>
+
+
diff --git a/app/views/user_mailer/user_promoted.text.erb b/app/views/user_mailer/user_promoted.text.erb
new file mode 100644
index 00000000..f6af8fde
--- /dev/null
+++ b/app/views/user_mailer/user_promoted.text.erb
@@ -0,0 +1,26 @@
+<%
+# 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 .
+%>
+
+
+<%= t('mailer.user.promoted.subtitle') %>
+
+<%= t('mailer.user.promoted.info', url: @url) %>
+
+<%= t('mailer.user.promoted.more-info') %>
+
+<%= @admin_url %>
diff --git a/config/application.rb b/config/application.rb
index 2a5dc010..b3feffb1 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -52,8 +52,17 @@ module Greenlight
config.bigbluebutton_secret_default = "8cd8ef52e8e101574e400365b55e11a6"
# Use standalone BigBlueButton server.
- config.bigbluebutton_endpoint = ENV["BIGBLUEBUTTON_ENDPOINT"] || config.bigbluebutton_endpoint_default
- config.bigbluebutton_secret = ENV["BIGBLUEBUTTON_SECRET"] || config.bigbluebutton_secret_default
+ config.bigbluebutton_endpoint = if ENV["BIGBLUEBUTTON_ENDPOINT"].present?
+ ENV["BIGBLUEBUTTON_ENDPOINT"]
+ else
+ config.bigbluebutton_endpoint_default
+ end
+
+ config.bigbluebutton_secret = if ENV["BIGBLUEBUTTON_SECRET"].present?
+ ENV["BIGBLUEBUTTON_SECRET"]
+ else
+ config.bigbluebutton_secret_default
+ end
# Fix endpoint format if required.
config.bigbluebutton_endpoint += "/" unless config.bigbluebutton_endpoint.ends_with?('/')
@@ -96,22 +105,36 @@ 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
+ config.pagination_rows = ENV['NUMBER_OF_ROWS'].to_i.zero? ? 25 : ENV['NUMBER_OF_ROWS'].to_i
# Whether the user has defined the variables required for recaptcha
config.recaptcha_enabled = ENV['RECAPTCHA_SITE_KEY'].present? && ENV['RECAPTCHA_SECRET_KEY'].present?
# Show/hide "Add to Google Calendar" button in the room page
config.enable_google_calendar_button = (ENV['ENABLE_GOOGLE_CALENDAR_BUTTON'] == "true")
+
+ # Enum containing the different possible registration methods
+ config.registration_methods = { open: "0", invite: "1", approval: "2" }
+
+ # DEFAULTS
+
+ # 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 primary color lighten if the user does not specify one
+ config.primary_color_lighten_default = "#e8eff9"
+
+ # Default primary color darken if the user does not specify one
+ config.primary_color_darken_default = "#316cbe"
+
+ # Default registration method if the user does not specify one
+ config.registration_method_default = config.registration_methods[:open]
+
+ # Default admin password
+ config.admin_password_default = ENV['ADMIN_PASSWORD'] || 'administrator'
end
end
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 885afdc0..a76fcf80 100755
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -23,26 +23,48 @@ en:
accepted_terms: "Terms and Conditions"
administrator:
site_settings:
+ authentication:
+ disabled: Disabled
+ enabled: Enabled
+ info: Only allow authenticated users to join a room
+ title: Require Authentication for Rooms
+ user-info: You must sign in to Greenlight to join this room
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
+ info: Changing the Regular Color will change both Lighten and Darken. Lighten and Darken can then be changed individually
title: Primary Color
+ regular: Regular
+ lighten: Lighten
+ Darken: Darken
+ registration:
+ info: Change the way that users register to the website
+ title: Registration Method
+ methods:
+ approval: Approve/Decline
+ invite: Join by Invitation
+ open: Open Registration
subtitle: Customize Greenlight
title: Site Settings
flash:
+ approved: User has been successfully approved.
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
+ invite: Invite successfully sent to %{email}
+ invite_email_verification: ALLOW_MAIL_NOTIFICATIONS must be set to true in order to use this method
promoted: User has been successfully promoted
+ registration_method_updated: Registration method successfully updated
+ settings: Site Settings successfully changed
unauthorized: You are not authorized to perform actions on this user
title: Organization Settings
users:
+ invite: Invite User
edit:
title: Edit User Details
settings:
@@ -79,6 +101,10 @@ en:
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:
+ bigbluebutton:
+ help: Please make sure the proper steps have been taken. Learn more
+ message: Invalid BigBlueButton Endpoint and Secret
+ title: Server Error
internal:
message: Oh no! Looks like something went wrong on our end.
help: The error has been logged, we'll take a look!
@@ -157,6 +183,34 @@ en:
login_title: Sign in to your account
mailer:
user:
+ approve:
+ info: Your account has been approved.
+ signin: To access your personal rooms, click the button below and sign in.
+ signin_link: Sign In
+ signup:
+ info: A new user has signed up to use Greenlight.
+ more-info: To allow this user to access Greenlight you must approve their account in organization settings.
+ admins_link: Visit the Organization Page
+ subject: New Greenlight User Sign Up
+ username: The user signed up with the name %{name} and the email %{email}.
+ subject: Account Approved
+ username: Your username is %{email}.
+ demoted:
+ info: You are no longer an administrator on %{url}.
+ more-info: You now have the same privileges as a regular user and will no longer be able to access any of the Administrator settings.
+ root_link: Visit the Organization Page
+ subtitle: Administrator Rights Rescinded
+ invite:
+ info: You have been invited to your own personal space by %{name}
+ signup: To signup using your email, click the button below and follow the steps.
+ signup_link: Sign Up
+ signup:
+ info: A user that was invited has signed up to use Greenlight.
+ admins_link: Visit the Organization Page
+ subject: New Greenlight User Sign Up
+ username: The user signed up with the name %{name} and the email %{email}.
+ subject: Invitation to join BigBlueButton
+ username: Your username is %{email}.
password_reset:
title: 'Password reset'
welcome: It seems like you forgot your password for %{bigbluebutton}
@@ -164,6 +218,11 @@ en:
reset_link: Reset Password
expire: This link will expire in two hours.
ignore: You can safely ignore this email if you did not request a password reset.
+ promoted:
+ admins_link: Visit the Organization Page
+ info: You are now an administrator on %{url}.
+ more-info: As an administrator, you can manage users, their role and configure your site settings by changing the logo and brand colour.
+ subtitle: Administrator Rights Granted
verify_email:
welcome: Welcome to your personal space, %{name}!
success: Leveraging %{bigbluebutton}, you can create your own rooms to host sessions and collaborate with others.
@@ -191,6 +250,11 @@ en:
delete: I'm sure, delete this room.
keep: On second thought, I'll keep it.
warning: You will not be able to recover this room or any of its %{recordings_num} associated recordings.
+ invite_user:
+ email_placeholder: Enter the user's email
+ footer: The user will receive an email with instructions on how to sign up
+ send: Send Invite
+ title: Invite User
login:
or: or
with: Sign in with %{provider}
@@ -246,6 +310,15 @@ en:
unlisted: Unlisted
format:
presentation: Presentation
+ registration:
+ approval:
+ fail: Your account has not been approved yet. If multiples days have passed since you signed up, please contact your administrator.
+ signup: Your account was successfully created. It has been sent to an administrator for approval.
+ banned:
+ fail: You do not have access to this application. If you believe this is a mistake, please contact your administrator.
+ invite:
+ fail: Your token is either invalid or has expired. If you believe this is a mistake, please contact your administrator.
+ no_invite: You do not have an invitation to join. Please contact your administrator to receive one.
rename: Rename
reset_password:
subtitle: Reset Password
@@ -255,6 +328,7 @@ en:
roles:
administrator: Administrator
banned: Banned
+ pending: Pending
super_admin: Super Admin
user: User
room:
diff --git a/config/routes.rb b/config/routes.rb
index aecad233..f2a39a23 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -39,12 +39,18 @@ Rails.application.routes.draw do
scope '/admins' do
post '/branding', to: 'admins#branding', as: :admin_branding
post '/coloring', to: 'admins#coloring', as: :admin_coloring
+ post '/room_authentication', to: 'admins#room_authentication', as: :admin_room_authentication
+ post '/coloring_lighten', to: 'admins#coloring_lighten', as: :admin_coloring_lighten
+ post '/coloring_darken', to: 'admins#coloring_darken', as: :admin_coloring_darken
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
+ post '/invite', to: 'admins#invite', as: :invite_user
+ post '/registration_method/:method', to: 'admins#registration_method', as: :admin_change_registration
+ post '/approve/:user_uid', to: 'admins#approve', as: :admin_approve
end
scope '/themes' do
diff --git a/db/migrate/20190507190710_create_invitations.rb b/db/migrate/20190507190710_create_invitations.rb
new file mode 100644
index 00000000..c4f62b02
--- /dev/null
+++ b/db/migrate/20190507190710_create_invitations.rb
@@ -0,0 +1,12 @@
+# frozen_string_literal: true
+
+class CreateInvitations < ActiveRecord::Migration[5.0]
+ def change
+ create_table :invitations do |t|
+ t.string "email", null: false
+ t.string "provider", null: false
+ t.string "invite_token"
+ t.timestamps
+ end
+ end
+end
diff --git a/db/migrate/20190522193828_add_index_to_settings.rb b/db/migrate/20190522193828_add_index_to_settings.rb
new file mode 100644
index 00000000..6c1129b3
--- /dev/null
+++ b/db/migrate/20190522193828_add_index_to_settings.rb
@@ -0,0 +1,23 @@
+# 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 .
+
+class AddIndexToSettings < ActiveRecord::Migration[5.0]
+ def change
+ add_index :settings, :provider
+ end
+end
diff --git a/db/migrate/20190522194037_add_index_to_features.rb b/db/migrate/20190522194037_add_index_to_features.rb
new file mode 100644
index 00000000..06071354
--- /dev/null
+++ b/db/migrate/20190522194037_add_index_to_features.rb
@@ -0,0 +1,23 @@
+# 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 .
+
+class AddIndexToFeatures < ActiveRecord::Migration[5.0]
+ def change
+ add_index :features, :name
+ end
+end
diff --git a/db/migrate/20190522194445_add_index_to_users.rb b/db/migrate/20190522194445_add_index_to_users.rb
new file mode 100644
index 00000000..63f76348
--- /dev/null
+++ b/db/migrate/20190522194445_add_index_to_users.rb
@@ -0,0 +1,25 @@
+# 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 .
+
+class AddIndexToUsers < ActiveRecord::Migration[5.0]
+ def change
+ add_index :users, :email
+ add_index :users, :provider
+ add_index :users, :created_at
+ end
+end
diff --git a/db/migrate/20190522195242_add_index_to_invitations.rb b/db/migrate/20190522195242_add_index_to_invitations.rb
new file mode 100644
index 00000000..2762a137
--- /dev/null
+++ b/db/migrate/20190522195242_add_index_to_invitations.rb
@@ -0,0 +1,24 @@
+# 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 .
+
+class AddIndexToInvitations < ActiveRecord::Migration[5.0]
+ def change
+ add_index :invitations, :invite_token
+ add_index :invitations, :provider
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 26db9b9b..a09c7884 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20190326144939) do
+ActiveRecord::Schema.define(version: 20190522195242) do
create_table "features", force: :cascade do |t|
t.integer "setting_id"
@@ -19,9 +19,20 @@ ActiveRecord::Schema.define(version: 20190326144939) do
t.boolean "enabled", default: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
+ t.index ["name"], name: "index_features_on_name"
t.index ["setting_id"], name: "index_features_on_setting_id"
end
+ create_table "invitations", force: :cascade do |t|
+ t.string "email", null: false
+ t.string "provider", null: false
+ t.string "invite_token"
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ t.index ["invite_token"], name: "index_invitations_on_invite_token"
+ t.index ["provider"], name: "index_invitations_on_provider"
+ end
+
create_table "roles", force: :cascade do |t|
t.string "name"
t.string "resource_type"
@@ -57,6 +68,7 @@ ActiveRecord::Schema.define(version: 20190326144939) do
t.string "provider", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
+ t.index ["provider"], name: "index_settings_on_provider"
end
create_table "users", force: :cascade do |t|
@@ -78,7 +90,10 @@ ActiveRecord::Schema.define(version: 20190326144939) do
t.datetime "reset_sent_at"
t.string "activation_digest"
t.datetime "activated_at"
+ t.index ["created_at"], name: "index_users_on_created_at"
+ t.index ["email"], name: "index_users_on_email"
t.index ["password_digest"], name: "index_users_on_password_digest", unique: true
+ t.index ["provider"], name: "index_users_on_provider"
t.index ["room_id"], name: "index_users_on_room_id"
end
diff --git a/lib/tasks/configuration.rake b/lib/tasks/configuration.rake
index 602f245c..9e720988 100644
--- a/lib/tasks/configuration.rake
+++ b/lib/tasks/configuration.rake
@@ -16,15 +16,17 @@ namespace :conf do
end
passed
+ endpoint = fix_endpoint_format(ENV['BIGBLUEBUTTON_ENDPOINT'])
+
# Tries to establish a connection to the BBB server from Greenlight
print "Checking Connection"
- test_request(ENV['BIGBLUEBUTTON_ENDPOINT'])
+ test_request(endpoint)
passed
# Tests the checksum on the getMeetings api call
print "Checking Secret"
checksum = Digest::SHA1.hexdigest("getMeetings#{ENV['BIGBLUEBUTTON_SECRET']}")
- test_request("#{ENV['BIGBLUEBUTTON_ENDPOINT']}getMeetings?checksum=#{checksum}")
+ test_request("#{endpoint}getMeetings?checksum=#{checksum}")
passed
if ENV['ALLOW_MAIL_NOTIFICATIONS'] == 'true'
@@ -61,6 +63,15 @@ rescue => e
failed("Error connecting to BigBlueButton server - #{e}")
end
+def fix_endpoint_format(url)
+ # Fix endpoint format if required.
+ url += "/" unless url.ends_with?('/')
+ url += "api/" if url.ends_with?('bigbluebutton/')
+ url += "bigbluebutton/api/" unless url.ends_with?('bigbluebutton/api/')
+
+ url
+end
+
def failed(msg)
print(": Failed\n#{msg}\n")
exit
diff --git a/sample.env b/sample.env
index b26beea9..037c36fa 100644
--- a/sample.env
+++ b/sample.env
@@ -136,8 +136,8 @@ ROOM_FEATURES=default-client,mute-on-join
PAGINATION_NUMBER=25
# Specify the maximum number of rows that should be displayed per page for a paginated table
-# Default is set to 10 rows
-NUMBER_OF_ROWS=10
+# Default is set to 25 rows
+NUMBER_OF_ROWS=25
# Specify if you want to display the Google Calendar button
# ENABLE_GOOGLE_CALENDAR_BUTTON=true|false
diff --git a/spec/controllers/account_activations_controller_spec.rb b/spec/controllers/account_activations_controller_spec.rb
index 721d00d6..9c5c5632 100644
--- a/spec/controllers/account_activations_controller_spec.rb
+++ b/spec/controllers/account_activations_controller_spec.rb
@@ -72,6 +72,17 @@ describe AccountActivationsController, type: :controller do
expect(flash[:alert]).to be_present
expect(response).to redirect_to(root_path)
end
+
+ it "redirects a pending user to root with a flash" do
+ @user = create(:user, email_verified: false, provider: "greenlight")
+
+ @user.add_role :pending
+
+ get :edit, params: { email: @user.email, token: @user.activation_token }
+
+ expect(flash[:success]).to be_present
+ expect(response).to redirect_to(root_path)
+ end
end
describe "GET #resend" do
diff --git a/spec/controllers/admins_controller_spec.rb b/spec/controllers/admins_controller_spec.rb
index 1024a6a4..4bdc4aa3 100644
--- a/spec/controllers/admins_controller_spec.rb
+++ b/spec/controllers/admins_controller_spec.rb
@@ -26,6 +26,10 @@ describe AdminsController, type: :controller do
end
describe "User Roles" do
+ before do
+ allow(Rails.configuration).to receive(:enable_email_verification).and_return(true)
+ end
+
context "GET #index" do
it "renders a 404 if a user tries to acccess it" do
@request.session[:user_id] = @user.id
@@ -64,6 +68,14 @@ describe AdminsController, type: :controller do
expect(flash[:success]).to be_present
expect(response).to redirect_to(admins_path)
end
+
+ it "sends an email to the user being promoted" do
+ @request.session[:user_id] = @admin.id
+
+ params = { user_uid: @user.uid }
+
+ expect { post :promote, params: params }.to change { ActionMailer::Base.deliveries.count }.by(1)
+ end
end
context "POST #demote" do
@@ -79,6 +91,16 @@ describe AdminsController, type: :controller do
expect(flash[:success]).to be_present
expect(response).to redirect_to(admins_path)
end
+
+ it "sends an email to the user being demoted" do
+ @request.session[:user_id] = @admin.id
+
+ @user.add_role :admin
+
+ params = { user_uid: @user.uid }
+
+ expect { post :demote, params: params }.to change { ActionMailer::Base.deliveries.count }.by(1)
+ end
end
context "POST #ban" do
@@ -109,6 +131,56 @@ describe AdminsController, type: :controller do
expect(response).to redirect_to(admins_path)
end
end
+
+ context "POST #invite" do
+ before do
+ allow(Rails.configuration).to receive(:loadbalanced_configuration).and_return(true)
+ allow_any_instance_of(ApplicationController).to receive(:allow_greenlight_users?).and_return(true)
+ allow_any_instance_of(User).to receive(:greenlight_account?).and_return(true)
+ end
+
+ it "invites a user" do
+ @request.session[:user_id] = @admin.id
+ email = Faker::Internet.email
+ post :invite, params: { invite_user: { email: email } }
+
+ invite = Invitation.find_by(email: email, provider: "greenlight")
+
+ expect(invite.present?).to eq(true)
+ expect(flash[:success]).to be_present
+ expect(response).to redirect_to(admins_path)
+ end
+
+ it "sends an invitation email" do
+ @request.session[:user_id] = @admin.id
+ email = Faker::Internet.email
+
+ params = { invite_user: { email: email } }
+ expect { post :invite, params: params }.to change { ActionMailer::Base.deliveries.count }.by(1)
+ end
+ end
+
+ context "POST #approve" do
+ it "approves a pending user" do
+ @request.session[:user_id] = @admin.id
+
+ @user.add_role :pending
+
+ post :approve, params: { user_uid: @user.uid }
+
+ expect(@user.has_role?(:pending)).to eq(false)
+ expect(flash[:success]).to be_present
+ expect(response).to redirect_to(admins_path)
+ end
+
+ it "sends the user an email telling them theyre approved" do
+ @request.session[:user_id] = @admin.id
+
+ @user.add_role :pending
+ params = { user_uid: @user.uid }
+ expect { post :approve, params: params }.to change { ActionMailer::Base.deliveries.count }.by(1)
+ end
+ end
end
describe "User Design" do
@@ -135,14 +207,91 @@ describe AdminsController, type: :controller do
allow_any_instance_of(User).to receive(:greenlight_account?).and_return(true)
@request.session[:user_id] = @admin.id
- primary_color = "#000000"
+ primary_color = Faker::Color.hex_color
post :coloring, params: { color: primary_color }
feature = Setting.find_by(provider: "provider1").features.find_by(name: "Primary Color")
expect(feature[:value]).to eq(primary_color)
- expect(response).to redirect_to(admins_path(setting: "site_settings"))
+ expect(response).to redirect_to(admins_path)
+ end
+
+ it "changes the primary-lighten on the page" do
+ allow(Rails.configuration).to receive(:loadbalanced_configuration).and_return(true)
+ allow_any_instance_of(User).to receive(:greenlight_account?).and_return(true)
+
+ @request.session[:user_id] = @admin.id
+ primary_color = Faker::Color.hex_color
+
+ post :coloring_lighten, params: { color: primary_color }
+
+ feature = Setting.find_by(provider: "provider1").features.find_by(name: "Primary Color Lighten")
+
+ expect(feature[:value]).to eq(primary_color)
+ expect(response).to redirect_to(admins_path)
+ end
+
+ it "changes the primary-darken on the page" do
+ allow(Rails.configuration).to receive(:loadbalanced_configuration).and_return(true)
+ allow_any_instance_of(User).to receive(:greenlight_account?).and_return(true)
+
+ @request.session[:user_id] = @admin.id
+ primary_color = Faker::Color.hex_color
+
+ post :coloring_darken, params: { color: primary_color }
+
+ feature = Setting.find_by(provider: "provider1").features.find_by(name: "Primary Color Darken")
+
+ expect(feature[:value]).to eq(primary_color)
+ expect(response).to redirect_to(admins_path)
+ end
+ end
+
+ context "POST #registration_method" do
+ it "changes the registration method for the given context" do
+ allow(Rails.configuration).to receive(:enable_email_verification).and_return(true)
+ allow(Rails.configuration).to receive(:loadbalanced_configuration).and_return(true)
+ allow_any_instance_of(User).to receive(:greenlight_account?).and_return(true)
+
+ @request.session[:user_id] = @admin.id
+
+ post :registration_method, params: { method: "invite" }
+
+ feature = Setting.find_by(provider: "provider1").features.find_by(name: "Registration Method")
+
+ expect(feature[:value]).to eq(Rails.configuration.registration_methods[:invite])
+ expect(flash[:success]).to be_present
+ expect(response).to redirect_to(admins_path)
+ end
+
+ it "does not allow the user to change to invite if emails are off" do
+ allow(Rails.configuration).to receive(:enable_email_verification).and_return(false)
+ allow(Rails.configuration).to receive(:loadbalanced_configuration).and_return(true)
+ allow_any_instance_of(User).to receive(:greenlight_account?).and_return(true)
+
+ @request.session[:user_id] = @admin.id
+
+ post :registration_method, params: { method: "invite" }
+
+ expect(flash[:alert]).to be_present
+ expect(response).to redirect_to(admins_path)
+ end
+ end
+
+ context "POST #room_authentication" do
+ it "changes the room authentication required setting" do
+ allow(Rails.configuration).to receive(:loadbalanced_configuration).and_return(true)
+ allow_any_instance_of(User).to receive(:greenlight_account?).and_return(true)
+
+ @request.session[:user_id] = @admin.id
+
+ post :room_authentication, params: { value: "true" }
+
+ feature = Setting.find_by(provider: "provider1").features.find_by(name: "Room Authentication")
+
+ expect(feature[:value]).to eq("true")
+ expect(response).to redirect_to(admins_path)
end
end
end
diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb
index e1a47f61..0d5e9550 100644
--- a/spec/controllers/application_controller_spec.rb
+++ b/spec/controllers/application_controller_spec.rb
@@ -24,22 +24,47 @@ end
describe ApplicationController do
controller do
- before_action :check_if_unbanned
-
def index
head :ok
end
+
+ def error
+ raise BigBlueButton::BigBlueButtonException
+ end
end
context "roles" do
- it "redirects a banned user to a 401 and logs them out" do
+ before do
@user = create(:user)
+ end
+
+ it "redirects a banned user to a 401 and logs them out" do
@user.add_role :denied
@request.session[:user_id] = @user.id
get :index
expect(@request.session[:user_id]).to be_nil
- expect(response).to redirect_to(unauthorized_path)
+ expect(flash[:alert]).to be_present
+ expect(response).to redirect_to(root_path)
+ end
+
+ it "redirects a pending user to a 401 and logs them out" do
+ @user.add_role :pending
+ @request.session[:user_id] = @user.id
+
+ get :index
+ expect(@request.session[:user_id]).to be_nil
+ expect(flash[:alert]).to be_present
+ expect(response).to redirect_to(root_path)
+ end
+ end
+
+ context "errors" do
+ it "renders a BigBlueButton error if a BigBlueButtonException occurrs" do
+ routes.draw { get "error" => "anonymous#error" }
+
+ get :error
+ expect(response).to render_template("errors/bigbluebutton_error")
end
end
end
diff --git a/spec/controllers/rooms_controller_spec.rb b/spec/controllers/rooms_controller_spec.rb
index f34533f7..1492e84c 100644
--- a/spec/controllers/rooms_controller_spec.rb
+++ b/spec/controllers/rooms_controller_spec.rb
@@ -84,7 +84,7 @@ describe RoomsController, type: :controller do
end
it "sets the join name to cookie[:greenlight_name] if it exists" do
- name = Faker::Pokemon.name
+ name = Faker::Games::Pokemon.name
@request.cookies[:greenlight_name] = name
get :show, params: { room_uid: @owner.main_room }
@@ -115,7 +115,7 @@ describe RoomsController, type: :controller do
it "should create room with name and correct settings" do
@request.session[:user_id] = @owner.id
- name = Faker::Pokemon.name
+ name = Faker::Games::Pokemon.name
room_params = { name: name, "client": "html5", "mute_on_join": "1" }
json_room_settings = "{\"muteOnStart\":true,\"joinViaHtml5\":true}"
@@ -131,7 +131,7 @@ describe RoomsController, type: :controller do
it "it should redirect to root if not logged in" do
expect do
- name = Faker::Pokemon.name
+ name = Faker::Games::Pokemon.name
post :create, params: { room: { name: name } }
end.to change { Room.count }.by(0)
@@ -206,6 +206,15 @@ describe RoomsController, type: :controller do
expect(flash[:alert]).to be_present
expect(response).to redirect_to(root_path)
end
+
+ it "should not allow the user to join if the user isn't signed in and room authentication is required" do
+ allow_any_instance_of(Setting).to receive(:get_value).and_return("true")
+
+ post :join, params: { room_uid: @room }
+
+ expect(flash[:alert]).to be_present
+ expect(response).to redirect_to(root_path)
+ end
end
describe "DELETE #destroy" do
@@ -280,7 +289,7 @@ describe RoomsController, type: :controller do
it "properly updates room name through the room settings modal and redirects to current page" do
@request.session[:user_id] = @user.id
- name = Faker::Pokemon.name
+ name = Faker::Games::Pokemon.name
room_params = { room_uid: @secondary_room.uid, room: { "name": name } }
diff --git a/spec/controllers/sessions_controller_spec.rb b/spec/controllers/sessions_controller_spec.rb
index 9720194a..f85e1ac2 100644
--- a/spec/controllers/sessions_controller_spec.rb
+++ b/spec/controllers/sessions_controller_spec.rb
@@ -223,6 +223,36 @@ describe SessionsController, type: :controller do
expect(response).to redirect_to(root_path)
end
+
+ context 'registration notification emails' do
+ before do
+ allow(Rails.configuration).to receive(:enable_email_verification).and_return(true)
+ @user = create(:user, provider: "greenlight")
+ @admin = create(:user, provider: "greenlight", email: "test@example.com")
+ @admin.add_role :admin
+ end
+
+ it "should notify admin on new user signup with approve/reject registration" do
+ allow_any_instance_of(Registrar).to receive(:approval_registration).and_return(true)
+
+ request.env["omniauth.auth"] = OmniAuth.config.mock_auth[:bn_launcher]
+
+ expect { get :omniauth, params: { provider: 'bn_launcher' } }
+ .to change { ActionMailer::Base.deliveries.count }.by(1)
+ end
+
+ it "should notify admin on new user signup with invite registration" do
+ allow_any_instance_of(Registrar).to receive(:invite_registration).and_return(true)
+
+ invite = Invitation.create(email: "user@google.com", provider: "greenlight")
+ @request.session[:invite_token] = invite.invite_token
+
+ request.env["omniauth.auth"] = OmniAuth.config.mock_auth[:bn_launcher]
+
+ expect { get :omniauth, params: { provider: 'bn_launcher' } }
+ .to change { ActionMailer::Base.deliveries.count }.by(1)
+ end
+ end
end
it "should not create session without omniauth env set for bn_launcher" do
diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb
index cdcc1e6e..5622dcb1 100644
--- a/spec/controllers/users_controller_spec.rb
+++ b/spec/controllers/users_controller_spec.rb
@@ -169,7 +169,9 @@ describe UsersController, type: :controller do
end
context "allow email verification" do
- before { allow(Rails.configuration).to receive(:enable_email_verification).and_return(true) }
+ before do
+ allow(Rails.configuration).to receive(:enable_email_verification).and_return(true)
+ end
it "should raise if there there is a delivery failure" do
params = random_valid_user_params
@@ -179,6 +181,113 @@ describe UsersController, type: :controller do
raise :anyerror
end.to raise_error { :anyerror }
end
+
+ context "enable invite registration" do
+ before do
+ allow_any_instance_of(Registrar).to receive(:invite_registration).and_return(true)
+ allow(Rails.configuration).to receive(:allow_user_signup).and_return(true)
+ @user = create(:user, provider: "greenlight")
+ @admin = create(:user, provider: "greenlight", email: "test@example.com")
+ @admin.add_role :admin
+ end
+
+ it "should notify admins that user signed up" do
+ params = random_valid_user_params
+ invite = Invitation.create(email: params[:user][:email], provider: "greenlight")
+ @request.session[:invite_token] = invite.invite_token
+
+ expect { post :create, params: params }.to change { ActionMailer::Base.deliveries.count }.by(1)
+ end
+
+ it "rejects the user if they are not invited" do
+ get :new
+
+ expect(flash[:alert]).to be_present
+ expect(response).to redirect_to(root_path)
+ end
+
+ it "allows the user to signup if they are invited" do
+ allow(Rails.configuration).to receive(:enable_email_verification).and_return(false)
+
+ params = random_valid_user_params
+ invite = Invitation.create(email: params[:user][:name], provider: "greenlight")
+ @request.session[:invite_token] = invite.invite_token
+
+ post :create, params: params
+
+ u = User.find_by(name: params[:user][:name], email: params[:user][:email])
+ expect(response).to redirect_to(u.main_room)
+ end
+
+ it "verifies the user if they sign up with the email they receieved the invite with" do
+ allow(Rails.configuration).to receive(:enable_email_verification).and_return(true)
+
+ params = random_valid_user_params
+ invite = Invitation.create(email: params[:user][:email], provider: "greenlight")
+ @request.session[:invite_token] = invite.invite_token
+
+ post :create, params: params
+
+ u = User.find_by(name: params[:user][:name], email: params[:user][:email])
+ expect(response).to redirect_to(u.main_room)
+ end
+
+ it "asks the user to verify if they signup with a different email" do
+ allow(Rails.configuration).to receive(:enable_email_verification).and_return(true)
+
+ params = random_valid_user_params
+ invite = Invitation.create(email: Faker::Internet.email, provider: "greenlight")
+ @request.session[:invite_token] = invite.invite_token
+
+ post :create, params: params
+
+ expect(User.exists?(name: params[:user][:name], email: params[:user][:email])).to eq(true)
+ expect(flash[:success]).to be_present
+ expect(response).to redirect_to(root_path)
+ end
+ end
+
+ context "enable approval registration" do
+ before do
+ allow_any_instance_of(Registrar).to receive(:approval_registration).and_return(true)
+ allow(Rails.configuration).to receive(:allow_user_signup).and_return(true)
+ @user = create(:user, provider: "greenlight")
+ @admin = create(:user, provider: "greenlight", email: "test@example.com")
+ @admin.add_role :admin
+ end
+
+ it "allows any user to sign up" do
+ allow(Rails.configuration).to receive(:enable_email_verification).and_return(false)
+
+ params = random_valid_user_params
+
+ post :create, params: params
+
+ expect(User.exists?(name: params[:user][:name], email: params[:user][:email])).to eq(true)
+ expect(flash[:success]).to be_present
+ expect(response).to redirect_to(root_path)
+ end
+
+ it "sets the user to pending on sign up" do
+ allow(Rails.configuration).to receive(:enable_email_verification).and_return(false)
+
+ params = random_valid_user_params
+
+ post :create, params: params
+
+ u = User.find_by(name: params[:user][:name], email: params[:user][:email])
+
+ expect(u.has_role?(:pending)).to eq(true)
+ end
+
+ it "notifies admins that a user signed up" do
+ allow(Rails.configuration).to receive(:enable_email_verification).and_return(true)
+
+ params = random_valid_user_params
+
+ expect { post :create, params: params }.to change { ActionMailer::Base.deliveries.count }.by(2)
+ end
+ end
end
it "redirects to main room if already authenticated" do
diff --git a/spec/factories.rb b/spec/factories.rb
index 0b3aa58a..70515f6a 100644
--- a/spec/factories.rb
+++ b/spec/factories.rb
@@ -32,7 +32,7 @@ FactoryBot.define do
end
factory :room do
- name { Faker::Pokemon.name }
+ name { Faker::Games::Pokemon.name }
owner { create(:user) }
end
end
diff --git a/test/mailers/previews/user_mailer_preview.rb b/test/mailers/previews/user_mailer_preview.rb
index 00554969..7254af50 100644
--- a/test/mailers/previews/user_mailer_preview.rb
+++ b/test/mailers/previews/user_mailer_preview.rb
@@ -1,13 +1,18 @@
# frozen_string_literal: true
class UserMailerPreview < ActionMailer::Preview
+ def initialize
+ @logo = "https://raw.githubusercontent.com/bigbluebutton/greenlight/master/app/assets/images/logo_with_text.png"
+ @color = "#467fcf"
+ end
+
# Preview this email at
# http://localhost:3000/rails/mailers/user_mailer/password_reset
def password_reset
user = User.first
user.reset_token = User.new_token
url = "http://example.com" + "/password_resets/" + user.reset_token + "/edit?email=" + user.email
- UserMailer.password_reset(user, url)
+ UserMailer.password_reset(user, url, @logo, @color)
end
# Preview this email at
@@ -15,6 +20,52 @@ class UserMailerPreview < ActionMailer::Preview
def verify_email
user = User.first
url = "http://example.com" + "/u/verify/confirm/" + user.uid
- UserMailer.verify_email(user, url)
+ UserMailer.verify_email(user, url, @logo, @color)
+ end
+
+ # Preview this email at
+ # http://localhost:3000/rails/mailers/user_mailer/invite_email
+ def invite_email
+ UserMailer.invite_email("Example User", "from@example.com", "http://example.com/signup", @logo, @color)
+ end
+
+ # Preview this email at
+ # http://localhost:3000/rails/mailers/user_mailer/approve_user
+ def approve_user
+ user = User.first
+ UserMailer.approve_user(user, "http://example.com/", @logo, @color)
+ end
+
+ # Preview this email at
+ # http://localhost:3000/rails/mailers/user_mailer/approval_user_signup
+ def approval_user_signup
+ user = User.first
+ UserMailer.approval_user_signup(user, "http://example.com/", @logo, @color, "test@example.com")
+ end
+
+ # Preview this email at
+ # http://localhost:3000/rails/mailers/user_mailer/invite_user_signup
+ def invite_user_signup
+ user = User.first
+ UserMailer.invite_user_signup(user, "http://example.com/", @logo, @color, "test@example.com")
+ end
+
+ # http://localhost:3000/rails/mailers/user_mailer/user_promoted
+ def user_promoted
+ user = User.first
+ url = "http://example.com"
+ logo_image = "https://raw.githubusercontent.com/bigbluebutton/greenlight/master/app/assets/images/logo_with_text.png"
+ user_color = "#467fcf"
+ UserMailer.user_promoted(user, url, logo_image, user_color)
+ end
+
+ # Preview this email at
+ # http://localhost:3000/rails/mailers/user_mailer/user_demoted
+ def user_demoted
+ user = User.first
+ url = "http://example.com"
+ logo_image = "https://raw.githubusercontent.com/bigbluebutton/greenlight/master/app/assets/images/logo_with_text.png"
+ user_color = "#467fcf"
+ UserMailer.user_demoted(user, url, logo_image, user_color)
end
end
diff --git a/vendor/assets/images/colourPicker/colorpicker_submit.png b/vendor/assets/images/colourPicker/colorpicker_submit.png
index 7f4c0825..05a46f47 100644
Binary files a/vendor/assets/images/colourPicker/colorpicker_submit.png and b/vendor/assets/images/colourPicker/colorpicker_submit.png differ
diff --git a/vendor/assets/stylesheets/colorpicker.scss b/vendor/assets/stylesheets/colorpicker.scss
index 57022942..c55437a2 100644
--- a/vendor/assets/stylesheets/colorpicker.scss
+++ b/vendor/assets/stylesheets/colorpicker.scss
@@ -74,13 +74,13 @@
position: absolute;
font-size: 10px;
font-family: Arial, Helvetica, sans-serif;
- color: #898989;
+ color: white;
top: 4px;
right: 11px;
text-align: right;
margin: 0;
padding: 0;
- height: 11px;
+ height: 14px;
}
.colorpicker_hex {
position: absolute;