public override IPermission Intersect(IPermission target) { DataProtectionPermission dp = Cast(target); if (dp == null) { return(null); } if (this.IsUnrestricted() && dp.IsUnrestricted()) { return(new DataProtectionPermission(PermissionState.Unrestricted)); } if (this.IsUnrestricted()) { return(dp.Copy()); } if (dp.IsUnrestricted()) { return(this.Copy()); } return(new DataProtectionPermission(_flags & dp._flags)); }
public override IPermission Union(IPermission target) { DataProtectionPermission dp = Cast(target); if (dp == null) { return(this.Copy()); } if (this.IsUnrestricted() || dp.IsUnrestricted()) { return(new SecurityPermission(PermissionState.Unrestricted)); } return(new DataProtectionPermission(_flags | dp._flags)); }
public override bool IsSubsetOf(IPermission target) { DataProtectionPermission dp = Cast(target); if (dp == null) { return(_flags == DataProtectionPermissionFlags.NoFlags); } if (dp.IsUnrestricted()) { return(true); } if (this.IsUnrestricted()) { return(false); } return((_flags & ~dp._flags) == 0); }