Download Support (#298)
* Implemented the ability to download files (series, volume, chapter) * Added RBS checks to ensure user is either an admin or has download role * Added the ability to change a users feature RBS. Changed the Role seed to use reflection
This commit is contained in:
parent
4ae9f078b0
commit
16a77fa8d6
17 changed files with 262 additions and 45 deletions
|
@ -1,6 +1,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using API.Constants;
|
||||
using API.Entities;
|
||||
|
@ -15,11 +16,13 @@ namespace API.Data
|
|||
{
|
||||
public static async Task SeedRoles(RoleManager<AppRole> roleManager)
|
||||
{
|
||||
var roles = new List<AppRole>
|
||||
{
|
||||
new() {Name = PolicyConstants.AdminRole},
|
||||
new() {Name = PolicyConstants.PlebRole}
|
||||
};
|
||||
var roles = typeof(PolicyConstants)
|
||||
.GetFields(BindingFlags.Public | BindingFlags.Static)
|
||||
.Where(f => f.FieldType == typeof(string))
|
||||
.ToDictionary(f => f.Name,
|
||||
f => (string) f.GetValue(null)).Values
|
||||
.Select(policyName => new AppRole() {Name = policyName})
|
||||
.ToList();
|
||||
|
||||
foreach (var role in roles)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue