using System.Linq; namespace InABox.Core { public abstract class BaseSecurityDescriptor : ISecurityDescriptor where T : LicenseToken { public virtual bool Visible => SecurityDescriptorUtils.IsSupported(GetType()); public virtual string Category => ""; public string Type => typeof(T).GetCaption(); //SecurityDescriptorUtils.Type(this.GetType()); public string Code => SecurityDescriptorUtils.Code(GetType()); public string Description => SecurityDescriptorUtils.Description(GetType()); public abstract bool Value { get; } public bool HasScope(SecurityDescriptorScope scope) { var attribute = GetType().GetCustomAttributes(typeof(SecurityDescriptorScopeAttribute), true).FirstOrDefault() as SecurityDescriptorScopeAttribute; if (attribute == null) return true; return attribute.HasScope(scope); } } }