Package org.geoserver.security

Examples of org.geoserver.security.GeoServerRoleStore


                } catch (IOException ex) {
                    try {ugStore.load(); } catch (IOException ex2) {};
                    throw new RuntimeException(ex);
                }
               
                GeoServerRoleStore gaStore = null;
                if (disassociateRoles) {
                    try {
                        gaStore =
                                GeoServerApplication.get().getSecurityManager().getActiveRoleService().createStore();
                        gaStore = new RoleStoreValidationWrapper(gaStore);
                        for (GeoServerUserGroup group : removePanel.getRoots()) {                                             
                                 List<GeoServerRole> list= new ArrayList<GeoServerRole>();
                                 list.addAll(gaStore.getRolesForGroup(group.getGroupname()));
                                 for (GeoServerRole role: list)
                                     gaStore.disAssociateRoleFromGroup(role, group.getGroupname());
                        }
                        gaStore.store();
                    } catch (IOException ex) {
                        try {gaStore.load(); } catch (IOException ex2) {};
                        throw new RuntimeException(ex);
                    }
                }

               
View Full Code Here


        } catch (PasswordPolicyException ex) {
            try { ugStore.load(); } catch (IOException ex2) {};
            throw ex;
        }

        GeoServerRoleStore roleStore=null;
        try {
            if (hasRoleStore(getSecurityManager().getActiveRoleService().getName())) {
                roleStore = getRoleStore(getSecurityManager().getActiveRoleService().getName());
                roleStore = new RoleStoreValidationWrapper(roleStore);
               
                Set<GeoServerRole> orig = roleStore.getRolesForUser(user.getUsername());
                Set<GeoServerRole> add = new HashSet<GeoServerRole>();
                Set<GeoServerRole> remove = new HashSet<GeoServerRole>();
                rolePalette.diff(orig, add, remove);

                for (GeoServerRole role : add) {
                    roleStore.associateRoleToUser(role, user.getUsername());
                }
                for (GeoServerRole role : remove) {
                    roleStore.disAssociateRoleFromUser(role, user.getUsername());
                }
                roleStore.store();
            }
        } catch (IOException ex) {
            try { roleStore.load(); } catch (IOException ex2) {};
            throw ex;
        }
    }
View Full Code Here

    }

    @Override
    protected void onFormSubmit(GeoServerRole role) throws IOException {
       
        GeoServerRoleStore store = null;
        try {

            store = new RoleStoreValidationWrapper(getRoleStore(roleServiceName));
            //copy into a new one so we can set the name properly
            GeoServerRole newRole= store.createRoleObject(get("form:name").getDefaultModelObjectAsString());
            newRole.setUserName(role.getUserName());
            newRole.getProperties().putAll(role.getProperties());
            role = newRole;                       
            store.addRole(role);

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

            store.store();
        } catch (IOException ex) {
            try {store.load(); } catch (IOException ex2) {};
            throw ex;
        }
    }
View Full Code Here

                } catch (IOException ex) {
                    try {ugStore.load(); } catch (IOException ex2) {};
                    throw new RuntimeException(ex);
                }
               
                GeoServerRoleStore gaStore = null;
                if (disassociateRoles) {
                    try {
                        gaStore =
                                GeoServerApplication.get().getSecurityManager()
                                    .getActiveRoleService().createStore();
                        gaStore=new RoleStoreValidationWrapper(gaStore);
   
                        for (GeoServerUser user : removePanel.getRoots()) {                                                                        
                                List<GeoServerRole> list= new ArrayList<GeoServerRole>();
                                list.addAll(gaStore.getRolesForUser(user.getUsername()));
                                for (GeoServerRole role: list)
                                    gaStore.disAssociateRoleFromUser(role, user.getUsername());
                           
                        }
                        gaStore.store();       
                    } catch (IOException ex) {
                        try {gaStore.load(); } catch (IOException ex2) {};
                        throw new RuntimeException(ex);
                    }
                }
                                               
                // the deletion will have changed what we see in the page
View Full Code Here

       
        if (hasRoleStore(roleServiceName)==false) {
            throw new RuntimeException("Invalid workflow, cannot store in a read only role service");
        }

        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) {
            try {store.load(); } catch (IOException ex2) {};
            throw ex;
        }
    }
View Full Code Here

        } catch (PasswordPolicyException ex) {          
            try {ugStore.load(); } catch (IOException ex2) {};
            throw ex;
        }

        GeoServerRoleStore gaStore = null;
        try {
            if (hasRoleStore(getSecurityManager().getActiveRoleService().getName())) {
                gaStore = getRoleStore(getSecurityManager().getActiveRoleService().getName());
                gaStore = new RoleStoreValidationWrapper(gaStore);
                for (GeoServerRole role : rolePalette.getSelectedRoles()) {
                    gaStore.associateRoleToUser(role, user.getUsername());
                }
                gaStore.store();
            }
        } catch (IOException ex) {
            try {gaStore.load(); } catch (IOException ex2) {};
            throw ex;
        }
    }
View Full Code Here

        ugStore.addUser(ugStore.createUserObject("cite_nomosaic", "cite", true));
        ugStore.addUser(ugStore.createUserObject("cite_cropmosaic", "cite", true));
        ugStore.addUser(ugStore.createUserObject("cite_filtermosaic", "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_nomosaic");
        roleStore.associateRoleToUser(role, "cite_cropmosaic")
        roleStore.associateRoleToUser(role, "cite_filtermosaic");            
        roleStore.store();
       
        // populate the access manager
        Catalog catalog = getCatalog();
        TestResourceAccessManager tam = (TestResourceAccessManager) applicationContext
                .getBean("testResourceAccessManager");
View Full Code Here

TOP

Related Classes of org.geoserver.security.GeoServerRoleStore

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.