public override bool IsSubsetOf(IPermission target) { PrintingPermission pp = Cast(target); if (pp == null) { return(IsEmpty()); } return(_Level <= pp.Level); }
public override IPermission Intersect(IPermission target) { PrintingPermission pp = Cast(target); if ((pp == null) || IsEmpty() || pp.IsEmpty()) { return(null); } PrintingPermissionLevel level = (_Level <= pp.Level) ? _Level : pp.Level; return(new PrintingPermission(level)); }
private PrintingPermission Cast(IPermission target) { if (target == null) { return(null); } PrintingPermission pp = (target as PrintingPermission); if (pp == null) { ThrowInvalidPermission(target, typeof(PrintingPermission)); } return(pp); }
public override IPermission Union(IPermission target) { PrintingPermission pp = Cast(target); if (pp == null) { return(new PrintingPermission(_Level)); } if (IsUnrestricted() || pp.IsUnrestricted()) { return(new PrintingPermission(PrintingPermissionLevel.AllPrinting)); } if (IsEmpty() && pp.IsEmpty()) { return(null); } PrintingPermissionLevel level = (_Level > pp.Level) ? _Level : pp.Level; return(new PrintingPermission(level)); }