void handleSubmitError(Exception e) { LOGGER.log(Level.SEVERE, "Error occurred while saving user", e); if (e instanceof RuntimeException && e.getCause() instanceof Exception) { e = (Exception) e.getCause(); } if (e instanceof IOException && e.getCause() instanceof AbstractSecurityException) { e = (Exception) e.getCause(); } if (e instanceof AbstractSecurityException) { error(e); } else { error(new ParamResourceModel("saveError", getPage(), e.getMessage()).getObject()); } }
@Override public boolean isRequired() { return isFinalSubmit(this); } };
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()); add(form); roles = new ArrayList( getSecurityManager() .getActiveRoleService() .getRolesForUser(user.getUsername())); || hasRoleStore( getSecurityManager().getActiveRoleService().getName()))); form.add(getCancelLink());
@Override public void onSubmit() { try { //update the user property listing the group names the user is admin for if (adminGroupChoice.isEnabled()) { Collection<GeoServerUserGroup> groups = adminGroupChoice.getModelObject(); String[] groupNames = new String[groups.size()]; int i = 0; for (GeoServerUserGroup group : groups) { groupNames[i++] = group.getGroupname(); } GroupAdminProperty.set(user.getProperties(), groupNames); } else { GroupAdminProperty.del(user.getProperties()); } onFormSubmit(user); setReturnPageDirtyAndReturn(true); } catch(Exception e) { handleSubmitError(e); } } }.setEnabled(hasUserGroupStore || hasRoleStore(getSecurityManager().getActiveRoleService().getName())));
@Override public void validate(Form<?> form) { if (adminGroupChoice.isEnabled()) { adminGroupChoice.updateModel(); if (adminGroupChoice.getModelObject().isEmpty()) { form.error( new StringResourceModel("noAdminGroups", getPage(), null).getString()); } } } }
@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); tmp.addAll(rolePalette.getSelectedRoles()); calc.addInheritedRoles(tmp); for (GeoServerUserGroup group : userGroupPalette.getSelectedGroups()) { if (group.isEnabled()) { tmp.addAll(calc.calculateRoles(group)); } } result.addAll(calc.personalizeRoles(user, tmp)); } catch (IOException e) { throw new RuntimeException(e); } Collections.sort(result); return result; } }
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()); add(form); try { roles = new ArrayList( getSecurityManager().getActiveRoleService().getRolesForUser(user.getUsername())); } catch (IOException e) { throw new WicketRuntimeException(e); form.add(getCancelLink());
@Override public void onSubmit() { try { //update the user property listing the group names the user is admin for if (adminGroupChoice.isEnabled()) { Collection<GeoServerUserGroup> groups = adminGroupChoice.getModelObject(); String[] groupNames = new String[groups.size()]; int i = 0; for (GeoServerUserGroup group : groups) { groupNames[i++] = group.getGroupname(); } GroupAdminProperty.set(user.getProperties(), groupNames); } else { GroupAdminProperty.del(user.getProperties()); } onFormSubmit(user); setReturnPageDirtyAndReturn(true); } catch(Exception e) { handleSubmitError(e); } } }.setEnabled(hasUserGroupStore || hasRoleStore(getSecurityManager().getActiveRoleService().getName())));
@Override public void validate(Form<?> form) { if (adminGroupChoice.isEnabled()) { adminGroupChoice.updateModel(); if (adminGroupChoice.getModelObject().isEmpty()) { form.error(new StringResourceModel("noAdminGroups", getPage(), null).getString()); } } } }
@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); tmp.addAll(rolePalette.getSelectedRoles()); calc.addInheritedRoles(tmp); for (GeoServerUserGroup group : userGroupPalette.getSelectedGroups()) { if (group.isEnabled()) { tmp.addAll(calc.calculateRoles(group)); } } result.addAll(calc.personalizeRoles(user, tmp)); } catch (IOException e) { throw new RuntimeException(e); } Collections.sort(result); return result; } }
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()); add(form); try { roles = new ArrayList( getSecurityManager().getActiveRoleService().getRolesForUser(user.getUsername())); } catch (IOException e) { throw new WicketRuntimeException(e); form.add(getCancelLink());
@Override public boolean isRequired() { return isFinalSubmit(this); } };
void handleSubmitError(Exception e) { LOGGER.log(Level.SEVERE, "Error occurred while saving user", e); if (e instanceof RuntimeException && e.getCause() instanceof Exception) { e = (Exception) e.getCause(); } if (e instanceof IOException && e.getCause() instanceof AbstractSecurityException) { e = (Exception) e.getCause(); } if (e instanceof AbstractSecurityException) { error(e); } else { error(new ParamResourceModel("saveError", getPage(), e.getMessage()).getObject()); } }
@Override public void onSubmit() { try { // update the user property listing the group names the user is admin // for if (adminGroupChoice.isEnabled()) { Collection<GeoServerUserGroup> groups = adminGroupChoice.getModelObject(); String[] groupNames = new String[groups.size()]; int i = 0; for (GeoServerUserGroup group : groups) { groupNames[i++] = group.getGroupname(); } GroupAdminProperty.set(user.getProperties(), groupNames); } else { GroupAdminProperty.del(user.getProperties()); } onFormSubmit(user); setReturnPageDirtyAndReturn(true); } catch (Exception e) { handleSubmitError(e); } } }.setEnabled(
@Override public void validate(Form<?> form) { if (adminGroupChoice.isEnabled()) { adminGroupChoice.updateModel(); if (adminGroupChoice.getModelObject().isEmpty()) { form.error(new StringResourceModel("noAdminGroups", getPage(), null).getString()); } } } }
@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); tmp.addAll(rolePalette.getSelectedRoles()); calc.addInheritedRoles(tmp); for (GeoServerUserGroup group : userGroupPalette.getSelectedGroups()) { if (group.isEnabled()) { tmp.addAll(calc.calculateRoles(group)); } } result.addAll(calc.personalizeRoles(user, tmp)); } catch (IOException e) { throw new RuntimeException(e); } Collections.sort(result); return result; } }
@Override public boolean isRequired() { return isFinalSubmit(this); } };
void handleSubmitError(Exception e) { LOGGER.log(Level.SEVERE, "Error occurred while saving user", e); if (e instanceof RuntimeException && e.getCause() instanceof Exception) { e = (Exception) e.getCause(); } if (e instanceof IOException && e.getCause() instanceof AbstractSecurityException) { e = (Exception) e.getCause(); } if (e instanceof AbstractSecurityException) { error(e); } else { error(new ParamResourceModel("saveError", getPage(), e.getMessage()).getObject()); } }
@Override public boolean isRequired() { return isFinalSubmit(this); } };
@Override public boolean isRequired() { return isFinalSubmit(this); } };