Exemplo n.º 1
0
        public override bool IsSubsetOf(IPermission target)
        {
            PrintingPermission pp = Cast(target);

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

            return(_Level <= pp.Level);
        }
Exemplo n.º 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));
        }
Exemplo n.º 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);
        }
Exemplo n.º 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));
        }