Package org.geoserver.security.impl

Examples of org.geoserver.security.impl.GeoServerRole


        return roleStore;
    }
   
    protected void addRolesToCreate(GeoServerRoleStore roleStore, String... roleNames) throws IOException {
        for (String roleName : roleNames) {
            expect(roleStore.createRoleObject(roleName)).andReturn(new GeoServerRole(roleName)).anyTimes();
        }
    }
View Full Code Here


        ugStore.addGroup(admins);

        ugStore.store();

        //grant bob group admin privilege
        GeoServerRole groupAdminRole = null;
        GeoServerRoleStore roleStore = createStore(roleService);
        roleStore.addRole(roleStore.createRoleObject("adminRole"));
        roleStore.addRole(groupAdminRole=roleStore.createRoleObject("groupAdminRole"));
       
        roleStore.associateRoleToUser(groupAdminRole, bob.getUsername());
View Full Code Here

    }

    @Test
    public void testHideAdminRole() throws Exception {
        GeoServerRoleService roleService = getSecurityManager().getActiveRoleService();
        GeoServerRole adminRole = roleService.createRoleObject("adminRole");
        assertTrue(roleService.getRoles().contains(adminRole));
        assertNotNull(roleService.getAdminRole());
        assertNotNull(roleService.getRoleByName("adminRole"));
       
        setAuth();
View Full Code Here

        ugStore.addUser(ugStore.createUserObject("cite_mosaic1", "cite", true));
        ugStore.addUser(ugStore.createUserObject("cite_mosaic2", "cite", true));
        ugStore.store();
       
        GeoServerRoleStore roleStore= getSecurityManager().getActiveRoleService().createStore();
        GeoServerRole role = roleStore.createRoleObject("ROLE_DUMMY");
        roleStore.addRole(role);
        roleStore.associateRoleToUser(role, "cite");
        roleStore.associateRoleToUser(role, "cite_noinfo");
        roleStore.associateRoleToUser(role, "cite_nostates");
        roleStore.associateRoleToUser(role, "cite_cite_texas");
View Full Code Here

            throws IOException {
       
        Connection con=null;
        PreparedStatement ps = null,ps2=null;
        ResultSet rs = null,rs2=null;
        GeoServerRole  roleObject  = null;
        try {
            con = getConnection();
            ps = getDMLStatement("roles.keyed",con);           
            ps.setString(1, role);
            rs = ps.executeQuery();
            if (rs.next()) {               
                roleObject  = createRoleObject(role);
                ps2 = getDMLStatement("roleprops.selectForRole",con);           
                ps2.setString(1, role);
                rs2 = ps2.executeQuery();
                while (rs2.next()) {
                    String propName = rs2.getString(1);
                    Object propValue = rs2.getObject(2);
                    roleObject.getProperties().put(propName, propValue==null ? "" : propValue );
                }               
            }               
        } catch (SQLException ex) {
            throw new IOException(ex);
        } finally {
View Full Code Here

            con = getConnection();
            ps = getDMLStatement("roles.all",con);           
            rs = ps.executeQuery();
            while (rs.next()) {               
                String rolename = rs.getString(1);               
                GeoServerRole roleObject = createRoleObject(rolename);           
                map.put(rolename, roleObject);
            }
           
            ps.close();
            rs.close();
           
            ps = getDMLStatement("roleprops.all",con);
            rs = ps.executeQuery();
            while (rs.next()) {   
                String roleName = rs.getString(1);
                String propName = rs.getString(2);
                Object propValue = rs.getString(3);
                GeoServerRole roleObject = map.get(roleName);
                if (roleObject!=null) {
                    roleObject.getProperties().put(propName, propValue==null ? "" : propValue);
                }
            }
        } catch (SQLException ex) {
            throw new IOException(ex);
        } finally {
View Full Code Here

    /**
     * @see org.geoserver.security.GeoServerRoleService#createRoleObject(java.lang.String)
     */
    public GeoServerRole createRoleObject(String role) {
        return new GeoServerRole(role);
    }
View Full Code Here

            ps.setString(1, username);
            rs = ps.executeQuery();
            while (rs.next()) {               
                String rolename = rs.getString(1);               
                GeoServerRole roleObject = createRoleObject(rolename);               
                map.put(rolename,roleObject);        
               
            }
            rs.close();
            ps.close();
           
            ps = getDMLStatement("roleprops.selectForUser",con);
            ps.setString(1, username);
            rs = ps.executeQuery();
            while (rs.next()) {
                String rolename = rs.getString(1);               
                String propName = rs.getString(2);
                Object propValue = rs.getObject(3);
                GeoServerRole roleObject = map.get(rolename);
                if (roleObject!=null) {
                    roleObject.getProperties().put(propName, propValue==null ? "" : propValue);
                }
            }                               

        } catch (SQLException ex) {
            throw new IOException(ex);
View Full Code Here

            ps.setString(1, groupname);
            rs = ps.executeQuery();
            while (rs.next()) {               
                String rolename = rs.getString(1);
                GeoServerRole roleObject = createRoleObject(rolename);               
                map.put(rolename,roleObject);        
               
            }
            rs.close();
            ps.close();
           
            ps = getDMLStatement("roleprops.selectForGroup",con);
            ps.setString(1, groupname);
            rs = ps.executeQuery();
            while (rs.next()) {
                String rolename = rs.getString(1);               
                String propName = rs.getString(2);
                Object propValue = rs.getObject(3);
                GeoServerRole roleObject = map.get(rolename);
                if (roleObject!=null) {
                    roleObject.getProperties().put(propName, propValue==null ? "" : propValue);
                }
            }                               

        } catch (SQLException ex) {
            throw new IOException(ex);
View Full Code Here

            throws IOException {

        Connection con=null;
        PreparedStatement ps = null,ps2=null;
        ResultSet rs = null,rs2=null;
        GeoServerRole  roleObject  = null;
        try {
            con = getConnection();
            ps = getDMLStatement("roles.keyed",con);           
            ps.setString(1, role.getAuthority());
            rs = ps.executeQuery();
            if (rs.next()) {               
                String parent = rs.getString(1);               
                if (parent!=null) { // do we have a parent ?
                    roleObject  = createRoleObject(parent);
                    ps2 = getDMLStatement("roleprops.selectForRole",con);           
                    ps2.setString(1, parent);
                    rs2 = ps2.executeQuery();
                    while (rs2.next()) {
                        String propName = rs2.getString(1);
                        Object propValue = rs2.getObject(2);
                        roleObject.getProperties().put(propName, propValue==null ? "" : propValue);
                    }
                }   
            }               
        } catch (SQLException ex) {
            throw new IOException(ex);
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.