/// <summary> /// Configures a domain configuration. /// </summary> /// <param name="configuration"> /// A domain configuration. /// </param> /// <param name="type"> /// The domain type on which this attribute was placed. /// </param> public override void Configure( DomainConfiguration configuration, Type type) { var permission = DomainPermission.CreateDeny( this.PermissionType, this.To, this.OnNamespace, this.On, this.OnChild); configuration.AddPermission(permission); }
/// <summary> /// Adds a domain permission to a domain configuration. /// </summary> /// <param name="configuration"> /// A domain configuration. /// </param> /// <param name="permission"> /// A domain permission. /// </param> public static void AddPermission( this DomainConfiguration configuration, DomainPermission permission) { Ensure.NotNull(configuration, "configuration"); Ensure.NotNull(permission, "permission"); var permissions = configuration.GetProperty<List<DomainPermission>>(Permissions); if (permissions == null) { permissions = new List<DomainPermission>(); configuration.SetProperty(Permissions, permissions); } permissions.Add(permission); }
/// <summary> /// Adds a domain permission to a domain configuration. /// </summary> /// <param name="configuration"> /// A domain configuration. /// </param> /// <param name="permission"> /// A domain permission. /// </param> public static void AddPermission( this DomainConfiguration configuration, DomainPermission permission) { Ensure.NotNull(configuration, "configuration"); Ensure.NotNull(permission, "permission"); var permissions = configuration.GetProperty <List <DomainPermission> >(Permissions); if (permissions == null) { permissions = new List <DomainPermission>(); configuration.SetProperty(Permissions, permissions); } permissions.Add(permission); }