Merge remote-tracking branch 'oqtane/dev' into dev
This commit is contained in:
@ -135,10 +135,12 @@ namespace Oqtane.Services
|
|||||||
{
|
{
|
||||||
var dictionary = new Dictionary<string, string>();
|
var dictionary = new Dictionary<string, string>();
|
||||||
var settings = await GetJsonAsync<List<Setting>>($"{Apiurl}?entityname={entityName}&entityid={entityId}");
|
var settings = await GetJsonAsync<List<Setting>>($"{Apiurl}?entityname={entityName}&entityid={entityId}");
|
||||||
|
if (settings != null)
|
||||||
foreach(Setting setting in settings.OrderBy(item => item.SettingName).ToList())
|
|
||||||
{
|
{
|
||||||
dictionary.Add(setting.SettingName, setting.SettingValue);
|
foreach (Setting setting in settings.OrderBy(item => item.SettingName).ToList())
|
||||||
|
{
|
||||||
|
dictionary.Add(setting.SettingName, setting.SettingValue);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return dictionary;
|
return dictionary;
|
||||||
}
|
}
|
||||||
|
@ -478,7 +478,7 @@
|
|||||||
PageState.EditMode = true;
|
PageState.EditMode = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
NavigationManager.NavigateTo(NavigateUrl(PageState.Page.Path, "edit=" + ((PageState.EditMode) ? "1" : "0")));
|
NavigationManager.NavigateTo(NavigateUrl(PageState.Page.Path, "edit=" + ((PageState.EditMode) ? "true" : "false")));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -486,7 +486,7 @@
|
|||||||
{
|
{
|
||||||
await PageService.AddPageAsync(PageState.Page.PageId, PageState.User.UserId);
|
await PageService.AddPageAsync(PageState.Page.PageId, PageState.User.UserId);
|
||||||
PageState.EditMode = true;
|
PageState.EditMode = true;
|
||||||
NavigationManager.NavigateTo(NavigateUrl(PageState.Page.Path, "edit=" + ((PageState.EditMode) ? "1" : "0")));
|
NavigationManager.NavigateTo(NavigateUrl(PageState.Page.Path, "edit=" + ((PageState.EditMode) ? "true" : "false")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -433,30 +433,45 @@ namespace Oqtane.Extensions
|
|||||||
{
|
{
|
||||||
var _settings = httpContext.RequestServices.GetRequiredService<ISettingRepository>();
|
var _settings = httpContext.RequestServices.GetRequiredService<ISettingRepository>();
|
||||||
var _profiles = httpContext.RequestServices.GetRequiredService<IProfileRepository>();
|
var _profiles = httpContext.RequestServices.GetRequiredService<IProfileRepository>();
|
||||||
var profiles = _profiles.GetProfiles(user.SiteId);
|
var profiles = _profiles.GetProfiles(alias.SiteId).ToList();
|
||||||
foreach (var mapping in httpContext.GetSiteSettings().GetValue("ExternalLogin:ProfileClaimTypes", "").Split(',', StringSplitOptions.RemoveEmptyEntries))
|
foreach (var mapping in httpContext.GetSiteSettings().GetValue("ExternalLogin:ProfileClaimTypes", "").Split(',', StringSplitOptions.RemoveEmptyEntries))
|
||||||
{
|
{
|
||||||
if (mapping.Contains(":"))
|
if (mapping.Contains(":"))
|
||||||
{
|
{
|
||||||
var claim = claimsPrincipal.Claims.FirstOrDefault(item => item.Type == mapping.Split(":")[0]);
|
var claim = claimsPrincipal.Claims.FirstOrDefault(item => item.Type == mapping.Split(":")[0]);
|
||||||
if (claim != null && !string.IsNullOrEmpty(claim.Value))
|
if (claim != null)
|
||||||
{
|
{
|
||||||
var profile = profiles.FirstOrDefault(item => item.Name == mapping.Split(":")[1]);
|
var profile = profiles.FirstOrDefault(item => item.Name == mapping.Split(":")[1]);
|
||||||
if (profile != null)
|
if (profile != null)
|
||||||
{
|
{
|
||||||
var setting = _settings.GetSetting(EntityNames.User, user.UserId, profile.Name);
|
if (!string.IsNullOrEmpty(claim.Value))
|
||||||
if (setting != null)
|
|
||||||
{
|
{
|
||||||
setting.SettingValue = claim.Value;
|
var setting = _settings.GetSetting(EntityNames.User, user.UserId, profile.Name);
|
||||||
_settings.UpdateSetting(setting);
|
if (setting != null)
|
||||||
}
|
{
|
||||||
else
|
setting.SettingValue = claim.Value;
|
||||||
{
|
_settings.UpdateSetting(setting);
|
||||||
setting = new Setting { EntityName = EntityNames.User, EntityId = user.UserId, SettingName = profile.Name, SettingValue = claim.Value, IsPrivate = profile.IsPrivate };
|
}
|
||||||
_settings.AddSetting(setting);
|
else
|
||||||
|
{
|
||||||
|
setting = new Setting { EntityName = EntityNames.User, EntityId = user.UserId, SettingName = profile.Name, SettingValue = claim.Value, IsPrivate = profile.IsPrivate };
|
||||||
|
_settings.AddSetting(setting);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_logger.Log(LogLevel.Error, "ExternalLogin", Enums.LogFunction.Security, "The User Profile {ProfileName} Does Not Exist For The Site. Please Verify Your User Profile Definitions.", mapping.Split(":")[1]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_logger.Log(LogLevel.Error, "ExternalLogin", Enums.LogFunction.Security, "The User Profile Claim {ClaimType} Does Not Exist. The Valid Claims Are {Claims}.", mapping.Split(":")[0], claims);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_logger.Log(LogLevel.Error, "ExternalLogin", Enums.LogFunction.Security, "The User Profile Claim Mapping {Mapping} Is Not Specified Correctly. It Should Be In The Format 'ClaimType:ProfileName'.", mapping);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ namespace Oqtane.Pages
|
|||||||
var pageModules = _pageModules.GetPageModules(_alias.SiteId);
|
var pageModules = _pageModules.GetPageModules(_alias.SiteId);
|
||||||
foreach (var page in _pages.GetPages(_alias.SiteId))
|
foreach (var page in _pages.GetPages(_alias.SiteId))
|
||||||
{
|
{
|
||||||
if (_userPermissions.IsAuthorized(null, PermissionNames.View, page.PermissionList))
|
if (_userPermissions.IsAuthorized(null, PermissionNames.View, page.PermissionList) && page.IsNavigation)
|
||||||
{
|
{
|
||||||
sitemap.Add(new Sitemap { Url = _alias.Protocol + _alias.Name + Utilities.NavigateUrl(_alias.Path, page.Path, ""), ModifiedOn = page.ModifiedOn });
|
sitemap.Add(new Sitemap { Url = _alias.Protocol + _alias.Name + Utilities.NavigateUrl(_alias.Path, page.Path, ""), ModifiedOn = page.ModifiedOn });
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user