Package org.geoserver.security.impl

Examples of org.geoserver.security.impl.GeoServerRole


        GeoServerRoleStore store=null;
        try {
            store = new RoleStoreValidationWrapper(getRoleStore(roleServiceName));

            GeoServerRole role = store.getRoleByName(updated.getAuthority());

            role.getProperties().clear();
            role.getProperties().putAll(updated.getProperties());
            store.updateRole(role);

            String parentRoleName = get("form:parent").getDefaultModelObjectAsString();
            if (parentRoleName != null) {
                GeoServerRole parentRole = store.getRoleByName(parentRoleName);
                store.setParentRole(role, parentRole);
            }

            store.store();
        } catch (IOException ex) {
View Full Code Here


        SortedSet<GeoServerRole> allRoles = service.getRoles();
        SortedSet<GeoServerRole> roles = service.getRolesForUser(username);
        assertNotNull(roles);
        assertTrue(roles.size() > 0);
        assertTrue(roles.size() < allRoles.size());
        GeoServerRole role = roles.first();
        assertTrue(role.toString().startsWith("ROLE_"));
        assertEquals(role.toString().toUpperCase(), role.toString());
    }
View Full Code Here

    // some rest calls now require admin permissions
    private void doLogin() throws Exception {
        SecurityContextHolder.setContext(new SecurityContextImpl());
        List<GrantedAuthority> l = new ArrayList<GrantedAuthority>();
        l.add(new GeoServerRole("ROLE_ADMINISTRATOR"));
        SecurityContextHolder.getContext().setAuthentication(
                new UsernamePasswordAuthenticationToken("admin", "geoserver", l));
    }
View Full Code Here

    }
   
    private void checkUserNamesForRole(String roleName, int expected, boolean userFilter) throws IOException {
        createRoleService(userFilter);
       
        SortedSet<String> userNames = service.getUserNamesForRole(new GeoServerRole(roleName));
        assertNotNull(userNames);
        assertEquals(expected, userNames.size());
    }
View Full Code Here

        createRoleService(false);
       
        SortedSet<GeoServerRole> roles = service.getRoles();
        assertNotNull(roles);
        assertTrue(roles.size() > 0);
        GeoServerRole role = roles.first();
        assertTrue(role.toString().startsWith("ROLE_"));
        assertEquals(role.toString().toUpperCase(), role.toString());
    }
View Full Code Here

   
   

    @Override
    protected GeoServerRole getRemoveableObject() throws Exception{
        GeoServerRole role =  gaService.getRoleByName("ROLE_NEW");
        if (role == null) {
            gaStore.addRole(role =gaStore.createRoleObject("ROLE_NEW"));
            gaStore.store();
        }
        return role;   
View Full Code Here

    @Test
    public void testEditParentRole() throws Exception {
       
        tester.startPage(listPage(getRoleServiceName()));
                  
        GeoServerRole role = gaService.getRoleByName("ROLE_AUTHENTICATED");
        assertNotNull(role);
        List<Property<GeoServerRole>> props = new RoleListProvider(getRoleServiceName()).getProperties();
        Property<GeoServerRole> parentProp = null;
        for (Property<GeoServerRole> prop: props) {
            if (RoleListProvider.ParentPropertyName.equals(prop.getName())){
                parentProp=prop;
                break;
            }
        }
        Component c = getFromList(SECOND_COLUM_PATH, role,parentProp);
        assertNotNull(c);
        tester.clickLink(c.getPageRelativePath());
       
        tester.assertRenderedPage(EditRolePage.class);
        assertTrue(checkEditForm(role.getAuthority()));
    }
View Full Code Here

       


    @Override
    protected String getSearchString() throws Exception{
        GeoServerRole role =
                gaService.getRoleByName(
                GeoServerRole.ADMIN_ROLE.getAuthority());
        assertNotNull(role);
        return role.getAuthority();
    }
View Full Code Here

        assertTrue(roles.contains(GeoServerRole.ADMIN_ROLE));
    }

    @Override
    protected void doRemove(String pathForLink) throws Exception {
        GeoServerRole newRole = gaStore.createRoleObject("NEW_ROLE");
        gaStore.addRole(newRole);
        gaStore.store();
        assertEquals(5,gaService.getRoles().size());
       
        super.doRemove(pathForLink);
View Full Code Here

               
        form.submit("save");
        tester.assertRenderedPage(SecurityNamedServiceEditPage.class);
        tester.assertErrorMessages(new String[0]);
       
        GeoServerRole role = gaService.getRoleByName("ROLE_WFS");
        assertNotNull(role);
        //assertEquals(1,role.getProperties().size());
        //assertEquals("10 10 20 20",role.getProperties().get("bbox"));
        GeoServerRole parentRole = gaService.getParentRole(role);
        assertNull(parentRole);
    }
View Full Code Here

TOP

Related Classes of org.geoserver.security.impl.GeoServerRole

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.