Finding the issue in the validator of the local repository's edit

This commit is contained in:
Zoe Roux 2021-01-24 23:11:26 +01:00
parent 3a2294ed2d
commit 4a15fa8363
5 changed files with 6 additions and 4 deletions

View File

@ -136,7 +136,6 @@ publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj

View File

@ -191,6 +191,8 @@ namespace Kyoo
throw new ArgumentNullException(nameof(obj));
if (genericType == null)
throw new ArgumentNullException(nameof(genericType));
if (!genericType.IsGenericType)
throw new ArgumentException($"{nameof(genericType)} is not a generic type.");
IEnumerable<Type> types = genericType.IsInterface
? obj.GetType().GetInterfaces()

View File

@ -231,8 +231,10 @@ namespace Kyoo.Controllers
foreach (PropertyInfo property in typeof(T).GetProperties()
.Where(x => typeof(IEnumerable).IsAssignableFrom(x.PropertyType)
&& !typeof(string).IsAssignableFrom(x.PropertyType)))
&& !typeof(string).IsAssignableFrom(x.PropertyType))
{
// TODO For DE classes (like ShowDE), the basic ienumerable should not be verified (for exemple, GenreLinks should be checked & not Genres).
Console.WriteLine($"Validating {property.Name}");
object value = property.GetValue(resource);
if (value == null || value is ICollection || Utility.IsOfGenericType(value, typeof(ICollection<>)))
continue;

1
Kyoo/.gitignore vendored
View File

@ -138,7 +138,6 @@ publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj

View File

@ -112,7 +112,7 @@ namespace Kyoo
services.AddAuthorization(options =>
{
AuthorizationPolicyBuilder scheme = new AuthorizationPolicyBuilder(IdentityConstants.ApplicationScheme, JwtBearerDefaults.AuthenticationScheme);
AuthorizationPolicyBuilder scheme = new(IdentityConstants.ApplicationScheme, JwtBearerDefaults.AuthenticationScheme);
options.DefaultPolicy = scheme.RequireAuthenticatedUser().Build();
string[] permissions = {"Read", "Write", "Play", "Admin"};