Package org.openengsb.core.api.security.model

Examples of org.openengsb.core.api.security.model.Permission


    }

    @Test
    public void testStoreUserPermission_shouldBeStored() throws Exception {
        userManager.createUser("admin2");
        Permission permission = new TestPermission(Access.GRANTED);
        userManager.addPermissionToUser("admin2", permission);
        Collection<Permission> userPermissions =
            userManager.getPermissionsForUser("admin2");
        assertThat(userPermissions, hasItem(equalTo(permission)));
    }
View Full Code Here


    }

    @Test
    public void testStoreUserPermissionAndDeleteAgain_shouldBeDeleted() throws Exception {
        userManager.createUser("admin2");
        Permission permission = new TestPermission(Access.GRANTED);
        userManager.addPermissionToUser("admin2", permission);
        userManager.removePermissionFromUser("admin2", permission);
        Collection<Permission> userPermissions =
            userManager.getPermissionsForUser("admin2");
        assertThat(userPermissions, not(hasItem(equalTo(permission))));
View Full Code Here

    }

    @Test
    public void testStoreUserPermissionSet_shouldBeStored() throws Exception {
        userManager.createUser("admin2");
        Permission permission = new TestPermission(Access.GRANTED);
        userManager.createPermissionSet("ROLE_ADMIN", permission);
        userManager.addPermissionSetToUser("admin2", "ROLE_ADMIN");
        Collection<String> userPermissions = userManager.getPermissionSetsFromUser("admin2");
        assertThat(userPermissions, hasItem("ROLE_ADMIN"));
    }
View Full Code Here

    }

    @Test
    public void testStoreUserPermissionSet_shouldGrantAllPermissions() throws Exception {
        userManager.createUser("admin2");
        Permission permission = new TestPermission(Access.GRANTED);
        userManager.createPermissionSet("ROLE_ADMIN", permission);
        userManager.addPermissionSetToUser("admin2", "ROLE_ADMIN");
        Collection<Permission> allUserPermissions = userManager.getAllPermissionsForUser("admin2");
        assertThat(allUserPermissions, hasItem(permission));
    }
View Full Code Here

    }

    @Test
    public void testAddPermissionSetToSet_shouldGrantAllPermissions() throws Exception {
        userManager.createUser("admin2");
        Permission permission = new TestPermission(Access.GRANTED);
        userManager.createPermissionSet("ROLE_PROJECTMEMBER", permission);
        userManager.createPermissionSet("ROLE_MANAGER");
        userManager.addPermissionSetToPermissionSet("ROLE_MANAGER", "ROLE_PROJECTMEMBER");
        userManager.addPermissionSetToUser("admin2", "ROLE_MANAGER");
        Collection<Permission> allUserPermissions = userManager.getAllPermissionsForUser("admin2");
View Full Code Here

    }

    @Test
    @Ignore
    public void testGetPermissionsForUser_shouldReturnPermissions() throws Exception {
        Permission permission = new TestPermission(Access.GRANTED);
        userManager.createUser(testUser1);
        userManager.addPermissionToUser(testUser1, permission);
        Collection<Permission> permissions = userManager.getPermissionsForUser(testUser1);
        assertThat(permissions, hasItem(permission));
        assertThat(permissions.size(), is(1));
View Full Code Here

    @Test
    @Ignore
    public void testCreatePermissionSet_shouldPersistSetAndPreserveOrder() throws Exception {
        String set = "SetA";
        Permission p1 = new TestPermission(Access.GRANTED);
        Permission p2 = new TestPermission(Access.DENIED);
        Permission p3 = new TestPermission(Access.ABSTAINED);
        Permission p4 = new TestPermission(Access.GRANTED);
        Permission[] permissions = new Permission[] { p1, p2, p3, p4 };
        userManager.createPermissionSet(set, permissions);
        List<Permission> result = new LinkedList<Permission>(userManager.getPermissionsFromPermissionSet(set));
        assertThat(result.get(0), is(p1));
        assertThat(result.get(1), is(p2));
View Full Code Here

    }

    @Test(expected = UserNotFoundException.class)
    @Ignore
    public void testAddPermissionsToNonexistingUser_expectedUserNotFoundException() throws Exception {
        Permission p = new TestPermission(Access.GRANTED);
        userManager.addPermissionToUser("nonExistingUser", p);
    }
View Full Code Here

    }

    @Test(expected = PermissionSetNotFoundException.class)
    @Ignore
    public void testAddPermissionsToNonexistingSet_expectedPermissionSetNotFoundException() throws Exception {
        Permission p = new TestPermission(Access.GRANTED);
        userManager.addPermissionToSet("nonExistingSet", p);
    }
View Full Code Here

        return (Permission) BeanUtilsExtended.createBeanFromAttributeMap(type, values);
    }

    @Override
    public String toString() {
        Permission permission = toPermission();
        return StringUtils.isNotBlank(permission.describe()) ? permission.describe() : permission.toString();
    }
View Full Code Here

TOP

Related Classes of org.openengsb.core.api.security.model.Permission

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.