Merge pull request #2591 from sbwalker/dev
added new methods for managing visitor settings (for personalization)
This commit is contained in:
commit
e91ff95712
|
@ -62,7 +62,7 @@ namespace Oqtane.Services
|
|||
/// <summary>
|
||||
/// Returns a key-value dictionary of all page module settings for the given page module
|
||||
/// </summary>
|
||||
/// <param name="pageId"></param>
|
||||
/// <param name="pageModuleId"></param>
|
||||
/// <returns></returns>
|
||||
Task<Dictionary<string, string>> GetPageModuleSettingsAsync(int pageModuleId);
|
||||
|
||||
|
@ -107,7 +107,7 @@ namespace Oqtane.Services
|
|||
/// <summary>
|
||||
/// Returns a key-value dictionary of all user settings for the given user
|
||||
/// </summary>
|
||||
/// <param name="pageId"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
Task<Dictionary<string, string>> GetUserSettingsAsync(int userId);
|
||||
|
||||
|
@ -122,7 +122,7 @@ namespace Oqtane.Services
|
|||
/// <summary>
|
||||
/// Returns a key-value dictionary of all folder settings for the given folder
|
||||
/// </summary>
|
||||
/// <param name="pageId"></param>
|
||||
/// <param name="folderId"></param>
|
||||
/// <returns></returns>
|
||||
Task<Dictionary<string, string>> GetFolderSettingsAsync(int folderId);
|
||||
|
||||
|
@ -148,6 +148,21 @@ namespace Oqtane.Services
|
|||
/// <returns></returns>
|
||||
Task UpdateHostSettingsAsync(Dictionary<string, string> hostSettings);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a key-value dictionary of all settings for the given visitor
|
||||
/// </summary>
|
||||
/// <param name="visitorId"></param>
|
||||
/// <returns></returns>
|
||||
Task<Dictionary<string, string>> GetVisitorSettingsAsync(int visitorId);
|
||||
|
||||
/// <summary>
|
||||
/// Updates a visitor setting
|
||||
/// </summary>
|
||||
/// <param name="visitorSettings"></param>
|
||||
/// <param name="visitorId"></param>
|
||||
/// <returns></returns>
|
||||
Task UpdateVisitorSettingsAsync(Dictionary<string, string> visitorSettings, int visitorId);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a key-value dictionary of all settings for the given entityName
|
||||
/// </summary>
|
||||
|
|
|
@ -111,6 +111,26 @@ namespace Oqtane.Services
|
|||
await UpdateSettingsAsync(hostSettings, EntityNames.Host, -1);
|
||||
}
|
||||
|
||||
public async Task<Dictionary<string, string>> GetVisitorSettingsAsync(int visitorId)
|
||||
{
|
||||
if (visitorId != -1)
|
||||
{
|
||||
return await GetSettingsAsync(EntityNames.Visitor, visitorId);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new Dictionary<string, string>();
|
||||
}
|
||||
}
|
||||
|
||||
public async Task UpdateVisitorSettingsAsync(Dictionary<string, string> visitorSettings, int visitorId)
|
||||
{
|
||||
if (visitorId != -1)
|
||||
{
|
||||
await UpdateSettingsAsync(visitorSettings, EntityNames.Visitor, visitorId);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<Dictionary<string, string>> GetSettingsAsync(string entityName, int entityId)
|
||||
{
|
||||
var dictionary = new Dictionary<string, string>();
|
||||
|
|
|
@ -240,7 +240,6 @@ namespace Oqtane.Controllers
|
|||
{
|
||||
authorized = (visitorId == entityId);
|
||||
}
|
||||
authorized = false;
|
||||
}
|
||||
break;
|
||||
default: // custom entity
|
||||
|
|
Loading…
Reference in New Issue
Block a user