Пример #1
0
        public void Demand()
        {
            _impl.VerifyAsNeeded();
            INetMXPrincipal principal = Thread.CurrentPrincipal as INetMXPrincipal;

            if (principal != null)
            {
                IEnumerable <MBeanPermission> heldPermissions = principal.Permissions;                //Thread.GetData(Thread.GetNamedDataSlot("NetMX.MBeanPermission"));
                if (heldPermissions != null)
                {
                    foreach (MBeanPermission held in heldPermissions)
                    {
                        held._impl.VerifyAsHeld();
                        MBeanPermissionImpl thisImpl = this._impl;
                        MBeanPermissionImpl heldImpl = held._impl;
                        if ((thisImpl.ClassName == null || heldImpl.ClassName == "" || thisImpl.ClassName == heldImpl.ClassName) &&
                            (thisImpl.MemberName == null || heldImpl.MemberName == "" || thisImpl.MemberName == heldImpl.MemberName) &&
                            (thisImpl.ObjectName == null || heldImpl.ObjectName.Apply(thisImpl.ObjectName)) &&
                            (thisImpl.Actions & heldImpl.Actions) == thisImpl.Actions
                            )
                        {
                            return;
                        }
                    }
                    throw new SecurityException();
                }
            }
        }
Пример #2
0
 public bool IsSubsetOf(MBeanPermissionImpl other)
 {
     VerifyAsNeeded();
     return
         ((other._className == null || this._className == other._className) &&
          (other._memberName == null || this._memberName == other._memberName) &&
          ((other._actions & this._actions) == this._actions) &&
          (other._objectName == null || (this._objectName != null && other._objectName.Apply(this._objectName))));
 }
Пример #3
0
        public override IPermission Union(IPermission target)
        {
            if (target == null)
            {
                return(this.Copy());
            }
            MBeanCASPermission other = target as MBeanCASPermission;

            if (other == null)
            {
                throw new ArgumentException("Incompatibile permission object.");
            }
            MBeanPermissionImpl result = _impl.Union(other._impl);

            return(result != null ? new MBeanCASPermission(result) : null);
        }
Пример #4
0
        public IPermission Intersect(IPermission target)
        {
            if (target == null)
            {
                return(null);
            }
            MBeanPermission other = target as MBeanPermission;

            if (other == null)
            {
                throw new ArgumentException("Incompatibile permission object.");
            }
            MBeanPermissionImpl result = _impl.Intersect(other._impl);

            return(result != null ? new MBeanPermission(result) : null);
        }
Пример #5
0
        public override bool Equals(object obj)
        {
            MBeanPermissionImpl other = obj as MBeanPermissionImpl;

            if (other == null)
            {
                return(false);
            }
            return((
                       (this._className == null && other._className == null) ||
                       (this._className != null && other._className != null && this._className.Equals(other._className))) &&
                   (
                       (this._memberName == null && other._memberName == null) ||
                       (this._memberName != null && other._memberName != null && this._memberName.Equals(other._memberName))) &&
                   (
                       (this._objectName == null && other._objectName == null) ||
                       (this._objectName != null && other._objectName != null && this._objectName.Equals(other._objectName))) &&
                   this._actions == other._actions);
        }
Пример #6
0
 public MBeanPermissionImpl Union(MBeanPermissionImpl target)
 {
     VerifyAsNeeded();
     if (target == null)
     {
         return(this.Copy());
     }
     if (this.IsSubsetOf(target))
     {
         return(target.Copy());
     }
     else if (target.IsSubsetOf(this))
     {
         return(this.Copy());
     }
     else
     {
         return(null);
     }
 }
Пример #7
0
 private MBeanCASPermission(MBeanPermissionImpl impl)
 {
     _impl = impl;
 }
Пример #8
0
 public MBeanCASPermission(string className, string memberName, ObjectName objectName, MBeanPermissionAction actions)
 {
     _impl = new MBeanPermissionImpl(className, memberName, objectName, actions);
 }
Пример #9
0
 public MBeanCASPermission(string name, MBeanPermissionAction actions)
 {
     _impl = new MBeanPermissionImpl(name, actions);
 }
Пример #10
0
 public MBeanCASPermission(PermissionState state)
 {
     _impl = new MBeanPermissionImpl(null, null, null, MBeanPermissionAction.All);
 }
Пример #11
0
 private MBeanCASPermission(MBeanPermissionImpl impl)
 {
     _impl = impl;
 }
Пример #12
0
 public MBeanCASPermission(string className, string memberName, ObjectName objectName, MBeanPermissionAction actions)
 {
     _impl = new MBeanPermissionImpl(className, memberName, objectName, actions);
 }
Пример #13
0
 public MBeanCASPermission(string name, MBeanPermissionAction actions)
 {
     _impl = new MBeanPermissionImpl(name, actions);
 }
Пример #14
0
 public MBeanCASPermission(PermissionState state)
 {
     _impl = new MBeanPermissionImpl(null, null, null, MBeanPermissionAction.All);
 }
Пример #15
0
 public MBeanPermissionImpl Union(MBeanPermissionImpl target)
 {
     VerifyAsNeeded();
     if (target == null)
     {
         return this.Copy();
     }
     if (this.IsSubsetOf(target))
     {
         return target.Copy();
     }
     else if (target.IsSubsetOf(this))
     {
         return this.Copy();
     }
     else
     {
         return null;
     }
 }
Пример #16
0
 public bool IsSubsetOf(MBeanPermissionImpl other)
 {
     VerifyAsNeeded();
     return
     (other._className == null || this._className == other._className) &&
     (other._memberName == null || this._memberName == other._memberName) &&
     ((other._actions & this._actions) == this._actions) &&
     (other._objectName == null || (this._objectName != null && other._objectName.Apply(this._objectName)));
 }