You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
764 B
28 lines
764 B
5 years ago
|
using FluentValidation.Validators;
|
||
|
using NzbDrone.Common.Disk;
|
||
|
|
||
|
namespace NzbDrone.Core.Validation
|
||
|
{
|
||
4 years ago
|
public class FolderChmodValidator : PropertyValidator
|
||
5 years ago
|
{
|
||
|
private readonly IDiskProvider _diskProvider;
|
||
|
|
||
4 years ago
|
public FolderChmodValidator(IDiskProvider diskProvider)
|
||
5 years ago
|
{
|
||
|
_diskProvider = diskProvider;
|
||
|
}
|
||
|
|
||
2 years ago
|
protected override string GetDefaultMessageTemplate() => "Must contain a valid Unix permissions octal";
|
||
|
|
||
5 years ago
|
protected override bool IsValid(PropertyValidatorContext context)
|
||
|
{
|
||
|
if (context.PropertyValue == null)
|
||
|
{
|
||
|
return false;
|
||
|
}
|
||
|
|
||
4 years ago
|
return _diskProvider.IsValidFolderPermissionMask(context.PropertyValue.ToString());
|
||
5 years ago
|
}
|
||
|
}
|
||
|
}
|