예제 #1
0
        public override bool IsSubsetOf(IPermission target)
        {
            PrintingPermission pp = Cast(target);

            if (pp == null)
            {
                return(IsEmpty());
            }

            return(_Level <= pp.Level);
        }
예제 #2
0
        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));
        }
예제 #3
0
        private PrintingPermission Cast(IPermission target)
        {
            if (target == null)
            {
                return(null);
            }

            PrintingPermission pp = (target as PrintingPermission);

            if (pp == null)
            {
                ThrowInvalidPermission(target, typeof(PrintingPermission));
            }

            return(pp);
        }
예제 #4
0
        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));
        }