Skip to content

armgit / dashy

Public Imported from GitHub
0

πŸš€ A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!

πŸ›‚ Disable config for guests (#1552)

Alicia Sykes749f3b21da51
diff --git a/src/store.js b/src/store.js
index d8d88826..9130139c 100644
--- a/src/store.js
+++ b/src/store.js
@@ -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;
diff --git a/src/utils/Auth.js b/src/utils/Auth.js
index 9114458e..d2b5ce1d 100644
--- a/src/utils/Auth.js
+++ b/src/utils/Auth.js
@@ -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;
};