public override IPermission Copy() { CustomPerssion copy = new CustomPerssion(PermissionState.None); if (this.unrestricted) { copy.unrestricted = true; } else { copy.unrestricted = false; } return(copy); }
public override bool IsSubsetOf(IPermission target) { if (target == null) { return(!this.unrestricted); } try { CustomPerssion passedPermission = (CustomPerssion)target; if (!this.unrestricted == passedPermission.unrestricted) { return(true); } else { return(false); } } catch (InvalidCastException) { throw new ArgumentException("Argument_wrongType", this.GetType().FullName); } }
public override IPermission Intersect(IPermission target) { try { if (target == null) { return(null); } CustomPerssion PassedPermission = (CustomPerssion)target; if (!PassedPermission.IsUnrestricted()) { return(PassedPermission); } else { return(this.Copy()); } } catch (InvalidCastException) { throw new ArgumentException("Argument_wrongType", this.GetType().FullName); } }