This commit is contained in:
zel
2025-02-24 09:32:37 +08:00
parent c1ce758117
commit c1a6c7e618

View File

@@ -30,7 +30,7 @@ namespace ZelWiki
#region Current Page.
/// <summary>
/// Custom page title set by a call to @@Title("...")
///
/// </summary>
public string? PageTitle { get; set; }
public bool ShouldCreatePage { get; set; }
@@ -40,7 +40,7 @@ namespace ZelWiki
public ProcessingInstructionCollection PageInstructions { get; set; } = new();
/// <summary>
/// The "page" here is more of a "mock page", we use the name for various stuff.
///
/// </summary>
public IPage Page { get; set; } = new Models.DataModels.Page() { Name = GlobalConfiguration.Name };
@@ -97,11 +97,6 @@ namespace ZelWiki
UserTheme = ConfigurationRepository.GetAllThemes().SingleOrDefault(o => o.Name == Profile.Theme) ?? GlobalConfiguration.SystemTheme;
IsAuthenticated = true;
}
else
{
//User is signed in, but does not have a profile.
//This likely means that the user has authenticated externally, but has yet to complete the signup process.
}
}
}
catch (Exception ex)
@@ -117,12 +112,6 @@ namespace ZelWiki
}
}
/// <summary>
/// Sets the current context pageId and optionally the revision.
/// </summary>
/// <param name="pageId"></param>
/// <param name="revision"></param>
/// <exception cref="Exception"></exception>
public void SetPageId(int? pageId, int? revision = null)
{
Page = new Models.DataModels.Page();
@@ -184,12 +173,12 @@ namespace ZelWiki
}
/// <summary>
/// Is the current user (or anonymous) allowed to view?
///
/// </summary>
public bool CanView => true;
/// <summary>
/// Is the current user allowed to edit?
///
/// </summary>
public bool CanEdit
{
@@ -209,25 +198,25 @@ namespace ZelWiki
}
/// <summary>
/// Is the current user allowed to perform administrative functions?
///
/// </summary>
public bool CanAdmin =>
IsAuthenticated && IsMemberOf(Role, [Constants.Roles.Administrator]);
/// <summary>
/// Is the current user allowed to moderate content (such as delete comments, and view moderation tools)?
///
/// </summary>
public bool CanModerate =>
IsAuthenticated && IsMemberOf(Role, [Constants.Roles.Administrator, Constants.Roles.Moderator]);
/// <summary>
/// Is the current user allowed to create pages?
///
/// </summary>
public bool CanCreate =>
IsAuthenticated && IsMemberOf(Role, [Constants.Roles.Administrator, Constants.Roles.Contributor, Constants.Roles.Moderator]);
/// <summary>
/// Is the current user allowed to delete unprotected pages?
///
/// </summary>
public bool CanDelete
{