|
@@ -0,0 +1,50 @@
|
|
|
+using com.sun.org.apache.xpath.@internal.axes;
|
|
|
+using com.sun.security.ntlm;
|
|
|
+using com.sun.xml.@internal.bind.annotation;
|
|
|
+using Comal.Classes;
|
|
|
+using InABox.Clients;
|
|
|
+using InABox.Core;
|
|
|
+using InABox.DynamicGrid;
|
|
|
+using System;
|
|
|
+using System.Collections.Generic;
|
|
|
+using System.Linq;
|
|
|
+using System.Text;
|
|
|
+using System.Threading.Tasks;
|
|
|
+
|
|
|
+namespace PRSDesktop
|
|
|
+{
|
|
|
+ public class SecurityGroupUserGrid : DynamicOneToManyGrid<SecurityGroup, User>
|
|
|
+ {
|
|
|
+ public SecurityGroupUserGrid()
|
|
|
+ {
|
|
|
+ Options.BeginUpdate()
|
|
|
+ .Clear()
|
|
|
+ .AddRange(DynamicGridOption.AddRows)
|
|
|
+ .AddRange(DynamicGridOption.DeleteRows)
|
|
|
+ .AddRange(DynamicGridOption.MultiSelect)
|
|
|
+ .EndUpdate();
|
|
|
+ }
|
|
|
+
|
|
|
+ protected override void DoAdd()
|
|
|
+ {
|
|
|
+ var IDs = Items.Select(x => x.ID).ToArray();
|
|
|
+
|
|
|
+ var filters = new Filters<User>();
|
|
|
+ filters.Add(LookupFactory.DefineFilter<User>());
|
|
|
+ filters.Add(new Filter<User>(x => x.ID).NotInList(IDs));
|
|
|
+
|
|
|
+ var dlg = new MultiSelectDialog<User>(filters.Combine(), null, true);
|
|
|
+ if (dlg.ShowDialog())
|
|
|
+ {
|
|
|
+ SaveItems(dlg.Items());
|
|
|
+ Refresh(false, true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ protected override void OnDeleteItem(User item)
|
|
|
+ {
|
|
|
+ item.SecurityGroup.ID = Guid.Empty;
|
|
|
+ new Client<User>().Save(item, "Cleared security group");
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|