change IsEffectiiveOrExpired to IsEffectiveAndNotExpired
This commit is contained in:
parent
8ca2f0a49f
commit
1cd4d6d0df
|
@ -59,7 +59,7 @@ namespace Oqtane.Themes.Controls
|
|||
logouturl = Utilities.TenantUrl(PageState.Alias, "/pages/logout/");
|
||||
|
||||
// verify anonymous users can access current page
|
||||
if (UserSecurity.IsAuthorized(null, PermissionNames.View, PageState.Page.PermissionList) && Utilities.IsEffectiveOrExpired(PageState.Page.EffectiveDate, PageState.Page.ExpiryDate))
|
||||
if (UserSecurity.IsAuthorized(null, PermissionNames.View, PageState.Page.PermissionList) && Utilities.IsEffectiveAndNotExpired(PageState.Page.EffectiveDate, PageState.Page.ExpiryDate))
|
||||
{
|
||||
returnurl = PageState.Route.PathAndQuery;
|
||||
}
|
||||
|
|
|
@ -256,7 +256,7 @@
|
|||
}
|
||||
|
||||
// check if user is authorized to view page
|
||||
if (page != null && UserSecurity.IsAuthorized(user, PermissionNames.View, page.PermissionList) && (Utilities.IsEffectiveOrExpired(page.EffectiveDate, page.ExpiryDate) || UserSecurity.IsAuthorized(user, PermissionNames.Edit, page.PermissionList)))
|
||||
if (page != null && UserSecurity.IsAuthorized(user, PermissionNames.View, page.PermissionList) && (Utilities.IsEffectiveAndNotExpired(page.EffectiveDate, page.ExpiryDate) || UserSecurity.IsAuthorized(user, PermissionNames.Edit, page.PermissionList)))
|
||||
{
|
||||
// edit mode
|
||||
if (user != null)
|
||||
|
|
|
@ -80,7 +80,7 @@ namespace Oqtane.Infrastructure
|
|||
if (page.ModifiedOn >= lastIndexedOn && !ignoreEntities.Contains(EntityNames.Page))
|
||||
{
|
||||
changed = true;
|
||||
removed = page.IsDeleted || !Utilities.IsEffectiveOrExpired(page.EffectiveDate, page.ExpiryDate);
|
||||
removed = page.IsDeleted || !Utilities.IsEffectiveAndNotExpired(page.EffectiveDate, page.ExpiryDate);
|
||||
|
||||
var searchContent = new SearchContent
|
||||
{
|
||||
|
@ -229,7 +229,7 @@ namespace Oqtane.Infrastructure
|
|||
searchContent.AdditionalContent = string.Empty;
|
||||
}
|
||||
|
||||
if (removed || pageModule.IsDeleted || !Utilities.IsEffectiveOrExpired(pageModule.EffectiveDate, pageModule.ExpiryDate))
|
||||
if (removed || pageModule.IsDeleted || !Utilities.IsEffectiveAndNotExpired(pageModule.EffectiveDate, pageModule.ExpiryDate))
|
||||
{
|
||||
searchContent.IsDeleted = true;
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ namespace Oqtane.Managers
|
|||
List<UserRole> userroles = _userRoles.GetUserRoles(userId, siteId).ToList();
|
||||
foreach (UserRole userrole in userroles)
|
||||
{
|
||||
if (Utilities.IsEffectiveOrExpired(userrole.EffectiveDate, userrole.ExpiryDate))
|
||||
if (Utilities.IsEffectiveAndNotExpired(userrole.EffectiveDate, userrole.ExpiryDate))
|
||||
{
|
||||
roles += userrole.Role.Name + ";";
|
||||
if (userrole.Role.Name == RoleNames.Host && !userroles.Any(item => item.Role.Name == RoleNames.Admin))
|
||||
|
|
|
@ -83,7 +83,7 @@ namespace Oqtane.Security
|
|||
var role = userRoles.FirstOrDefault(item => item.Role.Name == roleName);
|
||||
if (role != null)
|
||||
{
|
||||
if (Utilities.IsEffectiveOrExpired(role.EffectiveDate,role.ExpiryDate))
|
||||
if (Utilities.IsEffectiveAndNotExpired(role.EffectiveDate,role.ExpiryDate))
|
||||
{
|
||||
user.Roles += roleName + ";";
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ namespace Oqtane.Services
|
|||
var pages = new List<Page>();
|
||||
foreach (Page page in site.Pages)
|
||||
{
|
||||
if (!page.IsDeleted && _userPermissions.IsAuthorized(_accessor.HttpContext.User, PermissionNames.View, page.PermissionList) && (Utilities.IsEffectiveOrExpired(page.EffectiveDate, page.ExpiryDate) || _userPermissions.IsAuthorized(_accessor.HttpContext.User, PermissionNames.Edit, page.PermissionList)))
|
||||
if (!page.IsDeleted && _userPermissions.IsAuthorized(_accessor.HttpContext.User, PermissionNames.View, page.PermissionList) && (Utilities.IsEffectiveAndNotExpired(page.EffectiveDate, page.ExpiryDate) || _userPermissions.IsAuthorized(_accessor.HttpContext.User, PermissionNames.Edit, page.PermissionList)))
|
||||
{
|
||||
pages.Add(page);
|
||||
}
|
||||
|
@ -256,7 +256,7 @@ namespace Oqtane.Services
|
|||
var modules = new List<Module>();
|
||||
foreach (Module module in sitemodules.Where(item => (item.PageId == pageId || pageId == -1) && !item.IsDeleted && _userPermissions.IsAuthorized(_accessor.HttpContext.User, PermissionNames.View, item.PermissionList)))
|
||||
{
|
||||
if (Utilities.IsEffectiveOrExpired(module.EffectiveDate, module.ExpiryDate) || _userPermissions.IsAuthorized(_accessor.HttpContext.User, PermissionNames.Edit, module.PermissionList))
|
||||
if (Utilities.IsEffectiveAndNotExpired(module.EffectiveDate, module.ExpiryDate) || _userPermissions.IsAuthorized(_accessor.HttpContext.User, PermissionNames.Edit, module.PermissionList))
|
||||
{
|
||||
modules.Add(module);
|
||||
}
|
||||
|
|
|
@ -560,7 +560,7 @@ namespace Oqtane.Shared
|
|||
|
||||
return (localDateTime?.Date, localTime);
|
||||
}
|
||||
public static bool IsEffectiveOrExpired(DateTime? effectiveDate, DateTime? expiryDate)
|
||||
public static bool IsEffectiveAndNotExpired(DateTime? effectiveDate, DateTime? expiryDate)
|
||||
{
|
||||
DateTime currentUtcTime = DateTime.UtcNow;
|
||||
|
||||
|
@ -626,10 +626,10 @@ namespace Oqtane.Shared
|
|||
return $"{alias?.BaseUrl}{aliasUrl}{Constants.ContentUrl}{fileId}{method}";
|
||||
}
|
||||
|
||||
[Obsolete("IsPageModuleVisible(DateTime?, DateTime?) is deprecated. Use IsEffectiveOrExpired(DateTime?, DateTime?) instead.", false)]
|
||||
[Obsolete("IsPageModuleVisible(DateTime?, DateTime?) is deprecated. Use IsEffectiveAndNotExpired(DateTime?, DateTime?) instead.", false)]
|
||||
public static bool IsPageModuleVisible(DateTime? effectiveDate, DateTime? expiryDate)
|
||||
{
|
||||
return IsEffectiveOrExpired(effectiveDate, expiryDate);
|
||||
return IsEffectiveAndNotExpired(effectiveDate, expiryDate);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user