| 123456789101112131415161718192021222324252627282930313233343536373839 | using System.Linq;namespace InABox.Core{    [UserTracking(typeof(User))]    [Caption("Security Defaults")]    public class SecurityToken : Entity, IPersistent, IRemotable, ILicense<CoreLicense>    {        [NullEditor]        [EntityRelationship(DeleteAction.Cascade)]        public SecurityGroupLink Group { get; set; }        [ComboLookupEditor(typeof(SecurityRestrictionGenerator))]        public string Descriptor { get; set; }        [CheckBoxEditor]        public bool Enabled { get; set; }        protected override void Init()        {            base.Init();            Group = new SecurityGroupLink();        }        public override string ToString()        {            return Descriptor;        }        private class SecurityRestrictionGenerator : LookupGenerator<object>        {            public SecurityRestrictionGenerator(object[] items) : base(items)            {                foreach (var descriptor in Security.Descriptors.Where(x => x.HasScope(SecurityDescriptorScope.Group)))                    AddValue(descriptor.Code, descriptor.Description);            }        }    }}
 |