mirror of https://github.com/Lissy93/dashy.git
🛂 Disable config for guests (#1552)
This commit is contained in:
parent
e970fc69c1
commit
749f3b21da
|
@ -8,7 +8,7 @@ import { makePageName, formatConfigPath, componentVisibility } from '@/utils/Con
|
|||
import { applyItemId } from '@/utils/SectionHelpers';
|
||||
import filterUserSections from '@/utils/CheckSectionVisibility';
|
||||
import ErrorHandler, { InfoHandler, InfoKeys } from '@/utils/ErrorHandler';
|
||||
import { isUserAdmin, makeBasicAuthHeaders } from '@/utils/Auth';
|
||||
import { isUserAdmin, makeBasicAuthHeaders, isLoggedInAsGuest } from '@/utils/Auth';
|
||||
import { localStorageKeys, theme as defaultTheme } from './utils/defaults';
|
||||
|
||||
Vue.use(Vuex);
|
||||
|
@ -114,7 +114,8 @@ const store = new Vuex.Store({
|
|||
}
|
||||
// Disable everything
|
||||
if (appConfig.disableConfiguration
|
||||
|| (appConfig.disableConfigurationForNonAdmin && !isUserAdmin())) {
|
||||
|| (appConfig.disableConfigurationForNonAdmin && !isUserAdmin())
|
||||
|| isLoggedInAsGuest()) {
|
||||
perms.allowWriteToDisk = false;
|
||||
perms.allowSaveLocally = false;
|
||||
perms.allowViewConfig = false;
|
||||
|
|
|
@ -187,9 +187,9 @@ export const getCurrentUser = () => {
|
|||
* Checks if the user is viewing the dashboard as a guest
|
||||
* Returns true if guest mode enabled, and user not logged in
|
||||
* */
|
||||
export const isLoggedInAsGuest = (currentUser) => {
|
||||
export const isLoggedInAsGuest = () => {
|
||||
const guestEnabled = isGuestAccessEnabled();
|
||||
const loggedIn = isLoggedIn() && currentUser;
|
||||
const loggedIn = isLoggedIn();
|
||||
return guestEnabled && !loggedIn;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue