mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-06-23 15:30:34 -04:00
* Added ReadingList age rating from all series and started on some unit tests for the new flows. * Wrote more unit tests for Reading Lists * Added ability to restrict user accounts to a given age rating via admin edit user modal and invite user. This commit contains all basic code, but no query modifications. * When updating a reading list's title via UI, explicitly check if there is an existing RL with the same title. * Refactored Reading List calculation to work properly in the flows it's invoked from. * Cleaned up an unused method * Promoted Collections no longer show tags where a Series exists within them that is above the user's age rating. * Collection search now respects age restrictions * Series Detail page now checks if the user has explicit access (as a user might bypass with direct url access) * Hooked up age restriction for dashboard activity streams. * Refactored some methods from Series Controller and Library Controller to a new Search Controller to keep things organized * Updated Search to respect age restrictions * Refactored all the Age Restriction queries to extensions * Related Series no longer show up if they are out of the age restriction * Fixed a bad mapping for the update age restriction api * Fixed a UI state change after updating age restriction * Fixed unit test * Added a migration for reading lists * Code cleanup
38 lines
1.2 KiB
C#
38 lines
1.2 KiB
C#
using System.Collections.Immutable;
|
|
|
|
namespace API.Constants;
|
|
|
|
/// <summary>
|
|
/// Role-based Security
|
|
/// </summary>
|
|
public static class PolicyConstants
|
|
{
|
|
/// <summary>
|
|
/// Admin User. Has all privileges
|
|
/// </summary>
|
|
public const string AdminRole = "Admin";
|
|
/// <summary>
|
|
/// Non-Admin User. Must be granted privileges by an Admin.
|
|
/// </summary>
|
|
public const string PlebRole = "Pleb";
|
|
/// <summary>
|
|
/// Used to give a user ability to download files from the server
|
|
/// </summary>
|
|
public const string DownloadRole = "Download";
|
|
/// <summary>
|
|
/// Used to give a user ability to change their own password
|
|
/// </summary>
|
|
public const string ChangePasswordRole = "Change Password";
|
|
/// <summary>
|
|
/// Used to give a user ability to bookmark files on the server
|
|
/// </summary>
|
|
public const string BookmarkRole = "Bookmark";
|
|
/// <summary>
|
|
/// Used to give a user ability to Change Restrictions on their account
|
|
/// </summary>
|
|
public const string ChangeRestrictionRole = "Change Restriction";
|
|
|
|
public static readonly ImmutableArray<string> ValidRoles =
|
|
ImmutableArray.Create(AdminRole, PlebRole, DownloadRole, ChangePasswordRole, BookmarkRole, ChangeRestrictionRole);
|
|
}
|