fix #1648 store attributes to ldap

This commit is contained in:
Shinsuke Sugaya 2018-05-15 23:12:51 +09:00
parent 39144fb83c
commit 9b8b5a07a1
4 changed files with 8 additions and 0 deletions

View file

@ -255,6 +255,7 @@ public class AdminGroupAction extends FessAdminAction {
public static OptionalEntity<Group> getGroup(final CreateForm form) {
return getEntity(form).map(entity -> {
copyMapToBean(form.attributes, entity, op -> op.exclude(Constants.COMMON_CONVERSION_RULE));
copyBeanToBean(form, entity, op -> op.exclude(Constants.COMMON_CONVERSION_RULE));
return entity;
});

View file

@ -209,6 +209,7 @@ public class AdminRoleAction extends FessAdminAction {
public static OptionalEntity<Role> getRole(final CreateForm form) {
return getEntity(form).map(entity -> {
copyMapToBean(form.attributes, entity, op -> op.exclude(Constants.COMMON_CONVERSION_RULE));
copyBeanToBean(form, entity, op -> op.exclude(Constants.COMMON_CONVERSION_RULE));
return entity;
});

View file

@ -285,6 +285,7 @@ public class AdminUserAction extends FessAdminAction {
public static OptionalEntity<User> getUser(final CreateForm form) {
return getEntity(form).map(entity -> {
copyMapToBean(form.attributes, entity, op -> op.exclude(Constants.COMMON_CONVERSION_RULE));
copyBeanToBean(form, entity, op -> op.exclude(ArrayUtils.addAll(Constants.COMMON_CONVERSION_RULE, "password")));
if (form.crudMode.intValue() == CrudMode.CREATE || StringUtil.isNotBlank(form.password)) {
final String encodedPassword = ComponentUtil.getComponent(FessLoginAssist.class).encryptPassword(form.password);

View file

@ -15,6 +15,7 @@
*/
package org.codelibs.fess.app.web.base;
import java.util.Map;
import java.util.function.Consumer;
import javax.annotation.Resource;
@ -194,6 +195,10 @@ public abstract class FessBaseAction extends TypicalAction // has several interf
BeanUtil.copyBeanToBean(src, dest, option);
}
protected static void copyMapToBean(final Map<String, ? extends Object> src, final Object dest, final Consumer<CopyOptions> option) {
BeanUtil.copyMapToBean(src, dest, option);
}
protected static <T> T copyBeanToNewBean(final Object src, final Class<T> destClass) {
return BeanUtil.copyBeanToNewBean(src, destClass);
}