コード例 #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
ファイル: MBeanPermissionImpl.cs プロジェクト: yuzukwok/NetMX
 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
ファイル: MBeanPermissionImpl.cs プロジェクト: yuzukwok/NetMX
        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
ファイル: MBeanPermissionImpl.cs プロジェクト: yuzukwok/NetMX
 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)));
 }