diff --git a/Oqtane.Client/Services/Interfaces/ISettingService.cs b/Oqtane.Client/Services/Interfaces/ISettingService.cs index b2d7908f9..949db56de 100644 --- a/Oqtane.Client/Services/Interfaces/ISettingService.cs +++ b/Oqtane.Client/Services/Interfaces/ISettingService.cs @@ -62,7 +62,7 @@ public interface ISettingService /// /// Returns a key-value dictionary of all page module settings for the given page module /// - /// + /// /// Task> GetPageModuleSettingsAsync(int pageModuleId); @@ -107,7 +107,7 @@ public interface ISettingService /// /// Returns a key-value dictionary of all user settings for the given user /// - /// + /// /// Task> GetUserSettingsAsync(int userId); @@ -122,7 +122,7 @@ public interface ISettingService /// /// Returns a key-value dictionary of all folder settings for the given folder /// - /// + /// /// Task> GetFolderSettingsAsync(int folderId); @@ -148,6 +148,21 @@ public interface ISettingService /// Task UpdateHostSettingsAsync(Dictionary hostSettings); + /// + /// Returns a key-value dictionary of all settings for the given visitor + /// + /// + /// + Task> GetVisitorSettingsAsync(int visitorId); + + /// + /// Updates a visitor setting + /// + /// + /// + /// + Task UpdateVisitorSettingsAsync(Dictionary visitorSettings, int visitorId); + /// /// Returns a key-value dictionary of all settings for the given entityName /// diff --git a/Oqtane.Client/Services/SettingService.cs b/Oqtane.Client/Services/SettingService.cs index b06a2d410..4b4cbc12b 100644 --- a/Oqtane.Client/Services/SettingService.cs +++ b/Oqtane.Client/Services/SettingService.cs @@ -111,6 +111,26 @@ public async Task UpdateHostSettingsAsync(Dictionary hostSetting await UpdateSettingsAsync(hostSettings, EntityNames.Host, -1); } + public async Task> GetVisitorSettingsAsync(int visitorId) + { + if (visitorId != -1) + { + return await GetSettingsAsync(EntityNames.Visitor, visitorId); + } + else + { + return new Dictionary(); + } + } + + public async Task UpdateVisitorSettingsAsync(Dictionary visitorSettings, int visitorId) + { + if (visitorId != -1) + { + await UpdateSettingsAsync(visitorSettings, EntityNames.Visitor, visitorId); + } + } + public async Task> GetSettingsAsync(string entityName, int entityId) { var dictionary = new Dictionary(); diff --git a/Oqtane.Server/Controllers/SettingController.cs b/Oqtane.Server/Controllers/SettingController.cs index d4da807ad..f60a5adda 100644 --- a/Oqtane.Server/Controllers/SettingController.cs +++ b/Oqtane.Server/Controllers/SettingController.cs @@ -240,7 +240,6 @@ private bool IsAuthorized(string entityName, int entityId, string permissionName { authorized = (visitorId == entityId); } - authorized = false; } break; default: // custom entity