Beispiel #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();
                }
            }
        }
Beispiel #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))));
 }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #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);
     }
 }
Beispiel #7
0
 private MBeanCASPermission(MBeanPermissionImpl impl)
 {
     _impl = impl;
 }
Beispiel #8
0
 public MBeanCASPermission(string className, string memberName, ObjectName objectName, MBeanPermissionAction actions)
 {
     _impl = new MBeanPermissionImpl(className, memberName, objectName, actions);
 }
Beispiel #9
0
 public MBeanCASPermission(string name, MBeanPermissionAction actions)
 {
     _impl = new MBeanPermissionImpl(name, actions);
 }
Beispiel #10
0
 public MBeanCASPermission(PermissionState state)
 {
     _impl = new MBeanPermissionImpl(null, null, null, MBeanPermissionAction.All);
 }
 private MBeanCASPermission(MBeanPermissionImpl impl)
 {
     _impl = impl;
 }
 public MBeanCASPermission(string className, string memberName, ObjectName objectName, MBeanPermissionAction actions)
 {
     _impl = new MBeanPermissionImpl(className, memberName, objectName, actions);
 }
 public MBeanCASPermission(string name, MBeanPermissionAction actions)
 {
     _impl = new MBeanPermissionImpl(name, actions);
 }
 public MBeanCASPermission(PermissionState state)
 {
     _impl = new MBeanPermissionImpl(null, null, null, MBeanPermissionAction.All);
 }
 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;
     }
 }
 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)));
 }