Skip to content
Snippets Groups Projects
Unverified Commit 03598be6 authored by Ahmad Farhat's avatar Ahmad Farhat Committed by GitHub
Browse files

Fix for superadmins when changing pages (#5470)

* Fix for superadmins when changing pages

* eslint
parent 93311238
No related branches found
No related tags found
No related merge requests found
......@@ -78,6 +78,7 @@ class ApplicationController < ActionController::Base
def invalid_session?(user)
return true if user&.session_token != session[:session_token]
return true if user&.session_expiry && DateTime.now > user&.session_expiry
return true if !user.super_admin? && user.provider != current_provider
false
end
......
......@@ -27,7 +27,8 @@ export default function AuthenticatedOnly() {
const { t } = useTranslation();
const currentUser = useAuth();
const location = useLocation();
const match = useMatch('/rooms/:friendlyId');
const roomsMatch = useMatch('/rooms/:friendlyId');
const superAdminMatch = useMatch('/admin/*');
const deleteSession = useDeleteSession({ showToast: false });
// User is either pending or banned
......@@ -44,10 +45,14 @@ export default function AuthenticatedOnly() {
}
// Custom logic to redirect from Rooms page to join page if the user isn't signed in
if (!currentUser.signed_in && match) {
if (!currentUser.signed_in && roomsMatch) {
return <Navigate to={`${location.pathname}/join`} />;
}
if (currentUser.signed_in && currentUser.isSuperAdmin && !superAdminMatch) {
return <Navigate to="/admin/users" />;
}
if (!currentUser.signed_in) {
toast.error(t('toast.error.signin_required'));
return <Navigate to="/" />;
......
# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/.
#
# Copyright (c) 2022 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.
#
# Greenlight 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 Greenlight; if not, see <http://www.gnu.org/licenses/>.
# frozen_string_literal: true
if ENV['LOADBALANCER_ENDPOINT'].present?
Rails.application.config.session_store :cookie_store, key: '_greenlight-3_0_session', domain: ENV.fetch('SESSION_DOMAIN_NAME', nil)
else
Rails.application.config.session_store :cookie_store, key: '_greenlight-3_0_session'
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment