Feature: Device Batch Attachments

allows for attachments to be uploaded and associated with Device Batches
This commit is contained in:
Gary Sharp
2020-11-29 16:41:20 +11:00
parent e531ffe2b7
commit 28e5901929
26 changed files with 2153 additions and 320 deletions
@@ -38,6 +38,21 @@ namespace Disco.Services
DocumentTemplateManagedGroups.TriggerDeviceAttachmentDeleted(Database, attachmentId, documentTemplateId, deviceSerialNumber);
}
public static bool CanDelete(this DeviceBatchAttachment attachment)
{
if (UserService.CurrentAuthorization.Has(Claims.Config.DeviceBatch.Configure))
return true;
return false;
}
public static void OnDelete(this DeviceBatchAttachment attachment, DiscoDataContext Database)
{
if (!attachment.CanDelete())
throw new InvalidOperationException("Deletion of Attachment is Denied");
attachment.RepositoryDelete(Database);
Database.DeviceBatchAttachments.Remove(attachment);
}
public static bool CanDelete(this JobAttachment ja)
{
if (UserService.CurrentAuthorization.Has(Claims.Job.Actions.RemoveAnyAttachments))