/// <summary> /// <para>Returns the logical union between two <see cref='System.Net.PeerToPeer.PnrpPermission'/> instances.</para> /// </summary> public override IPermission Union(IPermission target) { // Pattern suggested by Security engine if (target == null) { return(this.Copy()); } PnrpPermission other = target as PnrpPermission; if (other == null) { throw new ArgumentException(SR.GetString(SR.PnrpPermission_CantUnionWithNonPnrpPermission), "target"); } return(new PnrpPermission(m_noRestriction || other.m_noRestriction)); }
/// <summary> /// <para>Compares two <see cref='System.Net.PeerToPeer.PnrpPermission'/> instances.</para> /// </summary> public override bool IsSubsetOf(IPermission target) { // Pattern suggested by Security engine if (target == null) { return(m_noRestriction == false); } PnrpPermission other = target as PnrpPermission; if (other == null) { throw new ArgumentException(SR.GetString(SR.PnrpPermission_TargetNotAPnrpPermission), "target"); } //Here is the matrix of result based on m_noRestriction for me and she // me.noRestriction she.noRestriction me.isSubsetOf(she) // 0 0 1 // 0 1 1 // 1 0 0 // 1 1 1 return(!m_noRestriction || other.m_noRestriction); }
/// <summary> /// <para>Returns the logical intersection between two <see cref='System.Net.PeerToPeer.PnrpPermission'/> instances.</para> /// </summary> public override IPermission Intersect(IPermission target) { // Pattern suggested by Security engine if (target == null) { return(null); } PnrpPermission other = target as PnrpPermission; if (other == null) { throw new ArgumentException(SR.GetString(SR.PnrpPermission_CantIntersectWithNonPnrpPermission), "target"); } // return null if resulting permission is restricted and empty // Hence, the only way for a bool permission will be. if (this.m_noRestriction && other.m_noRestriction) { return(new PnrpPermission(true)); } return(null); }