mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-30 19:32:55 -04:00
Fixed: Preserve setgid when applying unix permissions Signed-off-by: Robin Dadswell <robin@dadswell.email>
27 lines
717 B
C#
27 lines
717 B
C#
using FluentValidation.Validators;
|
|
using NzbDrone.Common.Disk;
|
|
|
|
namespace NzbDrone.Core.Validation
|
|
{
|
|
public class FolderChmodValidator : PropertyValidator
|
|
{
|
|
private readonly IDiskProvider _diskProvider;
|
|
|
|
public FolderChmodValidator(IDiskProvider diskProvider)
|
|
: base("Must contain a valid Unix permissions octal")
|
|
{
|
|
_diskProvider = diskProvider;
|
|
}
|
|
|
|
protected override bool IsValid(PropertyValidatorContext context)
|
|
{
|
|
if (context.PropertyValue == null)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
return _diskProvider.IsValidFolderPermissionMask(context.PropertyValue.ToString());
|
|
}
|
|
}
|
|
}
|