Package org.geoserver.security.impl

Examples of org.geoserver.security.impl.DataAccessRule


                } catch (Exception e) {
                    LOGGER.warning("Invalid security mode " + ruleValue + " acceptable values are "
                            + Arrays.asList(CatalogMode.values()));
                }
            } else {
                DataAccessRule rule = parseDataAccessRule(ruleKey, ruleValue);
                if (rule != null) {
                    if (result.contains(rule))
                        LOGGER.warning("Rule " + ruleKey + "." + ruleValue
                                + " overwrites another rule on the same path");
                    result.add(rule);
                }
            }
        }
       
        // make sure the two basic rules if the set is empty
        if(result.size() == 0) {
            result.add(new DataAccessRule(DataAccessRule.READ_ALL));
            result.add(new DataAccessRule(DataAccessRule.WRITE_ALL));
        }
       
        rules = result;
    }
View Full Code Here


                return null;
            }
        }

        // build the rule
        return new DataAccessRule(workspace, layerName, mode, roles);
    }
View Full Code Here

                } catch (Exception e) {
                    LOGGER.warning("Invalid security mode " + ruleValue + " acceptable values are "
                            + Arrays.asList(CatalogMode.values()));
                }
            } else {
                DataAccessRule rule = parseDataAccessRule(ruleKey, ruleValue);
                if (rule != null) {
                    if (result.contains(rule))
                        LOGGER.warning("Rule " + ruleKey + "." + ruleValue
                                + " overwrites another rule on the same path");
                    result.add(rule);
                }
            }
        }
       
        // make sure the two basic rules if the set is empty
        if(result.size() == 0) {
            result.add(new DataAccessRule(DataAccessRule.READ_ALL));
            result.add(new DataAccessRule(DataAccessRule.WRITE_ALL));
        }
       
        rules = result;
    }
View Full Code Here

                "globally to a workspace, layer must be *, skipping rule");
            return null;
        }

        // build the rule
        return new DataAccessRule(workspace, layerName, mode, roles);
    }
View Full Code Here

    @Test
    public void testParse() {
        assertEquals(3, dao.getRules().size());
       
        // check the first rule
        DataAccessRule rule = dao.getRules().get(0);
        assertEquals("*.*.r", rule.getKey());
        assertEquals(1, rule.getRoles().size());
        assertEquals("*", rule.getRoles().iterator().next());
    }
View Full Code Here

    }
   
    @Test
    public void testAdd() {
        assertEquals(3, dao.getRules().size());
        DataAccessRule newRule = dao.parseDataAccessRule("*.*.w", "ROLE_GENERIC_W");
        assertTrue(dao.addRule(newRule));
        assertEquals(4, dao.getRules().size());
        assertEquals(newRule, dao.getRules().get(1));
        assertFalse(dao.addRule(newRule));
    }
View Full Code Here

        assertFalse(dao.addRule(newRule));
    }
   
    @Test
    public void testRemove() {
        DataAccessRule newRule = dao.parseDataAccessRule("*.*.w", "ROLE_GENERIC_W");
        assertFalse(dao.removeRule(newRule));
        DataAccessRule first = dao.getRules().get(0);
        assertTrue(dao.removeRule(first));
        assertFalse(dao.removeRule(first));
        assertEquals(2, dao.getRules().size());
    }
View Full Code Here

        }
    }
   
    @Test
    public void testParsePlain() {
        DataAccessRule rule = dao.parseDataAccessRule("a.b.r", "ROLE_WHO_CARES");
        assertEquals("a", rule.getWorkspace());
        assertEquals("b", rule.getLayer());
        assertEquals(AccessMode.READ, rule.getAccessMode());
    }
View Full Code Here

        assertEquals(AccessMode.READ, rule.getAccessMode());
    }
   
    @Test
    public void testParseSpaces() {
        DataAccessRule rule = dao.parseDataAccessRule(" a  . b . r ", "ROLE_WHO_CARES");
        assertEquals("a", rule.getWorkspace());
        assertEquals("b", rule.getLayer());
        assertEquals(AccessMode.READ, rule.getAccessMode());
    }
View Full Code Here

        assertEquals(AccessMode.READ, rule.getAccessMode());
    }
   
    @Test
    public void testParseEscapedDots() {
        DataAccessRule rule = dao.parseDataAccessRule("w. a\\.b . r ", "ROLE_WHO_CARES");
        assertEquals("w", rule.getWorkspace());
        assertEquals("a.b", rule.getLayer());
        assertEquals(AccessMode.READ, rule.getAccessMode());
    }
View Full Code Here

TOP

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

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.