Beispiel #1
0
 public MBeanPermissionImpl(string className, string memberName, ObjectName objectName, MBeanPermissionAction actions)
 {
     _className  = className;
     _memberName = memberName;
     _objectName = objectName;
     _actions    = actions;
 }
 public MBeanPermissionImpl(string className, string memberName, ObjectName objectName, MBeanPermissionAction actions)
 {
     _className = className;
     _memberName = memberName;
     _objectName = objectName;
     _actions = actions;
 }
Beispiel #3
0
        private bool DoDenied(ThreadStart delSetup, ThreadStart del, string denyClassName, string denyMemberName, ObjectName denyObjectName, MBeanPermissionAction denyAction)
        {
            if (delSetup != null)
            {
                delSetup();
            }
            MBeanCASPermission perm = new MBeanCASPermission(denyClassName, denyMemberName, denyObjectName, denyAction);

            try
            {
                perm.Deny();
                del();
                return(false);
            }
            catch (SecurityException ex)
            {
                return(true);
            }
            finally
            {
                CodeAccessPermission.RevertDeny();
            }
        }
Beispiel #4
0
        private void DoPermissionTest(ThreadStart delSetup, ThreadStart del, string memberName, string otherMember, MBeanPermissionAction requiredRight, MBeanPermissionAction otherRight)
        {
            Assert.IsTrue(DoDenied(delSetup, del, null, null, null, requiredRight));
            Assert.IsTrue(DoDenied(delSetup, del, null, null, null, MBeanPermissionAction.All));
            Assert.IsFalse(DoDenied(delSetup, del, null, null, null, otherRight));

            Assert.IsFalse(DoDenied(delSetup, del, null, null, new ObjectName("dummy:type=ble"), MBeanPermissionAction.All));
            Assert.IsTrue(DoDenied(delSetup, del, null, null, new ObjectName("dummy:"), MBeanPermissionAction.All));

            if (memberName != null)
            {
                Assert.IsFalse(DoDenied(delSetup, del, null, otherMember, null, MBeanPermissionAction.All));
                Assert.IsTrue(DoDenied(delSetup, del, null, memberName, null, MBeanPermissionAction.All));
            }

            Assert.IsFalse(DoDenied(delSetup, del, typeof(int).AssemblyQualifiedName, null, null, MBeanPermissionAction.All));
            Assert.IsTrue(DoDenied(delSetup, del, typeof(DummyMBean).AssemblyQualifiedName, null, null, MBeanPermissionAction.All));
        }
Beispiel #5
0
 public MBeanCASPermission(string className, string memberName, ObjectName objectName, MBeanPermissionAction actions)
 {
     _impl = new MBeanPermissionImpl(className, memberName, objectName, actions);
 }
Beispiel #6
0
 public MBeanCASPermission(string name, MBeanPermissionAction actions)
 {
     _impl = new MBeanPermissionImpl(name, actions);
 }
 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);
 }
Beispiel #9
0
 public MBeanPermissionImpl(string name, MBeanPermissionAction actions)
 {
     ParseName(name, out _className, out _memberName, out _objectName);
     _actions = actions;
 }
Beispiel #10
0
        private static void TestPermissions(string className, string memberName, ObjectName name, MBeanPermissionAction action)
        {
            MBeanCASPermission casPerm = new MBeanCASPermission(className, memberName, name, action);

            casPerm.Demand();
            MBeanPermission perm = new MBeanPermission(className, memberName, name, action);

            perm.Demand();
        }
 public MBeanPermissionImpl(string name, MBeanPermissionAction actions)
 {
     ParseName(name, out _className, out _memberName, out _objectName);
     _actions = actions;
 }
Beispiel #12
0
 private static void TestPermissions(string className, string memberName, ObjectName name, MBeanPermissionAction action)
 {
     MBeanCASPermission casPerm = new MBeanCASPermission(className, memberName, name, action);
     casPerm.Demand();
     MBeanPermission perm = new MBeanPermission(className, memberName, name, action);
     perm.Demand();
 }
        private void DoPermissionTest(ThreadStart delSetup, ThreadStart del, string memberName, string otherMember, MBeanPermissionAction requiredRight, MBeanPermissionAction otherRight)
        {
            Assert.IsTrue(DoDenied(delSetup, del, null, null, null, requiredRight));
            Assert.IsTrue(DoDenied(delSetup, del, null, null, null, MBeanPermissionAction.All));
            Assert.IsFalse(DoDenied(delSetup, del, null, null, null, otherRight));

            Assert.IsFalse(DoDenied(delSetup, del, null, null, new ObjectName("dummy:type=ble"), MBeanPermissionAction.All));
            Assert.IsTrue(DoDenied(delSetup, del, null, null, new ObjectName("dummy:"), MBeanPermissionAction.All));

            if (memberName != null)
            {
                Assert.IsFalse(DoDenied(delSetup, del, null, otherMember, null, MBeanPermissionAction.All));
                Assert.IsTrue(DoDenied(delSetup, del, null, memberName, null, MBeanPermissionAction.All));
            }

            Assert.IsFalse(DoDenied(delSetup, del, typeof(int).AssemblyQualifiedName, null, null, MBeanPermissionAction.All));
            Assert.IsTrue(DoDenied(delSetup, del, typeof(DummyMBean).AssemblyQualifiedName, null, null, MBeanPermissionAction.All));
        }
 private bool DoDenied(ThreadStart delSetup, ThreadStart del, string denyClassName, string denyMemberName, ObjectName denyObjectName, MBeanPermissionAction denyAction)
 {
     if (delSetup != null)
     {
         delSetup();
     }
     MBeanCASPermission perm = new MBeanCASPermission(denyClassName, denyMemberName, denyObjectName, denyAction);
     try
     {
         perm.Deny();
         del();
         return false;
     }
     catch (SecurityException ex)
     {
         return true;
     }
     finally
     {
         CodeAccessPermission.RevertDeny();
     }
 }