Package org.drools.guvnor.server.security

Examples of org.drools.guvnor.server.security.RoleBasedPermissionResolver


        // Mock up SEAM contexts
        Map<String, Object> application = new HashMap<String, Object>();
        Lifecycle.beginApplication( application );
        Lifecycle.beginCall();
        MockIdentity midentity = new MockIdentity();
        RoleBasedPermissionResolver resolver = new RoleBasedPermissionResolver();
        resolver.setEnableRoleBasedAuthorization( true );
        midentity.addPermissionResolver( resolver );

        Contexts.getSessionContext().set( "org.jboss.seam.security.roleBasedPermissionResolver",
                                          resolver );
        Contexts.getSessionContext().set( "org.jboss.seam.security.identity",
                                          midentity );
        Contexts.getSessionContext().set( "org.drools.guvnor.client.rpc.RepositoryService",
                                          impl );

        List<RoleBasedPermission> pbps = new ArrayList<RoleBasedPermission>();
        pbps.add( new RoleBasedPermission( "jervis",
                                           RoleTypes.PACKAGE_READONLY,
                                           "packagename",
                                           null ) );
        MockRoleBasedPermissionStore store = new MockRoleBasedPermissionStore( pbps );
        Contexts.getSessionContext().set( "org.drools.guvnor.server.security.RoleBasedPermissionStore",
                                          store );

        // Put permission list in session.
        RoleBasedPermissionManager testManager = new RoleBasedPermissionManager();
        testManager.create();
        Contexts.getSessionContext().set( "roleBasedPermissionManager",
                                          testManager );

        Capabilities c = impl.getUserCapabilities();
        assertTrue( c.list.size() == 1 );

        //now lets give them no permissions
        pbps.clear();
        try {
            impl.getUserCapabilities();
            fail( "should not be allowed as there are no permissions" );
        } catch ( AuthorizationException e ) {
            assertNotNull( e.getMessage() );
            assertTrue( midentity.loggoutCalled );
        }

        //now lets turn off the role based stuff
        resolver.setEnableRoleBasedAuthorization( false );
        impl.getUserCapabilities(); // should not blow up !

        Lifecycle.endApplication();
    }
View Full Code Here


            // Mock up SEAM contexts
            //            Map<String, Object> application = new HashMap<String, Object>();
            //            Lifecycle.beginApplication( application );
            //            Lifecycle.beginCall();
            MockIdentity midentity = new MockIdentity();
            RoleBasedPermissionResolver resolver = new RoleBasedPermissionResolver();
            resolver.setEnableRoleBasedAuthorization( true );
            midentity.addPermissionResolver( resolver );
            midentity.create();

            Contexts.getSessionContext().set( "org.jboss.seam.security.identity",
                                              midentity );
View Full Code Here

            // Mock up SEAM contexts
            Map<String, Object> application = new HashMap<String, Object>();
            Lifecycle.beginApplication( application );
            Lifecycle.beginCall();
            MockIdentity midentity = new MockIdentity();
            RoleBasedPermissionResolver resolver = new RoleBasedPermissionResolver();
            resolver.setEnableRoleBasedAuthorization( true );
            midentity.addPermissionResolver( resolver );
            midentity.create();

            Contexts.getSessionContext().set( "org.jboss.seam.security.identity",
                                              midentity );
View Full Code Here

            // Mock up SEAM contexts
            Map<String, Object> application = new HashMap<String, Object>();
            Lifecycle.beginApplication( application );
            Lifecycle.beginCall();
            MockIdentity midentity = new MockIdentity();
            RoleBasedPermissionResolver resolver = new RoleBasedPermissionResolver();
            resolver.setEnableRoleBasedAuthorization( false );
            midentity.addPermissionResolver( resolver );
            midentity.create();

            Contexts.getSessionContext().set( "org.jboss.seam.security.identity",
                                              midentity );
View Full Code Here

            // Mock up SEAM contexts
            Map<String, Object> application = new HashMap<String, Object>();
            Lifecycle.beginApplication( application );
            Lifecycle.beginCall();
            MockIdentity midentity = new MockIdentity();
            RoleBasedPermissionResolver resolver = new RoleBasedPermissionResolver();
            resolver.setEnableRoleBasedAuthorization( true );
            midentity.addPermissionResolver( resolver );
            midentity.create();

            Contexts.getSessionContext().set( "org.jboss.seam.security.identity",
                                              midentity );
View Full Code Here

            // Mock up SEAM contexts
            Map<String, Object> application = new HashMap<String, Object>();
            Lifecycle.beginApplication( application );
            Lifecycle.beginCall();
            MockIdentity midentity = new MockIdentity();
            RoleBasedPermissionResolver resolver = new RoleBasedPermissionResolver();
            resolver.setEnableRoleBasedAuthorization( true );
            midentity.addPermissionResolver( resolver );
            midentity.create();

            Contexts.getSessionContext().set( "org.jboss.seam.security.identity",
                                              midentity );
View Full Code Here

            // Mock up SEAM contexts
            Map<String, Object> application = new HashMap<String, Object>();
            Lifecycle.beginApplication( application );
            Lifecycle.beginCall();
            MockIdentity midentity = new MockIdentity();
            RoleBasedPermissionResolver resolver = new RoleBasedPermissionResolver();
            resolver.setEnableRoleBasedAuthorization( true );
            midentity.addPermissionResolver( resolver );
            midentity.create();

            Contexts.getSessionContext().set( "org.jboss.seam.security.identity",
                                              midentity );
View Full Code Here

            // Mock up SEAM contexts
            Map<String, Object> application = new HashMap<String, Object>();
            Lifecycle.beginApplication( application );
            Lifecycle.beginCall();
            MockIdentity midentity = new MockIdentity();
            RoleBasedPermissionResolver resolver = new RoleBasedPermissionResolver();
            resolver.setEnableRoleBasedAuthorization( true );
            midentity.addPermissionResolver( resolver );
            midentity.create();

            Contexts.getSessionContext().set( "org.jboss.seam.security.identity",
                                              midentity );
View Full Code Here

            // Mock up SEAM contexts
            Map<String, Object> application = new HashMap<String, Object>();
            Lifecycle.beginApplication( application );
            Lifecycle.beginCall();
            MockIdentity midentity = new MockIdentity();
            RoleBasedPermissionResolver resolver = new RoleBasedPermissionResolver();
            resolver.setEnableRoleBasedAuthorization( true );
            midentity.addPermissionResolver( resolver );
            midentity.create();

            Contexts.getSessionContext().set( "org.jboss.seam.security.identity",
                                              midentity );
View Full Code Here

        // Mock up SEAM contexts
        Map<String, Object> application = new HashMap<String, Object>();
        Lifecycle.beginApplication( application );
        Lifecycle.beginCall();
        MockIdentity midentity = new MockIdentity();
        RoleBasedPermissionResolver resolver = new RoleBasedPermissionResolver();
        resolver.setEnableRoleBasedAuthorization( true );
        midentity.addPermissionResolver( resolver );
        midentity.create();

        Contexts.getSessionContext().set( "org.jboss.seam.security.identity",
                                          midentity );
View Full Code Here

TOP

Related Classes of org.drools.guvnor.server.security.RoleBasedPermissionResolver

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.