Bug Fix #82: Dereference managed groups on delete

Managed Group references (and subscriptions) continued to exist after
Device Profiles, Device Batches and Document Templates were deleted.
This prevented assigning the same group to another
Profile/Batch/Template without first recycling the IIS App Pool.
This commit is contained in:
Gary Sharp
2015-02-02 19:23:27 +11:00
parent 23db0b6111
commit 50399f4f48
3 changed files with 33 additions and 22 deletions
@@ -1,17 +1,17 @@
using System;
using System.Collections.Concurrent;
using System.Linq;
using System.Web;
using Disco.BI.DocumentTemplateBI;
using Disco.BI.DocumentTemplateBI.ManagedGroups;
using Disco.BI.Expressions;
using Disco.Data.Repository;
using Disco.Models.BI.DocumentTemplates;
using Disco.Models.Repository;
using System.Collections;
using System.Collections.Generic;
using Disco.Services.Interop.ActiveDirectory;
using iTextSharp.text.pdf;
using Disco.BI.Expressions;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using Disco.BI.DocumentTemplateBI;
using System.Linq;
namespace Disco.BI.Extensions
{
@@ -273,6 +273,10 @@ namespace Disco.BI.Extensions
a.DocumentTemplate = null;
}
// Remove Linked Group
ActiveDirectory.Context.ManagedGroups.Remove(DocumentTemplateDevicesManagedGroup.GetKey(dt));
ActiveDirectory.Context.ManagedGroups.Remove(DocumentTemplateUsersManagedGroup.GetKey(dt));
// Delete SubTypes
dt.JobSubTypes.Clear();