Package org.geoserver.security

Examples of org.geoserver.security.GeoServerUserGroupService


        }));

        boolean canCreateStore=false;
        SecurityUserGroupServiceConfig config = model.getObject();
        try {
            GeoServerUserGroupService s =
                (GeoServerUserGroupService) Class.forName(config.getClassName()).newInstance();
            canCreateStore=s.canCreateStore();
        } catch (Exception e) {
            // do nothing
        }

       
View Full Code Here


    @Override
    public void doSave(T config) throws Exception {
        getSecurityManager().saveUserGroupService(config);
        if (recodeCheckBox.getModelObject()) {
            GeoServerUserGroupService s = getSecurityManager().loadUserGroupService(config.getName());
            if (s.canCreateStore()) {
                Util.recodePasswords(s.createStore());
            }
        }
    }
View Full Code Here

    @Override
    protected void onFormSubmit(GeoServerUser user)
        throws IOException,PasswordPolicyException {
       
        GeoServerUserGroupService ugService = getUserGroupService(ugServiceName);
        GeoServerUserGroupStore ugStore = null;
        try {
            if (ugService.canCreateStore()) {
                ugStore = new UserGroupStoreValidationWrapper(ugService.createStore());
   
                Set<GeoServerUserGroup> orig = ugStore.getGroupsForUser(user);
                Set<GeoServerUserGroup> add = new HashSet<GeoServerUserGroup>();
                Set<GeoServerUserGroup> remove = new HashSet<GeoServerUserGroup>();
                userGroupPalette.diff(orig, add, remove);
View Full Code Here

                // cascade delete the whole selection


                GeoServerUserGroupStore ugStore = null;
                try {
                    GeoServerUserGroupService ugService = GeoServerApplication.get()
                            .getSecurityManager().loadUserGroupService(userGroupsServiceName);
                    ugStore = new UserGroupStoreValidationWrapper(ugService.createStore());
                    for (GeoServerUser user : removePanel.getRoots()) {                    
                        ugStore.removeUser(user);
                    }
                    ugStore.store();
                } catch (IOException ex) {
View Full Code Here

    @Override
    protected List<GeoServerUser> getItems() {
        SortedSet<GeoServerUser> users=null;
        try {
            GeoServerUserGroupService service = null;
            if (userGroupServiceName !=null)
                service =
                    getApplication().getSecurityManager().loadUserGroupService(userGroupServiceName);
           
            if (service==null)
                users=new TreeSet<GeoServerUser>();
            else
                users=service.getUsers();

        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        List<GeoServerUser> userList = new ArrayList<GeoServerUser>();
View Full Code Here

    protected String ugServiceName;

    protected AbstractUserPage(String ugServiceName, final GeoServerUser user) {
        this.ugServiceName=ugServiceName;

        GeoServerUserGroupService ugService = getUserGroupService(ugServiceName);
        boolean emptyPasswd = getSecurityManager().loadPasswordEncoder(ugService.getPasswordEncoderName())
            instanceof GeoServerEmptyPasswordEncoder;
        boolean hasUserGroupStore = ugService.canCreateStore();
        boolean hasRoleStore = hasRoleStore(getSecurityManager().getActiveRoleService().getName());

        // build the form
        Form form = new Form<Serializable>("form", new CompoundPropertyModel(user));
        add(form);

        form.add(new TextField("username").setEnabled(hasUserGroupStore));
        form.add(new CheckBox("enabled").setEnabled(hasUserGroupStore));

        PasswordTextField pw1 = new PasswordTextField("password") {
            @Override
            public boolean isRequired() {
                return isFinalSubmit(this);
            }
        };
        form.add(pw1);
        pw1.setResetPassword(false);
        pw1.setEnabled(hasUserGroupStore && !emptyPasswd);

        PasswordTextField pw2 = new PasswordTextField("confirmPassword",
            new Model(user.getPassword())) {
            @Override
            public boolean isRequired() {
                return isFinalSubmit(this);
            }
        };
        form.add(pw2);
        pw2.setResetPassword(false);               
        pw2.setEnabled(hasUserGroupStore && !emptyPasswd);

        form.add(new PropertyEditorFormComponent("properties").setEnabled(hasUserGroupStore));

        form.add(userGroupPalette = new UserGroupPaletteFormComponent("groups", ugServiceName, user));
        userGroupPalette.add(new AjaxFormComponentUpdatingBehavior("onchange") {
            @Override
            protected void onUpdate(AjaxRequestTarget target) {
                updateCalculatedRoles(target);
            }
        });
        userGroupPalette.setEnabled(hasUserGroupStore);

        List<GeoServerRole> roles;
        try {
            roles = new ArrayList(
                getSecurityManager().getActiveRoleService().getRolesForUser(user.getUsername()));
        } catch (IOException e) {
            throw new WicketRuntimeException(e);
        }
       
        form.add(rolePalette = new RolePaletteFormComponent("roles", new ListModel(roles)));
        rolePalette.add(new AjaxFormComponentUpdatingBehavior("onchange") {
           @Override
           protected void onUpdate(AjaxRequestTarget target) {
               updateCalculatedRoles(target);
               updateGroupAdminList(target);
           }
        });
        rolePalette.setOutputMarkupId(true);
        rolePalette.setEnabled(hasRoleStore);

        boolean isGroupAdmin = roles.contains(GeoServerRole.GROUP_ADMIN_ROLE);
        List<GeoServerUserGroup> adminGroups = new ArrayList();
        if (isGroupAdmin) {
            for (String groupName : GroupAdminProperty.get(user.getProperties())) {
                try {
                    adminGroups.add(ugService.getGroupByGroupname(groupName));
                } catch (IOException e) {
                    throw new WicketRuntimeException(e);
                }
            }
        }
View Full Code Here

        @Override
        protected List<GeoServerRole> load() {
            List<GeoServerRole> tmp = new ArrayList<GeoServerRole>();
            List<GeoServerRole> result = new ArrayList<GeoServerRole>();
            try {
                GeoServerUserGroupService ugService = getSecurityManager()
                        .loadUserGroupService(ugServiceName);
                GeoServerRoleService gaService = getSecurityManager()
                        .getActiveRoleService();

                RoleCalculator calc = new RoleCalculator(ugService, gaService);
View Full Code Here

    /**
     * triggers a load on {@link #service}
     */
    @Override
    protected void doOnChange() {
        GeoServerUserGroupService theService = getService();
        try {
            if (theService!=null)
                theService.load();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

TOP

Related Classes of org.geoserver.security.GeoServerUserGroupService

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.