CCM NG:
- Split up code for the UserAdmin class into several smaller classes - All classes (forms, tables, models, modelbuilders) which are only intented to be used by UserAidmin, GroupAdmin and RoleAdmin are only accessible from the package git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4018 8810af33-2d31-482b-a856-94f89814c4dfpull/2/head
parent
a5a11848a5
commit
822c5288f3
|
|
@ -54,7 +54,7 @@ import static com.arsdigita.ui.admin.AdminUiConstants.*;
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
public class GroupAddMemberForm extends Form {
|
class GroupAddMemberForm extends Form {
|
||||||
|
|
||||||
private static final String MEMBER_NAME = "membername";
|
private static final String MEMBER_NAME = "membername";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ import static com.arsdigita.ui.admin.AdminUiConstants.*;
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
public class GroupDetails extends BoxPanel {
|
class GroupDetails extends BoxPanel {
|
||||||
|
|
||||||
public GroupDetails(
|
public GroupDetails(
|
||||||
final GroupAdmin groupAdmin,
|
final GroupAdmin groupAdmin,
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ import static com.arsdigita.ui.admin.AdminUiConstants.*;
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
public class GroupForm extends Form {
|
class GroupForm extends Form {
|
||||||
|
|
||||||
private static final String GROUP_NAME = "groupname";
|
private static final String GROUP_NAME = "groupname";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ import static com.arsdigita.ui.admin.AdminUiConstants.*;
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
public class GroupMembersTable extends Table {
|
class GroupMembersTable extends Table {
|
||||||
|
|
||||||
private static final int COL_MEMBER_NAME = 0;
|
private static final int COL_MEMBER_NAME = 0;
|
||||||
private static final int COL_MEMBER_FAMILY_NAME = 1;
|
private static final int COL_MEMBER_FAMILY_NAME = 1;
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ import static com.arsdigita.ui.admin.AdminUiConstants.*;
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
public class GroupsTable extends Table {
|
class GroupsTable extends Table {
|
||||||
|
|
||||||
private static final Logger LOGGER = LogManager.getLogger(GroupsTable.class);
|
private static final Logger LOGGER = LogManager.getLogger(GroupsTable.class);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ import static com.arsdigita.ui.admin.AdminUiConstants.*;
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
public class RoleAddMemberForm extends Form {
|
class RoleAddMemberForm extends Form {
|
||||||
|
|
||||||
private static final String MEMBER_NAME = "membername";
|
private static final String MEMBER_NAME = "membername";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ import static com.arsdigita.ui.admin.AdminUiConstants.*;
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
public class RoleDetails extends BoxPanel {
|
class RoleDetails extends BoxPanel {
|
||||||
|
|
||||||
public RoleDetails(
|
public RoleDetails(
|
||||||
final RoleAdmin roleAdmin,
|
final RoleAdmin roleAdmin,
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ import static com.arsdigita.ui.admin.AdminUiConstants.*;
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
public class RoleForm extends Form {
|
class RoleForm extends Form {
|
||||||
|
|
||||||
private static final String ROLE_NAME = "rolename";
|
private static final String ROLE_NAME = "rolename";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ import static com.arsdigita.ui.admin.AdminUiConstants.*;
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
public class RoleMembersTable extends Table {
|
class RoleMembersTable extends Table {
|
||||||
|
|
||||||
private static final int COL_MEMBER_NAME = 0;
|
private static final int COL_MEMBER_NAME = 0;
|
||||||
private static final int COL_MEMBER_TYPE = 1;
|
private static final int COL_MEMBER_TYPE = 1;
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ import static com.arsdigita.ui.admin.AdminUiConstants.*;
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
public class RolePermissionsForm extends Form {
|
class RolePermissionsForm extends Form {
|
||||||
|
|
||||||
private static final String OBJECT_ID = "objectId";
|
private static final String OBJECT_ID = "objectId";
|
||||||
private static final String PRIVILEGE = "privilege";
|
private static final String PRIVILEGE = "privilege";
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ import static com.arsdigita.ui.admin.AdminUiConstants.*;
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
public class RolePermissionsTable extends Table {
|
class RolePermissionsTable extends Table {
|
||||||
|
|
||||||
private static final int COL_PRIVILEGE = 0;
|
private static final int COL_PRIVILEGE = 0;
|
||||||
private static final int COL_ON_OBJECT = 1;
|
private static final int COL_ON_OBJECT = 1;
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ import static com.arsdigita.ui.admin.AdminUiConstants.*;
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
public class RolePropertySheetModel implements PropertySheetModel {
|
class RolePropertySheetModel implements PropertySheetModel {
|
||||||
|
|
||||||
private static enum RoleProperty {
|
private static enum RoleProperty {
|
||||||
ROLE_NAME
|
ROLE_NAME
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ import org.libreccm.security.RoleRepository;
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
public class RolePropertySheetModelBuilder extends LockableImpl
|
class RolePropertySheetModelBuilder extends LockableImpl
|
||||||
implements PropertySheetModelBuilder {
|
implements PropertySheetModelBuilder {
|
||||||
|
|
||||||
private final ParameterSingleSelectionModel<String> selectedRoleId;
|
private final ParameterSingleSelectionModel<String> selectedRoleId;
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ import static com.arsdigita.ui.admin.AdminUiConstants.*;
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
public class RolesTable extends Table {
|
class RolesTable extends Table {
|
||||||
|
|
||||||
private static final int COL_ROLE_NAME = 0;
|
private static final int COL_ROLE_NAME = 0;
|
||||||
private static final int COL_DELETE = 1;
|
private static final int COL_DELETE = 1;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,93 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2016 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package com.arsdigita.ui.admin.usersgroupsroles.users;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.ActionLink;
|
||||||
|
import com.arsdigita.bebop.BoxPanel;
|
||||||
|
import com.arsdigita.bebop.ParameterSingleSelectionModel;
|
||||||
|
import com.arsdigita.bebop.Text;
|
||||||
|
import com.arsdigita.globalization.GlobalizedMessage;
|
||||||
|
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
import org.libreccm.cdi.utils.CdiUtil;
|
||||||
|
import org.libreccm.security.ChallengeManager;
|
||||||
|
import org.libreccm.security.User;
|
||||||
|
import org.libreccm.security.UserRepository;
|
||||||
|
|
||||||
|
import javax.mail.MessagingException;
|
||||||
|
|
||||||
|
import static com.arsdigita.ui.admin.AdminUiConstants.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
class ActionLinks extends BoxPanel {
|
||||||
|
|
||||||
|
private static final Logger LOGGER = LogManager.getLogger(ActionLinks.class);
|
||||||
|
|
||||||
|
public ActionLinks(final UserAdmin userAdmin,
|
||||||
|
final ParameterSingleSelectionModel<String> selectedUserId) {
|
||||||
|
|
||||||
|
super(BoxPanel.HORIZONTAL);
|
||||||
|
|
||||||
|
setIdAttr("userDetailsActionLinks");
|
||||||
|
|
||||||
|
final ActionLink editUserDetailsLink = new ActionLink(
|
||||||
|
new GlobalizedMessage("ui.admin.user_details.edit", ADMIN_BUNDLE));
|
||||||
|
editUserDetailsLink.addActionListener(e -> {
|
||||||
|
userAdmin.showUserEditForm(e.getPageState());
|
||||||
|
});
|
||||||
|
add(editUserDetailsLink);
|
||||||
|
add(new Text(" | "));
|
||||||
|
|
||||||
|
final ActionLink setPasswordLink = new ActionLink(
|
||||||
|
new GlobalizedMessage("ui.admin.user_details.set_password",
|
||||||
|
ADMIN_BUNDLE));
|
||||||
|
setPasswordLink.addActionListener(e -> {
|
||||||
|
userAdmin.showPasswordSetForm(e.getPageState());
|
||||||
|
});
|
||||||
|
add(setPasswordLink);
|
||||||
|
add(new Text(" | "));
|
||||||
|
|
||||||
|
final ActionLink generatePasswordLink = new ActionLink(
|
||||||
|
new GlobalizedMessage("ui.admin.user_details.generate_password",
|
||||||
|
ADMIN_BUNDLE));
|
||||||
|
generatePasswordLink.setConfirmation(new GlobalizedMessage(
|
||||||
|
"ui.admin.user_details.generate_password.confirm",
|
||||||
|
ADMIN_BUNDLE));
|
||||||
|
generatePasswordLink.addActionListener(e -> {
|
||||||
|
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||||
|
final UserRepository userRepository = cdiUtil.findBean(
|
||||||
|
UserRepository.class);
|
||||||
|
final User user = userRepository.findById(Long.parseLong(
|
||||||
|
selectedUserId.getSelectedKey(e.getPageState())));
|
||||||
|
final ChallengeManager challengeManager = cdiUtil.findBean(
|
||||||
|
ChallengeManager.class);
|
||||||
|
try {
|
||||||
|
challengeManager.sendPasswordRecover(user);
|
||||||
|
} catch (MessagingException ex) {
|
||||||
|
LOGGER.error("Failed to send email to user.", ex);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
add(generatePasswordLink);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,201 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2016 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package com.arsdigita.ui.admin.usersgroupsroles.users;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.Form;
|
||||||
|
import com.arsdigita.bebop.FormData;
|
||||||
|
import com.arsdigita.bebop.Label;
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.bebop.ParameterSingleSelectionModel;
|
||||||
|
import com.arsdigita.bebop.SaveCancelSection;
|
||||||
|
import com.arsdigita.bebop.form.CheckboxGroup;
|
||||||
|
import com.arsdigita.bebop.form.Option;
|
||||||
|
import com.arsdigita.bebop.form.TextField;
|
||||||
|
import com.arsdigita.globalization.GlobalizedMessage;
|
||||||
|
|
||||||
|
import org.apache.logging.log4j.util.Strings;
|
||||||
|
import org.libreccm.cdi.utils.CdiUtil;
|
||||||
|
import org.libreccm.core.EmailAddress;
|
||||||
|
import org.libreccm.security.User;
|
||||||
|
import org.libreccm.security.UserRepository;
|
||||||
|
|
||||||
|
import static com.arsdigita.ui.admin.AdminUiConstants.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
class EmailForm extends Form {
|
||||||
|
|
||||||
|
private static final String ADDRESS = "address";
|
||||||
|
private static final String VERIFIED = "verified";
|
||||||
|
private static final String BOUNCING = "bouncing";
|
||||||
|
|
||||||
|
private final TextField address;
|
||||||
|
private final CheckboxGroup verified;
|
||||||
|
private final CheckboxGroup bouncing;
|
||||||
|
private final SaveCancelSection saveCancelSection;
|
||||||
|
|
||||||
|
public EmailForm(
|
||||||
|
final UserAdmin userAdmin,
|
||||||
|
final ParameterSingleSelectionModel<String> selectedUserId,
|
||||||
|
final ParameterSingleSelectionModel<String> selectedEmailAddress) {
|
||||||
|
|
||||||
|
super("email_form");
|
||||||
|
|
||||||
|
address = new TextField(ADDRESS);
|
||||||
|
address.setLabel(new GlobalizedMessage(
|
||||||
|
"ui.admin.user.email_form.address", ADMIN_BUNDLE));
|
||||||
|
add(address);
|
||||||
|
|
||||||
|
verified = new CheckboxGroup(VERIFIED);
|
||||||
|
verified.addOption(
|
||||||
|
new Option("true",
|
||||||
|
new Label(new GlobalizedMessage(
|
||||||
|
"ui.admin.user.email_form.verified",
|
||||||
|
ADMIN_BUNDLE))));
|
||||||
|
add(verified);
|
||||||
|
|
||||||
|
bouncing = new CheckboxGroup(BOUNCING);
|
||||||
|
bouncing.addOption(
|
||||||
|
new Option("true",
|
||||||
|
new Label(new GlobalizedMessage(
|
||||||
|
"ui.admin.user.email_form.bouncing",
|
||||||
|
ADMIN_BUNDLE))));
|
||||||
|
add(bouncing);
|
||||||
|
|
||||||
|
saveCancelSection = new SaveCancelSection();
|
||||||
|
add(saveCancelSection);
|
||||||
|
|
||||||
|
addInitListener(e -> {
|
||||||
|
final PageState state = e.getPageState();
|
||||||
|
|
||||||
|
final String selected = selectedEmailAddress.getSelectedKey(state);
|
||||||
|
final String userIdStr = selectedUserId.getSelectedKey(state);
|
||||||
|
if (selected != null && !selected.isEmpty()) {
|
||||||
|
final UserRepository userRepository = CdiUtil.createCdiUtil()
|
||||||
|
.findBean(UserRepository.class);
|
||||||
|
final User user = userRepository.findById(Long.parseLong(
|
||||||
|
userIdStr));
|
||||||
|
EmailAddress email = null;
|
||||||
|
if (user.getPrimaryEmailAddress().getAddress().equals(selected)) {
|
||||||
|
email = user.getPrimaryEmailAddress();
|
||||||
|
} else {
|
||||||
|
for (EmailAddress current : user.getEmailAddresses()) {
|
||||||
|
if (current.getAddress().equals(selected)) {
|
||||||
|
email = current;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (email != null) {
|
||||||
|
address.setValue(state, email.getAddress());
|
||||||
|
if (email.isVerified()) {
|
||||||
|
verified.setValue(state, "true");
|
||||||
|
}
|
||||||
|
if (email.isBouncing()) {
|
||||||
|
bouncing.setValue(state, "true");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
addValidationListener(e -> {
|
||||||
|
final PageState state = e.getPageState();
|
||||||
|
|
||||||
|
if (saveCancelSection.getSaveButton().isSelected(state)) {
|
||||||
|
final FormData data = e.getFormData();
|
||||||
|
|
||||||
|
final String addressData = data.getString(ADDRESS);
|
||||||
|
|
||||||
|
if (Strings.isEmpty(addressData)) {
|
||||||
|
data.addError(ADDRESS, new GlobalizedMessage(
|
||||||
|
"ui.admin.user.email_form.address.not_empty",
|
||||||
|
ADMIN_BUNDLE));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
addProcessListener(e -> {
|
||||||
|
final PageState state = e.getPageState();
|
||||||
|
|
||||||
|
if (saveCancelSection.getSaveButton().isSelected(state)) {
|
||||||
|
final FormData data = e.getFormData();
|
||||||
|
|
||||||
|
final String selected = selectedEmailAddress.getSelectedKey(
|
||||||
|
state);
|
||||||
|
final String userIdStr = selectedUserId.getSelectedKey(state);
|
||||||
|
|
||||||
|
final UserRepository userRepository = CdiUtil.createCdiUtil()
|
||||||
|
.findBean(UserRepository.class);
|
||||||
|
final User user = userRepository.findById(Long.parseLong(
|
||||||
|
userIdStr));
|
||||||
|
EmailAddress email = null;
|
||||||
|
if (selected == null) {
|
||||||
|
email = new EmailAddress();
|
||||||
|
user.addEmailAddress(email);
|
||||||
|
} else if (user.getPrimaryEmailAddress().getAddress().equals(
|
||||||
|
selected)) {
|
||||||
|
email = user.getPrimaryEmailAddress();
|
||||||
|
} else {
|
||||||
|
for (EmailAddress current : user.getEmailAddresses()) {
|
||||||
|
if (current.getAddress().equals(selected)) {
|
||||||
|
email = current;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (email != null) {
|
||||||
|
email.setAddress(data.getString(ADDRESS));
|
||||||
|
|
||||||
|
final String[] verifiedValues = (String[]) data
|
||||||
|
.get(VERIFIED);
|
||||||
|
if (verifiedValues != null && verifiedValues.length > 0) {
|
||||||
|
if ("true".equals(verifiedValues[0])) {
|
||||||
|
email.setVerified(true);
|
||||||
|
} else {
|
||||||
|
email.setVerified(false);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
email.setVerified(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
final String[] bouncingValues = (String[]) data
|
||||||
|
.get(BOUNCING);
|
||||||
|
if (bouncingValues != null && bouncingValues.length > 0) {
|
||||||
|
if ("true".equals(bouncingValues[0])) {
|
||||||
|
email.setBouncing(true);
|
||||||
|
} else {
|
||||||
|
email.setBouncing(false);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
email.setBouncing(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
userRepository.save(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
userAdmin.closeEmailForm(e.getPageState());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,164 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2016 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package com.arsdigita.ui.admin.usersgroupsroles.users;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.Component;
|
||||||
|
import com.arsdigita.bebop.ControlLink;
|
||||||
|
import com.arsdigita.bebop.Label;
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.bebop.ParameterSingleSelectionModel;
|
||||||
|
import com.arsdigita.bebop.Table;
|
||||||
|
import com.arsdigita.bebop.event.TableActionEvent;
|
||||||
|
import com.arsdigita.bebop.event.TableActionListener;
|
||||||
|
import com.arsdigita.bebop.table.TableCellRenderer;
|
||||||
|
import com.arsdigita.bebop.table.TableColumn;
|
||||||
|
import com.arsdigita.bebop.table.TableColumnModel;
|
||||||
|
import com.arsdigita.globalization.GlobalizedMessage;
|
||||||
|
|
||||||
|
import org.libreccm.cdi.utils.CdiUtil;
|
||||||
|
import org.libreccm.core.EmailAddress;
|
||||||
|
import org.libreccm.security.User;
|
||||||
|
import org.libreccm.security.UserRepository;
|
||||||
|
|
||||||
|
import static com.arsdigita.ui.admin.AdminUiConstants.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
class EmailTable extends Table {
|
||||||
|
|
||||||
|
public EmailTable(
|
||||||
|
final UserAdmin userAdmin,
|
||||||
|
final ParameterSingleSelectionModel<String> selectedUserId,
|
||||||
|
final ParameterSingleSelectionModel<String> selectedEmailAddress) {
|
||||||
|
|
||||||
|
setModelBuilder(
|
||||||
|
new EmailTableModelBuilder(selectedUserId));
|
||||||
|
final TableColumnModel columnModel = getColumnModel();
|
||||||
|
columnModel.add(new TableColumn(
|
||||||
|
EmailTableModel.COL_ADDRESS,
|
||||||
|
new Label(new GlobalizedMessage(
|
||||||
|
"ui.admin.user.email_addresses.address",
|
||||||
|
ADMIN_BUNDLE))));
|
||||||
|
columnModel.add(new TableColumn(
|
||||||
|
EmailTableModel.COL_VERIFIED,
|
||||||
|
new Label(new GlobalizedMessage(
|
||||||
|
"ui.admin.user.email_addresses.verified",
|
||||||
|
ADMIN_BUNDLE))));
|
||||||
|
columnModel.add(new TableColumn(
|
||||||
|
EmailTableModel.COL_BOUNCING,
|
||||||
|
new Label(new GlobalizedMessage(
|
||||||
|
"ui.admin.user.email_addresses.bouncing",
|
||||||
|
ADMIN_BUNDLE))));
|
||||||
|
columnModel.add(new TableColumn(
|
||||||
|
EmailTableModel.COL_EDIT,
|
||||||
|
new Label(new GlobalizedMessage(
|
||||||
|
"ui.admin.user.email_addresses.edit",
|
||||||
|
ADMIN_BUNDLE))));
|
||||||
|
columnModel.add(new TableColumn(
|
||||||
|
EmailTableModel.COL_DELETE,
|
||||||
|
new Label(new GlobalizedMessage(
|
||||||
|
"ui.admin.user.email_addresses.delete",
|
||||||
|
ADMIN_BUNDLE))));
|
||||||
|
columnModel.get(EmailTableModel.COL_EDIT).setCellRenderer(
|
||||||
|
new TableCellRenderer() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Component getComponent(final Table table,
|
||||||
|
final PageState state,
|
||||||
|
final Object value,
|
||||||
|
final boolean isSelected,
|
||||||
|
final Object key,
|
||||||
|
final int row,
|
||||||
|
final int column) {
|
||||||
|
return new ControlLink((Component) value);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
columnModel.get(EmailTableModel.COL_DELETE)
|
||||||
|
.setCellRenderer(
|
||||||
|
new TableCellRenderer() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Component getComponent(final Table table,
|
||||||
|
final PageState state,
|
||||||
|
final Object value,
|
||||||
|
final boolean isSelected,
|
||||||
|
final Object key,
|
||||||
|
final int row,
|
||||||
|
final int column) {
|
||||||
|
final ControlLink link = new ControlLink((Component) value);
|
||||||
|
if (column == EmailTableModel.COL_DELETE) {
|
||||||
|
link.setConfirmation(new GlobalizedMessage(
|
||||||
|
"ui.admin.user.email_addresses.delete.confirm",
|
||||||
|
ADMIN_BUNDLE));
|
||||||
|
}
|
||||||
|
return link;
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
addTableActionListener(new TableActionListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void cellSelected(final TableActionEvent event) {
|
||||||
|
final PageState state = event.getPageState();
|
||||||
|
|
||||||
|
final String key = (String) event.getRowKey();
|
||||||
|
|
||||||
|
switch (event.getColumn()) {
|
||||||
|
case EmailTableModel.COL_EDIT:
|
||||||
|
selectedEmailAddress.setSelectedKey(state, key);
|
||||||
|
userAdmin.showEmailForm(state);
|
||||||
|
break;
|
||||||
|
case EmailTableModel.COL_DELETE:
|
||||||
|
final String userIdStr = selectedUserId.getSelectedKey(
|
||||||
|
state);
|
||||||
|
final UserRepository userRepository = CdiUtil
|
||||||
|
.createCdiUtil().findBean(UserRepository.class);
|
||||||
|
final User user = userRepository.findById(Long
|
||||||
|
.parseLong(userIdStr));
|
||||||
|
EmailAddress email = null;
|
||||||
|
for (EmailAddress current : user.getEmailAddresses()) {
|
||||||
|
if (current.getAddress().equals(key)) {
|
||||||
|
email = current;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (email != null) {
|
||||||
|
user.removeEmailAddress(email);
|
||||||
|
userRepository.save(user);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void headSelected(final TableActionEvent event) {
|
||||||
|
//Nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
setEmptyView(new Label(new GlobalizedMessage(
|
||||||
|
"ui.admin.user.email_addresses.none", ADMIN_BUNDLE)));
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -33,7 +33,7 @@ import static com.arsdigita.ui.admin.AdminUiConstants.*;
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
public class UserEmailTableModel implements TableModel {
|
class EmailTableModel implements TableModel {
|
||||||
|
|
||||||
protected static final int COL_ADDRESS = 0;
|
protected static final int COL_ADDRESS = 0;
|
||||||
protected static final int COL_VERIFIED = 1;
|
protected static final int COL_VERIFIED = 1;
|
||||||
|
|
@ -45,7 +45,7 @@ public class UserEmailTableModel implements TableModel {
|
||||||
private int index = -1;
|
private int index = -1;
|
||||||
private boolean finished;
|
private boolean finished;
|
||||||
|
|
||||||
public UserEmailTableModel(final User user) {
|
public EmailTableModel(final User user) {
|
||||||
this.emailAddresses = user.getEmailAddresses();
|
this.emailAddresses = user.getEmailAddresses();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -33,12 +33,12 @@ import org.libreccm.security.UserRepository;
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
public class UserEmailTableModelBuilder extends LockableImpl
|
class EmailTableModelBuilder extends LockableImpl
|
||||||
implements TableModelBuilder{
|
implements TableModelBuilder {
|
||||||
|
|
||||||
private final ParameterSingleSelectionModel<String> selectedUserId;
|
private final ParameterSingleSelectionModel<String> selectedUserId;
|
||||||
|
|
||||||
public UserEmailTableModelBuilder(
|
public EmailTableModelBuilder(
|
||||||
final ParameterSingleSelectionModel<String> selectedUserId) {
|
final ParameterSingleSelectionModel<String> selectedUserId) {
|
||||||
this.selectedUserId = selectedUserId;
|
this.selectedUserId = selectedUserId;
|
||||||
}
|
}
|
||||||
|
|
@ -56,7 +56,7 @@ public class UserEmailTableModelBuilder extends LockableImpl
|
||||||
selectedUser = userRepository.findById(userId);
|
selectedUser = userRepository.findById(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new UserEmailTableModel(selectedUser);
|
return new EmailTableModel(selectedUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,207 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2016 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package com.arsdigita.ui.admin.usersgroupsroles.users;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.ActionLink;
|
||||||
|
import com.arsdigita.bebop.BoxPanel;
|
||||||
|
import com.arsdigita.bebop.Form;
|
||||||
|
import com.arsdigita.bebop.FormData;
|
||||||
|
import com.arsdigita.bebop.Label;
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.bebop.ParameterSingleSelectionModel;
|
||||||
|
import com.arsdigita.bebop.SaveCancelSection;
|
||||||
|
import com.arsdigita.bebop.Text;
|
||||||
|
import com.arsdigita.bebop.form.CheckboxGroup;
|
||||||
|
import com.arsdigita.bebop.form.Option;
|
||||||
|
import com.arsdigita.globalization.GlobalizedMessage;
|
||||||
|
import com.arsdigita.util.UncheckedWrapperException;
|
||||||
|
|
||||||
|
import org.libreccm.cdi.utils.CdiUtil;
|
||||||
|
import org.libreccm.security.Group;
|
||||||
|
import org.libreccm.security.GroupManager;
|
||||||
|
import org.libreccm.security.GroupRepository;
|
||||||
|
import org.libreccm.security.User;
|
||||||
|
import org.libreccm.security.UserRepository;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.SortedSet;
|
||||||
|
import java.util.TooManyListenersException;
|
||||||
|
import java.util.TreeSet;
|
||||||
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
|
import static com.arsdigita.ui.admin.AdminUiConstants.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
class GroupMembershipsForm extends Form {
|
||||||
|
|
||||||
|
private static final String GROUPS_SELECTOR = "groupsselector";
|
||||||
|
|
||||||
|
private final CheckboxGroup groups;
|
||||||
|
private final SaveCancelSection saveCancelSection;
|
||||||
|
|
||||||
|
public GroupMembershipsForm(
|
||||||
|
final UserAdmin userAdmin,
|
||||||
|
final ParameterSingleSelectionModel<String> selectedUserId) {
|
||||||
|
|
||||||
|
super("edit-usergroupmemberships-form");
|
||||||
|
|
||||||
|
final BoxPanel links = new BoxPanel(BoxPanel.VERTICAL);
|
||||||
|
|
||||||
|
final Label heading = new Label(e -> {
|
||||||
|
final PageState state = e.getPageState();
|
||||||
|
final Label target = (Label) e.getTarget();
|
||||||
|
|
||||||
|
final String userIdStr = selectedUserId.getSelectedKey(state);
|
||||||
|
final UserRepository userRepository = CdiUtil.createCdiUtil()
|
||||||
|
.findBean(UserRepository.class);
|
||||||
|
final User user = userRepository.findById(Long.parseLong(userIdStr));
|
||||||
|
|
||||||
|
target.setLabel(new GlobalizedMessage(
|
||||||
|
"ui.admin.user.edit_group_memberships",
|
||||||
|
ADMIN_BUNDLE,
|
||||||
|
new String[]{user.getName()}));
|
||||||
|
});
|
||||||
|
heading.setClassAttr("heading");
|
||||||
|
links.add(heading);
|
||||||
|
|
||||||
|
final ActionLink backLink = new ActionLink(new GlobalizedMessage(
|
||||||
|
"ui.admin.user.edit_group_memberships.back_to_user_details",
|
||||||
|
ADMIN_BUNDLE));
|
||||||
|
backLink.addActionListener(e -> {
|
||||||
|
userAdmin.closeEditGroupMembershipsForm(e.getPageState());
|
||||||
|
});
|
||||||
|
links.add(backLink);
|
||||||
|
|
||||||
|
add(links);
|
||||||
|
|
||||||
|
groups = new CheckboxGroup(GROUPS_SELECTOR);
|
||||||
|
try {
|
||||||
|
groups.addPrintListener(e -> {
|
||||||
|
final CheckboxGroup target = (CheckboxGroup) e.getTarget();
|
||||||
|
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||||
|
final GroupRepository groupRepository = cdiUtil.findBean(
|
||||||
|
GroupRepository.class);
|
||||||
|
|
||||||
|
target.clearOptions();
|
||||||
|
|
||||||
|
final SortedSet<Group> allGroups = new TreeSet<>(
|
||||||
|
(g1, g2) -> {
|
||||||
|
return g1.getName().compareTo(g2.getName());
|
||||||
|
});
|
||||||
|
allGroups.addAll(groupRepository.findAll());
|
||||||
|
|
||||||
|
allGroups.forEach(g -> {
|
||||||
|
final Option option = new Option(
|
||||||
|
Long.toString(g.getPartyId()), new Text(g.getName()));
|
||||||
|
target.addOption(option);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} catch (TooManyListenersException ex) {
|
||||||
|
//This should never happen, and if its happens something is
|
||||||
|
//seriously wrong...
|
||||||
|
throw new UncheckedWrapperException(ex);
|
||||||
|
}
|
||||||
|
add(groups);
|
||||||
|
|
||||||
|
saveCancelSection = new SaveCancelSection();
|
||||||
|
add(saveCancelSection);
|
||||||
|
|
||||||
|
addInitListener(e -> {
|
||||||
|
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||||
|
final UserRepository userRepository = cdiUtil.findBean(
|
||||||
|
UserRepository.class);
|
||||||
|
|
||||||
|
final PageState state = e.getPageState();
|
||||||
|
|
||||||
|
final User user = userRepository.findById(Long.parseLong(
|
||||||
|
selectedUserId.getSelectedKey(state)));
|
||||||
|
final List<Group> assignedGroups = new ArrayList<>();
|
||||||
|
user.getGroupMemberships().forEach(m -> {
|
||||||
|
assignedGroups.add(m.getGroup());
|
||||||
|
});
|
||||||
|
|
||||||
|
final String[] selectedGroups = new String[assignedGroups.size()];
|
||||||
|
IntStream.range(0, assignedGroups.size()).forEach(i -> {
|
||||||
|
selectedGroups[i] = Long.toString(assignedGroups.get(i)
|
||||||
|
.getPartyId());
|
||||||
|
});
|
||||||
|
|
||||||
|
groups.setValue(state, selectedGroups);
|
||||||
|
});
|
||||||
|
|
||||||
|
addProcessListener(e -> {
|
||||||
|
final PageState state = e.getPageState();
|
||||||
|
if (saveCancelSection.getSaveButton().isSelected(state)) {
|
||||||
|
final FormData data = e.getFormData();
|
||||||
|
|
||||||
|
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||||
|
final UserRepository userRepository = cdiUtil.findBean(
|
||||||
|
UserRepository.class);
|
||||||
|
final GroupRepository groupRepository = cdiUtil.findBean(
|
||||||
|
GroupRepository.class);
|
||||||
|
final GroupManager groupManager = cdiUtil.findBean(
|
||||||
|
GroupManager.class);
|
||||||
|
|
||||||
|
final String[] selectedGroupIds = (String[]) data.get(
|
||||||
|
GROUPS_SELECTOR);
|
||||||
|
|
||||||
|
final User user = userRepository.findById(Long.parseLong(
|
||||||
|
selectedUserId.getSelectedKey(state)));
|
||||||
|
final List<Group> selectedGroups = new ArrayList<>();
|
||||||
|
if (selectedGroupIds != null) {
|
||||||
|
Arrays.stream(selectedGroupIds).forEach(id -> {
|
||||||
|
final Group group = groupRepository.findById(
|
||||||
|
Long.parseLong(id));
|
||||||
|
selectedGroups.add(group);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
final List<Group> assignedGroups = new ArrayList<>();
|
||||||
|
user.getGroupMemberships().forEach(m -> {
|
||||||
|
assignedGroups.add(m.getGroup());
|
||||||
|
});
|
||||||
|
|
||||||
|
//First check for newly added groups
|
||||||
|
selectedGroups.forEach(g -> {
|
||||||
|
if (!assignedGroups.contains(g)) {
|
||||||
|
groupManager.addMemberToGroup(user, g);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
//Than check for removed groups
|
||||||
|
assignedGroups.forEach(g -> {
|
||||||
|
if (!selectedGroups.contains(g)) {
|
||||||
|
//The group is maybe detached or not fully loaded,
|
||||||
|
//therefore we load the group from the database.
|
||||||
|
final Group group = groupRepository.findById(
|
||||||
|
g.getPartyId());
|
||||||
|
groupManager.removeMemberFromGroup(user, group);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
userAdmin.closeEditGroupMembershipsForm(state);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,104 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2016 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package com.arsdigita.ui.admin.usersgroupsroles.users;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.Component;
|
||||||
|
import com.arsdigita.bebop.ControlLink;
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.bebop.ParameterSingleSelectionModel;
|
||||||
|
import com.arsdigita.bebop.Table;
|
||||||
|
import com.arsdigita.bebop.Text;
|
||||||
|
import com.arsdigita.bebop.event.TableActionEvent;
|
||||||
|
import com.arsdigita.bebop.event.TableActionListener;
|
||||||
|
import com.arsdigita.bebop.table.TableCellRenderer;
|
||||||
|
import com.arsdigita.bebop.table.TableColumn;
|
||||||
|
import com.arsdigita.bebop.table.TableColumnModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
class GroupsRolesTable extends Table {
|
||||||
|
|
||||||
|
public GroupsRolesTable(
|
||||||
|
final UserAdmin userAdmin,
|
||||||
|
final ParameterSingleSelectionModel<String> selectedUserId) {
|
||||||
|
|
||||||
|
setModelBuilder(new GroupsRolesTableModelBuilder(
|
||||||
|
selectedUserId));
|
||||||
|
final TableColumnModel columnModel = getColumnModel();
|
||||||
|
columnModel.add(new TableColumn(
|
||||||
|
GroupsRolesTableModel.COL_LABEL));
|
||||||
|
columnModel
|
||||||
|
.add(new TableColumn(GroupsRolesTableModel.COL_VALUE));
|
||||||
|
columnModel.add(
|
||||||
|
new TableColumn(GroupsRolesTableModel.COL_ACTION));
|
||||||
|
columnModel.get(GroupsRolesTableModel.COL_ACTION)
|
||||||
|
.setCellRenderer(new TableCellRenderer() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Component getComponent(final Table table,
|
||||||
|
final PageState state,
|
||||||
|
final Object value,
|
||||||
|
final boolean isSelected,
|
||||||
|
final Object key,
|
||||||
|
final int row,
|
||||||
|
final int column) {
|
||||||
|
switch (row) {
|
||||||
|
case GroupsRolesTableModel.ROW_GROUPS: {
|
||||||
|
return new ControlLink((Component) value);
|
||||||
|
}
|
||||||
|
case GroupsRolesTableModel.ROW_ROLES: {
|
||||||
|
return new ControlLink((Component) value);
|
||||||
|
}
|
||||||
|
case GroupsRolesTableModel.ROW_ALL_ROLES:
|
||||||
|
return new Text("");
|
||||||
|
default:
|
||||||
|
throw new IllegalArgumentException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
addTableActionListener(new TableActionListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void cellSelected(final TableActionEvent event) {
|
||||||
|
final int selectedRow = Integer.parseInt((String) event
|
||||||
|
.getRowKey());
|
||||||
|
final PageState state = event.getPageState();
|
||||||
|
|
||||||
|
switch (selectedRow) {
|
||||||
|
case GroupsRolesTableModel.ROW_GROUPS:
|
||||||
|
userAdmin.showEditGroupMembershipsForm(state);
|
||||||
|
break;
|
||||||
|
case GroupsRolesTableModel.ROW_ROLES:
|
||||||
|
userAdmin.showEditRoleMembershipsForm(state);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void headSelected(final TableActionEvent event) {
|
||||||
|
//Nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -35,7 +35,7 @@ import static com.arsdigita.ui.admin.AdminUiConstants.*;
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
public class UserGroupsRolesTableModel implements TableModel {
|
class GroupsRolesTableModel implements TableModel {
|
||||||
|
|
||||||
protected static final int COL_LABEL = 0;
|
protected static final int COL_LABEL = 0;
|
||||||
protected static final int COL_VALUE = 1;
|
protected static final int COL_VALUE = 1;
|
||||||
|
|
@ -49,7 +49,7 @@ public class UserGroupsRolesTableModel implements TableModel {
|
||||||
|
|
||||||
private final User user;
|
private final User user;
|
||||||
|
|
||||||
public UserGroupsRolesTableModel(final User user) {
|
public GroupsRolesTableModel(final User user) {
|
||||||
this.user = user;
|
this.user = user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -33,12 +33,12 @@ import org.libreccm.security.UserRepository;
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
public class UserGroupsRolesTableModelBuilder extends LockableImpl
|
class GroupsRolesTableModelBuilder extends LockableImpl
|
||||||
implements TableModelBuilder{
|
implements TableModelBuilder{
|
||||||
|
|
||||||
private final ParameterSingleSelectionModel<String> selectedUserId;
|
private final ParameterSingleSelectionModel<String> selectedUserId;
|
||||||
|
|
||||||
public UserGroupsRolesTableModelBuilder(
|
public GroupsRolesTableModelBuilder(
|
||||||
final ParameterSingleSelectionModel<String> selectedUserId) {
|
final ParameterSingleSelectionModel<String> selectedUserId) {
|
||||||
this.selectedUserId = selectedUserId;
|
this.selectedUserId = selectedUserId;
|
||||||
}
|
}
|
||||||
|
|
@ -56,7 +56,7 @@ public class UserGroupsRolesTableModelBuilder extends LockableImpl
|
||||||
selectedUser = userRepository.findById(userId);
|
selectedUser = userRepository.findById(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new UserGroupsRolesTableModel(selectedUser);
|
return new GroupsRolesTableModel(selectedUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,317 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2016 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package com.arsdigita.ui.admin.usersgroupsroles.users;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.Form;
|
||||||
|
import com.arsdigita.bebop.FormData;
|
||||||
|
import com.arsdigita.bebop.FormProcessException;
|
||||||
|
import com.arsdigita.bebop.Label;
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.bebop.ParameterSingleSelectionModel;
|
||||||
|
import com.arsdigita.bebop.SaveCancelSection;
|
||||||
|
import com.arsdigita.bebop.form.Option;
|
||||||
|
import com.arsdigita.bebop.form.Password;
|
||||||
|
import com.arsdigita.bebop.form.RadioGroup;
|
||||||
|
import com.arsdigita.bebop.form.TextField;
|
||||||
|
import com.arsdigita.bebop.parameters.NotEmptyValidationListener;
|
||||||
|
import com.arsdigita.bebop.parameters.StringLengthValidationListener;
|
||||||
|
import com.arsdigita.globalization.GlobalizedMessage;
|
||||||
|
|
||||||
|
import org.apache.logging.log4j.util.Strings;
|
||||||
|
import org.libreccm.cdi.utils.CdiUtil;
|
||||||
|
import org.libreccm.security.ChallengeManager;
|
||||||
|
import org.libreccm.security.User;
|
||||||
|
import org.libreccm.security.UserManager;
|
||||||
|
import org.libreccm.security.UserRepository;
|
||||||
|
|
||||||
|
import javax.mail.MessagingException;
|
||||||
|
|
||||||
|
import static com.arsdigita.ui.admin.AdminUiConstants.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
class NewUserForm extends Form {
|
||||||
|
|
||||||
|
private static final String USER_NAME = "userName";
|
||||||
|
private static final String FAMILY_NAME = "familyName";
|
||||||
|
private static final String GIVEN_NAME = "givenName";
|
||||||
|
private static final String EMAIL = "email";
|
||||||
|
private static final String PASSWORD_OPTIONS = "passwordOptions";
|
||||||
|
private static final String PASSWORD_OPTION_SET = "passwordOptionSet";
|
||||||
|
private static final String PASSWORD_OPTION_SEND = "passwordOptionSend";
|
||||||
|
private static final String PASSWORD = "password";
|
||||||
|
private static final String PASSWORD_CONFIRMATION = "passwordConfirmation";
|
||||||
|
|
||||||
|
private final TextField userName;
|
||||||
|
private final TextField familyName;
|
||||||
|
private final TextField givenName;
|
||||||
|
private final TextField email;
|
||||||
|
private final RadioGroup passwordOptionsGroup;
|
||||||
|
private final Password password;
|
||||||
|
private final Password passwordConfirmation;
|
||||||
|
|
||||||
|
private final SaveCancelSection saveCancelSection;
|
||||||
|
|
||||||
|
public NewUserForm(
|
||||||
|
final UserAdmin userAdmin,
|
||||||
|
final ParameterSingleSelectionModel<String> selectedUserId) {
|
||||||
|
|
||||||
|
super("new_user_form");
|
||||||
|
|
||||||
|
userName = new TextField(USER_NAME);
|
||||||
|
userName.setLabel(new GlobalizedMessage(
|
||||||
|
"ui.admin.new_user_form.username.label", ADMIN_BUNDLE));
|
||||||
|
userName.setSize(32);
|
||||||
|
userName.setMaxLength(32);
|
||||||
|
add(userName);
|
||||||
|
|
||||||
|
familyName = new TextField(FAMILY_NAME);
|
||||||
|
familyName.setLabel(new GlobalizedMessage(
|
||||||
|
"ui.admin.new_user_form.familyname.label", ADMIN_BUNDLE));
|
||||||
|
familyName.setSize(32);
|
||||||
|
familyName.setMaxLength(256);
|
||||||
|
add(familyName);
|
||||||
|
|
||||||
|
givenName = new TextField(GIVEN_NAME);
|
||||||
|
givenName.setLabel(new GlobalizedMessage(
|
||||||
|
"ui.admin.new_user_form.givenname.label", ADMIN_BUNDLE));
|
||||||
|
givenName.setSize(32);
|
||||||
|
givenName.setMaxLength(256);
|
||||||
|
add(givenName);
|
||||||
|
|
||||||
|
email = new TextField(EMAIL);
|
||||||
|
email.setLabel(new GlobalizedMessage(
|
||||||
|
"ui.admin.new_user_form.email.label", ADMIN_BUNDLE));
|
||||||
|
email.setSize(48);
|
||||||
|
email.setMaxLength(256);
|
||||||
|
add(email);
|
||||||
|
|
||||||
|
passwordOptionsGroup = new RadioGroup(PASSWORD_OPTIONS);
|
||||||
|
final Option sendPasswordOption = new Option(
|
||||||
|
PASSWORD_OPTION_SEND,
|
||||||
|
new Label(new GlobalizedMessage(
|
||||||
|
"ui.admin.new_user_form.password_options.send_password.label",
|
||||||
|
ADMIN_BUNDLE)));
|
||||||
|
passwordOptionsGroup.addOption(sendPasswordOption);
|
||||||
|
final Option setPasswordOption = new Option(
|
||||||
|
PASSWORD_OPTION_SET,
|
||||||
|
new Label(new GlobalizedMessage(
|
||||||
|
"ui.admin.new_user_form.password_options.set_password",
|
||||||
|
ADMIN_BUNDLE)));
|
||||||
|
passwordOptionsGroup.addOption(setPasswordOption);
|
||||||
|
add(passwordOptionsGroup);
|
||||||
|
|
||||||
|
password = new Password(PASSWORD);
|
||||||
|
password.setLabel(new GlobalizedMessage(
|
||||||
|
"ui.admin.new_user_form.password_options.set_password.password.label",
|
||||||
|
ADMIN_BUNDLE));
|
||||||
|
password.setMaxLength(256);
|
||||||
|
password.setSize(32);
|
||||||
|
add(password);
|
||||||
|
|
||||||
|
passwordConfirmation = new Password(PASSWORD_CONFIRMATION);
|
||||||
|
passwordConfirmation.setLabel(new GlobalizedMessage(
|
||||||
|
"ui.admin.new_user_form.password_options."
|
||||||
|
+ "set_password.password_confirmation.label",
|
||||||
|
ADMIN_BUNDLE));
|
||||||
|
passwordConfirmation.setMaxLength(256);
|
||||||
|
passwordConfirmation.setSize(32);
|
||||||
|
add(passwordConfirmation);
|
||||||
|
|
||||||
|
saveCancelSection = new SaveCancelSection();
|
||||||
|
add(saveCancelSection);
|
||||||
|
|
||||||
|
addValidationListener(e -> {
|
||||||
|
final PageState state = e.getPageState();
|
||||||
|
|
||||||
|
if (saveCancelSection.getSaveButton().isSelected(state)) {
|
||||||
|
final FormData data = e.getFormData();
|
||||||
|
|
||||||
|
final String userNameData = data.getString(USER_NAME);
|
||||||
|
final String familyNameData = data.getString(FAMILY_NAME);
|
||||||
|
final String givenNameData = data.getString(GIVEN_NAME);
|
||||||
|
final String emailData = data.getString(EMAIL);
|
||||||
|
|
||||||
|
if (Strings.isBlank(userNameData)) {
|
||||||
|
data.addError(
|
||||||
|
USER_NAME,
|
||||||
|
new GlobalizedMessage(
|
||||||
|
"ui.admin.new_user_form.error.username.is_empty",
|
||||||
|
ADMIN_BUNDLE));
|
||||||
|
}
|
||||||
|
if (userNameData != null && userNameData.length() > 32) {
|
||||||
|
data.addError(
|
||||||
|
USER_NAME,
|
||||||
|
new GlobalizedMessage(
|
||||||
|
"ui.admin.new_user_form.error.username.too_long",
|
||||||
|
ADMIN_BUNDLE));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Strings.isBlank(familyNameData)) {
|
||||||
|
data.addError(
|
||||||
|
FAMILY_NAME,
|
||||||
|
new GlobalizedMessage(
|
||||||
|
"ui.admin.new_user_form.error.familyname.is_empty",
|
||||||
|
ADMIN_BUNDLE));
|
||||||
|
}
|
||||||
|
if (familyNameData != null && familyNameData.length() > 256) {
|
||||||
|
data.addError(
|
||||||
|
FAMILY_NAME,
|
||||||
|
new GlobalizedMessage(
|
||||||
|
"ui.admin.new_user_form.error.familyname.too_long",
|
||||||
|
ADMIN_BUNDLE));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Strings.isBlank(givenNameData)) {
|
||||||
|
data.addError(
|
||||||
|
GIVEN_NAME,
|
||||||
|
new GlobalizedMessage(
|
||||||
|
"ui.admin.new_user_form.error.givenname.is_empty",
|
||||||
|
ADMIN_BUNDLE));
|
||||||
|
}
|
||||||
|
if (givenNameData != null && givenNameData.length() > 256) {
|
||||||
|
data.addError(
|
||||||
|
GIVEN_NAME,
|
||||||
|
new GlobalizedMessage(
|
||||||
|
"ui.admin.new_user_form.error.givenname.too_long",
|
||||||
|
ADMIN_BUNDLE));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Strings.isBlank(emailData)) {
|
||||||
|
data.addError(
|
||||||
|
EMAIL,
|
||||||
|
new GlobalizedMessage(
|
||||||
|
"ui.admin.new_user_form.error.email.is_empty",
|
||||||
|
ADMIN_BUNDLE));
|
||||||
|
}
|
||||||
|
if (emailData != null && emailData.length() > 256) {
|
||||||
|
data.addError(
|
||||||
|
EMAIL,
|
||||||
|
new GlobalizedMessage(
|
||||||
|
"ui.admin.new_user_form.error.email.too_long",
|
||||||
|
ADMIN_BUNDLE));
|
||||||
|
}
|
||||||
|
|
||||||
|
final String selectedPasswordOption = data.getString(
|
||||||
|
PASSWORD_OPTIONS);
|
||||||
|
|
||||||
|
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||||
|
final UserRepository userRepository = cdiUtil.findBean(
|
||||||
|
UserRepository.class);
|
||||||
|
|
||||||
|
if (userRepository.findByName(userNameData) != null) {
|
||||||
|
data.addError(new GlobalizedMessage(
|
||||||
|
"ui.admin.new_user_form.error.username_already_in_use",
|
||||||
|
ADMIN_BUNDLE));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (userRepository.findByEmailAddress(emailData) != null) {
|
||||||
|
data.addError(new GlobalizedMessage(
|
||||||
|
"ui.admin.new_user_form.error.email_already_in_use",
|
||||||
|
ADMIN_BUNDLE));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (PASSWORD_OPTION_SET.equals(selectedPasswordOption)) {
|
||||||
|
final String passwordData = data.getString(PASSWORD);
|
||||||
|
final String passwordConfirmData = data.getString(
|
||||||
|
PASSWORD_CONFIRMATION);
|
||||||
|
|
||||||
|
if (Strings.isBlank(passwordData)) {
|
||||||
|
data.addError(
|
||||||
|
PASSWORD,
|
||||||
|
new GlobalizedMessage(
|
||||||
|
"ui.admin.new_user_form.error.password.is_empty",
|
||||||
|
ADMIN_BUNDLE));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Strings.isBlank(passwordConfirmData)) {
|
||||||
|
data.addError(
|
||||||
|
PASSWORD_CONFIRMATION,
|
||||||
|
new GlobalizedMessage(
|
||||||
|
"ui.admin.new_user_form.error.password.is_empty",
|
||||||
|
ADMIN_BUNDLE));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!passwordData.equals(passwordConfirmData)) {
|
||||||
|
data.addError(
|
||||||
|
PASSWORD,
|
||||||
|
new GlobalizedMessage(
|
||||||
|
"ui.admin.new_user_form.error.password_do_not_match",
|
||||||
|
ADMIN_BUNDLE));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
addProcessListener(e -> {
|
||||||
|
final PageState state = e.getPageState();
|
||||||
|
|
||||||
|
if (saveCancelSection.getSaveButton().isSelected(state)) {
|
||||||
|
final FormData data = e.getFormData();
|
||||||
|
|
||||||
|
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||||
|
final UserManager userManager = cdiUtil.findBean(
|
||||||
|
UserManager.class);
|
||||||
|
|
||||||
|
final String dataUserName = data.getString(USER_NAME);
|
||||||
|
final String dataFamilyName = data.getString(FAMILY_NAME);
|
||||||
|
final String dataGivenName = data.getString(GIVEN_NAME);
|
||||||
|
final String dataEmail = data.getString(EMAIL);
|
||||||
|
final String dataSelectedPasswordOption = data.getString(
|
||||||
|
PASSWORD_OPTIONS);
|
||||||
|
|
||||||
|
final String dataPassword;
|
||||||
|
if (PASSWORD_OPTION_SET.equals(dataSelectedPasswordOption)) {
|
||||||
|
dataPassword = data.getString(PASSWORD);
|
||||||
|
} else {
|
||||||
|
dataPassword = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
final User user = userManager.createUser(dataGivenName,
|
||||||
|
dataFamilyName,
|
||||||
|
dataUserName,
|
||||||
|
dataEmail,
|
||||||
|
dataPassword);
|
||||||
|
|
||||||
|
if (PASSWORD_OPTION_SEND.equals(dataSelectedPasswordOption)) {
|
||||||
|
final ChallengeManager challengeManager = cdiUtil.findBean(
|
||||||
|
ChallengeManager.class);
|
||||||
|
|
||||||
|
try {
|
||||||
|
challengeManager.sendPasswordRecover(user);
|
||||||
|
} catch (MessagingException ex) {
|
||||||
|
throw new FormProcessException(
|
||||||
|
"Failed to send password challenge to new user.",
|
||||||
|
new GlobalizedMessage(
|
||||||
|
"ui.admin.new_user_form.error.failed_to_send_password",
|
||||||
|
ADMIN_BUNDLE),
|
||||||
|
ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
userAdmin.closeNewUserForm(state);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,128 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2016 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package com.arsdigita.ui.admin.usersgroupsroles.users;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.Form;
|
||||||
|
import com.arsdigita.bebop.FormData;
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.bebop.ParameterSingleSelectionModel;
|
||||||
|
import com.arsdigita.bebop.SaveCancelSection;
|
||||||
|
import com.arsdigita.bebop.form.Password;
|
||||||
|
import com.arsdigita.bebop.parameters.NotEmptyValidationListener;
|
||||||
|
import com.arsdigita.globalization.GlobalizedMessage;
|
||||||
|
|
||||||
|
import org.apache.logging.log4j.util.Strings;
|
||||||
|
import org.libreccm.cdi.utils.CdiUtil;
|
||||||
|
import org.libreccm.security.User;
|
||||||
|
import org.libreccm.security.UserManager;
|
||||||
|
import org.libreccm.security.UserRepository;
|
||||||
|
|
||||||
|
import static com.arsdigita.ui.admin.AdminUiConstants.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
class PasswordSetForm extends Form {
|
||||||
|
|
||||||
|
private static final String NEW_PASSWORD = "new_password";
|
||||||
|
private static final String PASSWORD_CONFIRM = "password_confirm";
|
||||||
|
|
||||||
|
private final Password newPassword;
|
||||||
|
private final Password passwordConfirm;
|
||||||
|
private final SaveCancelSection saveCancelSection;
|
||||||
|
|
||||||
|
public PasswordSetForm(
|
||||||
|
final UserAdmin userAdmin,
|
||||||
|
final ParameterSingleSelectionModel<String> selectedUserId) {
|
||||||
|
|
||||||
|
super("password_set_form");
|
||||||
|
|
||||||
|
newPassword = new Password(NEW_PASSWORD);
|
||||||
|
newPassword.setLabel(new GlobalizedMessage(
|
||||||
|
"ui.admin.user_set_password.new_password.label", ADMIN_BUNDLE));
|
||||||
|
add(newPassword);
|
||||||
|
|
||||||
|
passwordConfirm = new Password(PASSWORD_CONFIRM);
|
||||||
|
passwordConfirm.setLabel(new GlobalizedMessage(
|
||||||
|
"ui.admin.user_set_password.confirm_password.label",
|
||||||
|
ADMIN_BUNDLE
|
||||||
|
));
|
||||||
|
add(passwordConfirm);
|
||||||
|
|
||||||
|
saveCancelSection = new SaveCancelSection();
|
||||||
|
add(saveCancelSection);
|
||||||
|
|
||||||
|
addValidationListener(e -> {
|
||||||
|
final PageState state = e.getPageState();
|
||||||
|
|
||||||
|
if (saveCancelSection.getSaveButton().isSelected(state)) {
|
||||||
|
final FormData data = e.getFormData();
|
||||||
|
|
||||||
|
final String passwordData = data.getString(NEW_PASSWORD);
|
||||||
|
final String confirmData = data.getString(PASSWORD_CONFIRM);
|
||||||
|
|
||||||
|
if (Strings.isEmpty(passwordData)) {
|
||||||
|
data.addError(
|
||||||
|
NEW_PASSWORD,
|
||||||
|
new GlobalizedMessage(
|
||||||
|
"ui.admin.set_password.new_password.error.not_empty",
|
||||||
|
ADMIN_BUNDLE));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Strings.isEmpty(confirmData)) {
|
||||||
|
data.addError(
|
||||||
|
PASSWORD_CONFIRM,
|
||||||
|
new GlobalizedMessage(
|
||||||
|
"ui.admin.set_password.password_confirm.error.not_empty",
|
||||||
|
ADMIN_BUNDLE));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!passwordData.equals(confirmData)) {
|
||||||
|
data.addError(new GlobalizedMessage(
|
||||||
|
"ui.admin.user_set_password.error.do_not_match",
|
||||||
|
ADMIN_BUNDLE));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
addProcessListener(e -> {
|
||||||
|
final PageState state = e.getPageState();
|
||||||
|
|
||||||
|
if (saveCancelSection.getSaveButton().isSelected(state)) {
|
||||||
|
final String userIdStr = selectedUserId.getSelectedKey(state);
|
||||||
|
final String password = (String) newPassword.getValue(state);
|
||||||
|
|
||||||
|
final UserRepository userRepository = CdiUtil.createCdiUtil()
|
||||||
|
.findBean(UserRepository.class);
|
||||||
|
final User user = userRepository.findById(Long.parseLong(
|
||||||
|
userIdStr));
|
||||||
|
|
||||||
|
final UserManager userManager = CdiUtil.createCdiUtil()
|
||||||
|
.findBean(
|
||||||
|
UserManager.class);
|
||||||
|
userManager.updatePassword(user, password);
|
||||||
|
}
|
||||||
|
userAdmin.closePasswordSetForm(state);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,106 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2016 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package com.arsdigita.ui.admin.usersgroupsroles.users;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.Component;
|
||||||
|
import com.arsdigita.bebop.ControlLink;
|
||||||
|
import com.arsdigita.bebop.Label;
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.bebop.ParameterSingleSelectionModel;
|
||||||
|
import com.arsdigita.bebop.Table;
|
||||||
|
import com.arsdigita.bebop.event.TableActionEvent;
|
||||||
|
import com.arsdigita.bebop.event.TableActionListener;
|
||||||
|
import com.arsdigita.bebop.table.TableCellRenderer;
|
||||||
|
import com.arsdigita.bebop.table.TableColumn;
|
||||||
|
import com.arsdigita.bebop.table.TableColumnModel;
|
||||||
|
import com.arsdigita.globalization.GlobalizedMessage;
|
||||||
|
|
||||||
|
import static com.arsdigita.ui.admin.AdminUiConstants.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
class PrimaryEmailTable extends Table {
|
||||||
|
|
||||||
|
public PrimaryEmailTable(
|
||||||
|
final UserAdmin userAdmin,
|
||||||
|
final ParameterSingleSelectionModel<String> selectedUserId,
|
||||||
|
final ParameterSingleSelectionModel<String> selectedEmailAddress) {
|
||||||
|
|
||||||
|
setModelBuilder(new PrimaryEmailTableModelBuilder(selectedUserId));
|
||||||
|
|
||||||
|
final TableColumnModel columnModel = getColumnModel();
|
||||||
|
|
||||||
|
columnModel.add(new TableColumn(
|
||||||
|
PrimaryEmailTableModel.COL_ADDRESS,
|
||||||
|
new Label(new GlobalizedMessage(
|
||||||
|
"ui.admin.user.primary_email.address",
|
||||||
|
ADMIN_BUNDLE))));
|
||||||
|
columnModel.add(new TableColumn(
|
||||||
|
PrimaryEmailTableModel.COL_VERIFIED,
|
||||||
|
new Label(new GlobalizedMessage(
|
||||||
|
"ui.admin.user.primary_email.verified",
|
||||||
|
ADMIN_BUNDLE))));
|
||||||
|
columnModel.add(new TableColumn(
|
||||||
|
PrimaryEmailTableModel.COL_BOUNCING,
|
||||||
|
new Label(new GlobalizedMessage(
|
||||||
|
"ui.admin.user.primary_email.bouncing",
|
||||||
|
ADMIN_BUNDLE))));
|
||||||
|
columnModel.add(new TableColumn(
|
||||||
|
PrimaryEmailTableModel.COL_ACTION,
|
||||||
|
new Label(new GlobalizedMessage(
|
||||||
|
"ui.admin.user.primary_email.action",
|
||||||
|
ADMIN_BUNDLE))));
|
||||||
|
columnModel.get(
|
||||||
|
PrimaryEmailTableModel.COL_ACTION).setCellRenderer(
|
||||||
|
new TableCellRenderer() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Component getComponent(final Table table,
|
||||||
|
final PageState state,
|
||||||
|
final Object value,
|
||||||
|
final boolean isSelected,
|
||||||
|
final Object key,
|
||||||
|
final int row,
|
||||||
|
final int column) {
|
||||||
|
return new ControlLink((Component) value);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
addTableActionListener(new TableActionListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void cellSelected(final TableActionEvent event) {
|
||||||
|
final String key = (String) event.getRowKey();
|
||||||
|
selectedEmailAddress.setSelectedKey(event.getPageState(), key);
|
||||||
|
userAdmin.showEmailForm(event.getPageState());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void headSelected(final TableActionEvent event) {
|
||||||
|
//Nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -30,7 +30,7 @@ import static com.arsdigita.ui.admin.AdminUiConstants.*;
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
public class UserPrimaryEmailTableModel implements TableModel {
|
class PrimaryEmailTableModel implements TableModel {
|
||||||
|
|
||||||
protected static final int COL_ADDRESS = 0;
|
protected static final int COL_ADDRESS = 0;
|
||||||
protected static final int COL_VERIFIED = 1;
|
protected static final int COL_VERIFIED = 1;
|
||||||
|
|
@ -40,7 +40,7 @@ public class UserPrimaryEmailTableModel implements TableModel {
|
||||||
private final User user;
|
private final User user;
|
||||||
private boolean finished = false;
|
private boolean finished = false;
|
||||||
|
|
||||||
public UserPrimaryEmailTableModel(final User user) {
|
public PrimaryEmailTableModel(final User user) {
|
||||||
this.user = user;
|
this.user = user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -33,12 +33,12 @@ import org.libreccm.security.UserRepository;
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
public class UserPrimaryEmailTableModelBuilder extends LockableImpl
|
class PrimaryEmailTableModelBuilder extends LockableImpl
|
||||||
implements TableModelBuilder {
|
implements TableModelBuilder {
|
||||||
|
|
||||||
private final ParameterSingleSelectionModel<String> selectedUserId;
|
private final ParameterSingleSelectionModel<String> selectedUserId;
|
||||||
|
|
||||||
public UserPrimaryEmailTableModelBuilder(
|
public PrimaryEmailTableModelBuilder(
|
||||||
final ParameterSingleSelectionModel<String> selectedUserId) {
|
final ParameterSingleSelectionModel<String> selectedUserId) {
|
||||||
this.selectedUserId = selectedUserId;
|
this.selectedUserId = selectedUserId;
|
||||||
}
|
}
|
||||||
|
|
@ -56,7 +56,7 @@ public class UserPrimaryEmailTableModelBuilder extends LockableImpl
|
||||||
selectedUser = userRepository.findById(userId);
|
selectedUser = userRepository.findById(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new UserPrimaryEmailTableModel(selectedUser);
|
return new PrimaryEmailTableModel(selectedUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,208 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2016 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package com.arsdigita.ui.admin.usersgroupsroles.users;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.ActionLink;
|
||||||
|
import com.arsdigita.bebop.BoxPanel;
|
||||||
|
import com.arsdigita.bebop.Form;
|
||||||
|
import com.arsdigita.bebop.FormData;
|
||||||
|
import com.arsdigita.bebop.Label;
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.bebop.ParameterSingleSelectionModel;
|
||||||
|
import com.arsdigita.bebop.SaveCancelSection;
|
||||||
|
import com.arsdigita.bebop.Text;
|
||||||
|
import com.arsdigita.bebop.form.CheckboxGroup;
|
||||||
|
import com.arsdigita.bebop.form.Option;
|
||||||
|
import com.arsdigita.globalization.GlobalizedMessage;
|
||||||
|
import com.arsdigita.util.UncheckedWrapperException;
|
||||||
|
|
||||||
|
import org.libreccm.cdi.utils.CdiUtil;
|
||||||
|
import org.libreccm.security.Role;
|
||||||
|
import org.libreccm.security.RoleManager;
|
||||||
|
import org.libreccm.security.RoleRepository;
|
||||||
|
import org.libreccm.security.User;
|
||||||
|
import org.libreccm.security.UserRepository;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.SortedSet;
|
||||||
|
import java.util.TooManyListenersException;
|
||||||
|
import java.util.TreeSet;
|
||||||
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
|
import static com.arsdigita.ui.admin.AdminUiConstants.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
class RoleMembershipsForm extends Form {
|
||||||
|
|
||||||
|
private static final String ROLES_SELECTOR = "rolesselector";
|
||||||
|
|
||||||
|
private final CheckboxGroup roles;
|
||||||
|
private final SaveCancelSection saveCancelSection;
|
||||||
|
|
||||||
|
public RoleMembershipsForm(
|
||||||
|
final UserAdmin userAdmin,
|
||||||
|
final ParameterSingleSelectionModel<String> selectedUserId) {
|
||||||
|
|
||||||
|
super("edit-userrolesmemberships-form");
|
||||||
|
|
||||||
|
final BoxPanel links = new BoxPanel(BoxPanel.VERTICAL);
|
||||||
|
final Label heading = new Label(e -> {
|
||||||
|
final PageState state = e.getPageState();
|
||||||
|
final Label target = (Label) e.getTarget();
|
||||||
|
|
||||||
|
final String userIdStr = selectedUserId.getSelectedKey(state);
|
||||||
|
final UserRepository userRepository = CdiUtil.createCdiUtil()
|
||||||
|
.findBean(UserRepository.class);
|
||||||
|
final User user = userRepository.findById(Long.parseLong(userIdStr));
|
||||||
|
|
||||||
|
target.setLabel(new GlobalizedMessage(
|
||||||
|
"ui.admin.user_edit_role_memberships",
|
||||||
|
ADMIN_BUNDLE,
|
||||||
|
new String[]{user.getName()}));
|
||||||
|
});
|
||||||
|
heading.setClassAttr("heading");
|
||||||
|
links.add(heading);
|
||||||
|
|
||||||
|
final ActionLink backLink = new ActionLink(new GlobalizedMessage(
|
||||||
|
"ui.admin.user.edit_role_memberships.back_to_user_details",
|
||||||
|
ADMIN_BUNDLE));
|
||||||
|
backLink.addActionListener(e -> {
|
||||||
|
userAdmin.closeEditRoleMembershipsForm(e.getPageState());
|
||||||
|
});
|
||||||
|
links.add(backLink);
|
||||||
|
|
||||||
|
add(links);
|
||||||
|
|
||||||
|
roles = new CheckboxGroup(ROLES_SELECTOR);
|
||||||
|
try {
|
||||||
|
roles.addPrintListener(e -> {
|
||||||
|
final CheckboxGroup target = (CheckboxGroup) e.getTarget();
|
||||||
|
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||||
|
|
||||||
|
final RoleRepository roleRepository = cdiUtil.findBean(
|
||||||
|
RoleRepository.class);
|
||||||
|
|
||||||
|
target.clearOptions();
|
||||||
|
|
||||||
|
final SortedSet<Role> allRoles = new TreeSet<>(
|
||||||
|
(r1, r2) -> {
|
||||||
|
return r1.getName().compareTo(r2.getName());
|
||||||
|
});
|
||||||
|
allRoles.addAll(roleRepository.findAll());
|
||||||
|
|
||||||
|
allRoles.forEach(r -> {
|
||||||
|
final Option option = new Option(Long.toString(
|
||||||
|
r.getRoleId()), new Text(r.getName()));
|
||||||
|
target.addOption(option);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} catch (TooManyListenersException ex) {
|
||||||
|
//This should never happen, and if its happens something is
|
||||||
|
//seriously wrong...
|
||||||
|
throw new UncheckedWrapperException(ex);
|
||||||
|
}
|
||||||
|
add(roles);
|
||||||
|
|
||||||
|
saveCancelSection = new SaveCancelSection();
|
||||||
|
add(saveCancelSection);
|
||||||
|
|
||||||
|
addInitListener(e -> {
|
||||||
|
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||||
|
final UserRepository userRepository = cdiUtil.findBean(
|
||||||
|
UserRepository.class);
|
||||||
|
|
||||||
|
final PageState state = e.getPageState();
|
||||||
|
|
||||||
|
final User user = userRepository.findById(Long.parseLong(
|
||||||
|
selectedUserId.getSelectedKey(state)));
|
||||||
|
final List<Role> assignedRoles = new ArrayList<>();
|
||||||
|
user.getRoleMemberships().forEach(m -> {
|
||||||
|
assignedRoles.add(m.getRole());
|
||||||
|
});
|
||||||
|
|
||||||
|
final String[] selectedRoles = new String[assignedRoles.size()];
|
||||||
|
IntStream.range(0, assignedRoles.size()).forEach(i -> {
|
||||||
|
selectedRoles[i] = Long.toString(assignedRoles.get(i)
|
||||||
|
.getRoleId());
|
||||||
|
});
|
||||||
|
|
||||||
|
roles.setValue(state, selectedRoles);
|
||||||
|
});
|
||||||
|
|
||||||
|
addProcessListener(e -> {
|
||||||
|
final PageState state = e.getPageState();
|
||||||
|
|
||||||
|
if (saveCancelSection.getSaveButton().isSelected(state)) {
|
||||||
|
|
||||||
|
final FormData data = e.getFormData();
|
||||||
|
|
||||||
|
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||||
|
final UserRepository userRepository = cdiUtil.findBean(
|
||||||
|
UserRepository.class);
|
||||||
|
final RoleRepository roleRepository = cdiUtil.findBean(
|
||||||
|
RoleRepository.class);
|
||||||
|
final RoleManager roleManager = cdiUtil.findBean(
|
||||||
|
RoleManager.class);
|
||||||
|
|
||||||
|
final String[] selectedRolesIds = (String[]) data.get(
|
||||||
|
ROLES_SELECTOR);
|
||||||
|
|
||||||
|
final User user = userRepository.findById(Long.parseLong(
|
||||||
|
selectedUserId.getSelectedKey(state)));
|
||||||
|
final List<Role> selectedRoles = new ArrayList<>();
|
||||||
|
if (selectedRolesIds != null) {
|
||||||
|
Arrays.stream(selectedRolesIds).forEach(id -> {
|
||||||
|
final Role role = roleRepository.findById(
|
||||||
|
Long.parseLong(id));
|
||||||
|
selectedRoles.add(role);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
final List<Role> assignedRoles = new ArrayList<>();
|
||||||
|
user.getRoleMemberships().forEach(m -> {
|
||||||
|
assignedRoles.add(m.getRole());
|
||||||
|
});
|
||||||
|
|
||||||
|
//First check for newly added roles
|
||||||
|
selectedRoles.forEach(r -> {
|
||||||
|
if (!assignedRoles.contains(r)) {
|
||||||
|
roleManager.assignRoleToParty(r, user);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
//Than check for removed roles
|
||||||
|
assignedRoles.forEach(r -> {
|
||||||
|
if (!selectedRoles.contains(r)) {
|
||||||
|
//Role is maybe detached or not fully loaded,
|
||||||
|
//therefore we load the role from the database.
|
||||||
|
final Role role = roleRepository.findById(r.getRoleId());
|
||||||
|
roleManager.removeRoleFromParty(role, user);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
userAdmin.closeEditRoleMembershipsForm(state);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -30,11 +30,12 @@ import static com.arsdigita.ui.admin.AdminUiConstants.*;
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
public class UserDetails extends BoxPanel {
|
class UserDetails extends BoxPanel {
|
||||||
|
|
||||||
public UserDetails(
|
public UserDetails(
|
||||||
final UserAdmin userAdmin,
|
final UserAdmin userAdmin,
|
||||||
final ParameterSingleSelectionModel<String> selectedUserId) {
|
final ParameterSingleSelectionModel<String> selectedUserId,
|
||||||
|
final ParameterSingleSelectionModel<String> selectedEmailAddress) {
|
||||||
|
|
||||||
super(BoxPanel.VERTICAL);
|
super(BoxPanel.VERTICAL);
|
||||||
|
|
||||||
|
|
@ -52,6 +53,21 @@ public class UserDetails extends BoxPanel {
|
||||||
new UserPropertySheetModelBuilder(selectedUserId));
|
new UserPropertySheetModelBuilder(selectedUserId));
|
||||||
userProperties.setIdAttr("userProperties");
|
userProperties.setIdAttr("userProperties");
|
||||||
add(userProperties);
|
add(userProperties);
|
||||||
|
|
||||||
|
add(new ActionLinks(userAdmin, selectedUserId));
|
||||||
|
add(new PrimaryEmailTable(userAdmin,
|
||||||
|
selectedUserId,
|
||||||
|
selectedEmailAddress));
|
||||||
|
add(new EmailTable(userAdmin, selectedUserId, selectedEmailAddress));
|
||||||
|
final ActionLink addEmailLink = new ActionLink(new GlobalizedMessage(
|
||||||
|
"ui.admin.user.email_addresses.add", ADMIN_BUNDLE));
|
||||||
|
addEmailLink.addActionListener(e -> {
|
||||||
|
userAdmin.showEmailForm(e.getPageState());
|
||||||
|
});
|
||||||
|
add(addEmailLink);
|
||||||
|
|
||||||
|
add(new GroupsRolesTable(userAdmin, selectedUserId));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,191 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2016 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package com.arsdigita.ui.admin.usersgroupsroles.users;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.Form;
|
||||||
|
import com.arsdigita.bebop.FormData;
|
||||||
|
import com.arsdigita.bebop.Label;
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.bebop.ParameterSingleSelectionModel;
|
||||||
|
import com.arsdigita.bebop.SaveCancelSection;
|
||||||
|
import com.arsdigita.bebop.form.CheckboxGroup;
|
||||||
|
import com.arsdigita.bebop.form.Option;
|
||||||
|
import com.arsdigita.bebop.form.TextField;
|
||||||
|
import com.arsdigita.globalization.GlobalizedMessage;
|
||||||
|
|
||||||
|
import org.apache.logging.log4j.util.Strings;
|
||||||
|
import org.libreccm.cdi.utils.CdiUtil;
|
||||||
|
import org.libreccm.security.User;
|
||||||
|
import org.libreccm.security.UserRepository;
|
||||||
|
|
||||||
|
import static com.arsdigita.ui.admin.AdminUiConstants.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
class UserEditForm extends Form {
|
||||||
|
|
||||||
|
private static final String USER_NAME = "username";
|
||||||
|
private static final String FAMILY_NAME = "familyName";
|
||||||
|
private static final String BANNED = "banned";
|
||||||
|
private static final String GIVEN_NAME = "givenName";
|
||||||
|
|
||||||
|
private final TextField userName;
|
||||||
|
private final TextField familyName;
|
||||||
|
private final TextField givenName;
|
||||||
|
private final CheckboxGroup banned;
|
||||||
|
private final CheckboxGroup passwordResetRequired;
|
||||||
|
private final SaveCancelSection saveCancelSection;
|
||||||
|
|
||||||
|
public UserEditForm(
|
||||||
|
final UserAdmin userAdmin,
|
||||||
|
final ParameterSingleSelectionModel<String> selectedUserId) {
|
||||||
|
|
||||||
|
super("userEditForm");
|
||||||
|
|
||||||
|
userName = new TextField(USER_NAME);
|
||||||
|
userName.setLabel(new GlobalizedMessage(
|
||||||
|
"ui.admin.user_edit.username.label", ADMIN_BUNDLE));
|
||||||
|
add(userName);
|
||||||
|
|
||||||
|
familyName = new TextField(FAMILY_NAME);
|
||||||
|
familyName.setLabel(new GlobalizedMessage(
|
||||||
|
"ui.admin.user_edit.familyname.label", ADMIN_BUNDLE));
|
||||||
|
add(familyName);
|
||||||
|
|
||||||
|
givenName = new TextField(GIVEN_NAME);
|
||||||
|
givenName.setLabel(new GlobalizedMessage(
|
||||||
|
"ui.admin.user_edit.givenname.label", ADMIN_BUNDLE));
|
||||||
|
add(givenName);
|
||||||
|
|
||||||
|
banned = new CheckboxGroup(BANNED);
|
||||||
|
banned.addOption(new Option(
|
||||||
|
"banned",
|
||||||
|
new Label(new GlobalizedMessage("ui.admin.user_edit.banned.label",
|
||||||
|
ADMIN_BUNDLE))));
|
||||||
|
add(banned);
|
||||||
|
|
||||||
|
passwordResetRequired = new CheckboxGroup(
|
||||||
|
"password_reset_required");
|
||||||
|
passwordResetRequired.addOption(new Option(
|
||||||
|
"password_reset_required",
|
||||||
|
new Label(new GlobalizedMessage(
|
||||||
|
"ui.admin.user_edit.password_reset_required.label",
|
||||||
|
ADMIN_BUNDLE))
|
||||||
|
));
|
||||||
|
add(passwordResetRequired);
|
||||||
|
|
||||||
|
saveCancelSection = new SaveCancelSection();
|
||||||
|
add(saveCancelSection);
|
||||||
|
|
||||||
|
addInitListener(e -> {
|
||||||
|
final PageState state = e.getPageState();
|
||||||
|
|
||||||
|
final String userIdStr = selectedUserId.getSelectedKey(state);
|
||||||
|
final UserRepository userRepository = CdiUtil.createCdiUtil()
|
||||||
|
.findBean(UserRepository.class);
|
||||||
|
final User user = userRepository.findById(Long.parseLong(userIdStr));
|
||||||
|
|
||||||
|
userName.setValue(state, user.getName());
|
||||||
|
familyName.setValue(state, user.getFamilyName());
|
||||||
|
givenName.setValue(state, user.getGivenName());
|
||||||
|
if (user.isBanned()) {
|
||||||
|
banned.setValue(state, "banned");
|
||||||
|
}
|
||||||
|
if (user.isPasswordResetRequired()) {
|
||||||
|
passwordResetRequired.setValue(state,
|
||||||
|
"password_reset_required");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
addValidationListener(e -> {
|
||||||
|
final PageState state = e.getPageState();
|
||||||
|
final FormData data = e.getFormData();
|
||||||
|
|
||||||
|
final String userNameData = data.getString(USER_NAME);
|
||||||
|
if (Strings.isEmpty(userNameData)) {
|
||||||
|
data.addError(
|
||||||
|
USER_NAME,
|
||||||
|
new GlobalizedMessage(
|
||||||
|
"ui.admin.user_edit.username.error.not_empty",
|
||||||
|
ADMIN_BUNDLE));
|
||||||
|
}
|
||||||
|
|
||||||
|
final String familyNameData = data.getString(FAMILY_NAME);
|
||||||
|
if (Strings.isEmpty(familyNameData)) {
|
||||||
|
data.addError(
|
||||||
|
FAMILY_NAME,
|
||||||
|
new GlobalizedMessage(
|
||||||
|
"ui.admin.user_edit.familyname.error_not_empty",
|
||||||
|
ADMIN_BUNDLE));
|
||||||
|
}
|
||||||
|
|
||||||
|
final String givenNameData = data.getString(GIVEN_NAME);
|
||||||
|
if (Strings.isEmpty(givenNameData)) {
|
||||||
|
data.addError(
|
||||||
|
GIVEN_NAME,
|
||||||
|
new GlobalizedMessage(
|
||||||
|
"ui.admin.user_edit.givenname.error.not_empty",
|
||||||
|
ADMIN_BUNDLE));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
addProcessListener(e -> {
|
||||||
|
final PageState state = e.getPageState();
|
||||||
|
|
||||||
|
if (saveCancelSection.getSaveButton().isSelected(state)) {
|
||||||
|
final String userIdStr = selectedUserId.getSelectedKey(state);
|
||||||
|
final UserRepository userRepository = CdiUtil.createCdiUtil()
|
||||||
|
.findBean(UserRepository.class);
|
||||||
|
final User user = userRepository.findById(Long.parseLong(
|
||||||
|
userIdStr));
|
||||||
|
|
||||||
|
if (!user.getName().equals(userName.getValue(state))) {
|
||||||
|
user.setName((String) userName.getValue(state));
|
||||||
|
}
|
||||||
|
if (!user.getFamilyName().equals(familyName.getValue(state))) {
|
||||||
|
user.setFamilyName((String) familyName.getValue(state));
|
||||||
|
}
|
||||||
|
if (!user.getGivenName().equals(givenName.getValue(state))) {
|
||||||
|
user.setGivenName((String) familyName.getValue(state));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ("banned".equals(banned.getValue(state)) && !user.isBanned()) {
|
||||||
|
user.setBanned(true);
|
||||||
|
} else {
|
||||||
|
user.setBanned(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ("password_reset_required".equals(passwordResetRequired
|
||||||
|
.getValue(
|
||||||
|
state))
|
||||||
|
&& !user.isPasswordResetRequired()) {
|
||||||
|
user.setPasswordResetRequired(true);
|
||||||
|
} else {
|
||||||
|
user.setPasswordResetRequired(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
userRepository.save(user);
|
||||||
|
}
|
||||||
|
userAdmin.closeUserEditForm(state);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -32,7 +32,7 @@ import static com.arsdigita.ui.admin.AdminUiConstants.*;
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
public class UserPropertySheetModel implements PropertySheetModel {
|
class UserPropertySheetModel implements PropertySheetModel {
|
||||||
|
|
||||||
private static enum UserProperty {
|
private static enum UserProperty {
|
||||||
USER_NAME,
|
USER_NAME,
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ import org.libreccm.security.UserRepository;
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
public class UserPropertySheetModelBuilder
|
class UserPropertySheetModelBuilder
|
||||||
extends LockableImpl implements PropertySheetModelBuilder {
|
extends LockableImpl implements PropertySheetModelBuilder {
|
||||||
|
|
||||||
private final ParameterSingleSelectionModel<String> selectedUserId;
|
private final ParameterSingleSelectionModel<String> selectedUserId;
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ import static com.arsdigita.ui.admin.AdminUiConstants.*;
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
public class UsersTable extends Table {
|
class UsersTable extends Table {
|
||||||
|
|
||||||
private static final Logger LOGGER = LogManager.getLogger(UsersTable.class);
|
private static final Logger LOGGER = LogManager.getLogger(UsersTable.class);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,73 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2016 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package com.arsdigita.ui.admin.usersgroupsroles.users;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.ActionLink;
|
||||||
|
import com.arsdigita.bebop.BoxPanel;
|
||||||
|
import com.arsdigita.bebop.Form;
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.bebop.ParameterSingleSelectionModel;
|
||||||
|
import com.arsdigita.bebop.form.Submit;
|
||||||
|
import com.arsdigita.bebop.form.TextField;
|
||||||
|
import com.arsdigita.globalization.GlobalizedMessage;
|
||||||
|
|
||||||
|
import static com.arsdigita.ui.admin.AdminUiConstants.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
class UsersTablePanel extends BoxPanel {
|
||||||
|
|
||||||
|
private final TextField usersTableFilter;
|
||||||
|
|
||||||
|
public UsersTablePanel(
|
||||||
|
final UserAdmin userAdmin,
|
||||||
|
final ParameterSingleSelectionModel<String> selectedUserId) {
|
||||||
|
|
||||||
|
setIdAttr("usersTablePanel");
|
||||||
|
|
||||||
|
final Form filterForm = new Form("usersTableFilterForm");
|
||||||
|
usersTableFilter = new TextField("usersTableFilter");
|
||||||
|
usersTableFilter.setLabel(new GlobalizedMessage(
|
||||||
|
"ui.admin.users.table.filter.term", ADMIN_BUNDLE));
|
||||||
|
filterForm.add(usersTableFilter);
|
||||||
|
filterForm.add(new Submit(new GlobalizedMessage(
|
||||||
|
"ui.admin.users.table.filter.submit", ADMIN_BUNDLE)));
|
||||||
|
final ActionLink clearLink = new ActionLink(new GlobalizedMessage(
|
||||||
|
"ui.admin.users.table.filter.clear", ADMIN_BUNDLE));
|
||||||
|
clearLink.addActionListener((e) -> {
|
||||||
|
final PageState state = e.getPageState();
|
||||||
|
usersTableFilter.setValue(state, null);
|
||||||
|
});
|
||||||
|
filterForm.add(clearLink);
|
||||||
|
add(filterForm);
|
||||||
|
|
||||||
|
add(new UsersTable(userAdmin, usersTableFilter, selectedUserId));
|
||||||
|
|
||||||
|
final ActionLink addNewUserLink = new ActionLink(new GlobalizedMessage(
|
||||||
|
"ui.admin.new_user.link", ADMIN_BUNDLE));
|
||||||
|
addNewUserLink.addActionListener(e -> {
|
||||||
|
userAdmin.showNewUserForm(e.getPageState());
|
||||||
|
});
|
||||||
|
add(addNewUserLink);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -332,3 +332,12 @@ ui.admin.role_permissions.note=Please note that this form only provides very bas
|
||||||
ui.admin.role_details.add_permission.privilege.error.notempty=Privilege can't be empty.
|
ui.admin.role_details.add_permission.privilege.error.notempty=Privilege can't be empty.
|
||||||
ui.admin.role_details.add_permission.object_id.error.nan=The provided value of object id is not an valid id.
|
ui.admin.role_details.add_permission.object_id.error.nan=The provided value of object id is not an valid id.
|
||||||
ui.admin.role_details.add_permission.object_id.error.no_object=There is no object with the provided id.
|
ui.admin.role_details.add_permission.object_id.error.no_object=There is no object with the provided id.
|
||||||
|
ui.admin.new_user_form.error.username.is_empty=The user name of a user can't be empty.
|
||||||
|
ui.admin.new_user_form.error.username.too_long=The name of a user can't be longer than 32 characters.
|
||||||
|
ui.admin.new_user_form.error.familyname.is_empty=The family name of user can't be empty.
|
||||||
|
ui.admin.new_user_form.error.familyname.too_long=The family name of a user can't be longer then 256 characters.
|
||||||
|
ui.admin.new_user_form.error.givenname.is_empty=The given name of a user can't be empty.
|
||||||
|
ui.admin.new_user_form.error.givenname.too_long=The given name of a user can't be longer than 256 characters.
|
||||||
|
ui.admin.new_user_form.error.email.is_empty=The Email address of a user can't be empty.
|
||||||
|
ui.admin.new_user_form.error.email.too_long=The Email address of a user can't be longer than 256 characters.
|
||||||
|
ui.admin.new_user_form.error.password.is_empty=The password of a new user can't be blank.
|
||||||
|
|
|
||||||
|
|
@ -335,3 +335,12 @@ ui.admin.role_permissions.note=Bitte beachten Sie, dass hier nur eingeschr\u00e4
|
||||||
ui.admin.role_details.add_permission.privilege.error.notempty=Privileg darf nicht leer sein.
|
ui.admin.role_details.add_permission.privilege.error.notempty=Privileg darf nicht leer sein.
|
||||||
ui.admin.role_details.add_permission.object_id.error.nan=Keine valide Objekt-ID
|
ui.admin.role_details.add_permission.object_id.error.nan=Keine valide Objekt-ID
|
||||||
ui.admin.role_details.add_permission.object_id.error.no_object=Es gibt keine Objekt mit der angebenen ID.
|
ui.admin.role_details.add_permission.object_id.error.no_object=Es gibt keine Objekt mit der angebenen ID.
|
||||||
|
ui.admin.new_user_form.error.username.is_empty=Der Benutzername eines Benutzers darf nicht leer sein.
|
||||||
|
ui.admin.new_user_form.error.username.too_long=Der Benutzername darf maximal 32 Zeichen lang sein.
|
||||||
|
ui.admin.new_user_form.error.familyname.is_empty=Der Familienname eines Benutzers darf nicht leer sein.
|
||||||
|
ui.admin.new_user_form.error.familyname.too_long=Der Familienname eines Benutzers darf maximal 256 Zeichen lang sein.
|
||||||
|
ui.admin.new_user_form.error.givenname.is_empty=Der Vorname eines Benutzers darf nicht leer sein.
|
||||||
|
ui.admin.new_user_form.error.givenname.too_long=Der Vorname eines Benutzers darf nicht l\u00e4nger als 256 Zeichen sein.
|
||||||
|
ui.admin.new_user_form.error.email.is_empty=Die E-Mail-Adresse eines Benutzers darf nicht leer sein.
|
||||||
|
ui.admin.new_user_form.error.email.too_long=Die E-Mail-Adresse eines Benutzers darf nicht l\u00e4nger als 256 Zeichen sein.
|
||||||
|
ui.admin.new_user_form.error.password.is_empty=Das Passwort eines Benutzers kann nicht leer sein.
|
||||||
|
|
|
||||||
|
|
@ -308,3 +308,12 @@ ui.admin.role_permissions.note=Please note that this form only provides very bas
|
||||||
ui.admin.role_details.add_permission.privilege.error.notempty=Privilege can't be empty.
|
ui.admin.role_details.add_permission.privilege.error.notempty=Privilege can't be empty.
|
||||||
ui.admin.role_details.add_permission.object_id.error.nan=The provided value of object id is not an valid id.
|
ui.admin.role_details.add_permission.object_id.error.nan=The provided value of object id is not an valid id.
|
||||||
ui.admin.role_details.add_permission.object_id.error.no_object=There is no object with the provided id.
|
ui.admin.role_details.add_permission.object_id.error.no_object=There is no object with the provided id.
|
||||||
|
ui.admin.new_user_form.error.username.is_empty=The user name of a user can't be empty.
|
||||||
|
ui.admin.new_user_form.error.username.too_long=The name of a user can't be longer than 32 characters.
|
||||||
|
ui.admin.new_user_form.error.familyname.is_empty=The family name of user can't be empty.
|
||||||
|
ui.admin.new_user_form.error.familyname.too_long=The family name of a user can't be longer then 256 characters.
|
||||||
|
ui.admin.new_user_form.error.givenname.is_empty=The given name of a user can't be empty.
|
||||||
|
ui.admin.new_user_form.error.givenname.too_long=The given name of a user can't be longer than 256 characters.
|
||||||
|
ui.admin.new_user_form.error.email.is_empty=The Email address of a user can't be empty.
|
||||||
|
ui.admin.new_user_form.error.email.too_long=The Email address of a user can't be longer than 256 characters.
|
||||||
|
ui.admin.new_user_form.error.password.is_empty=The password of a new user can't be blank.
|
||||||
|
|
|
||||||
|
|
@ -299,3 +299,12 @@ ui.admin.role_permissions.note=Please note that this form only provides very bas
|
||||||
ui.admin.role_details.add_permission.privilege.error.notempty=Privilege can't be empty.
|
ui.admin.role_details.add_permission.privilege.error.notempty=Privilege can't be empty.
|
||||||
ui.admin.role_details.add_permission.object_id.error.nan=The provided value of object id is not an valid id.
|
ui.admin.role_details.add_permission.object_id.error.nan=The provided value of object id is not an valid id.
|
||||||
ui.admin.role_details.add_permission.object_id.error.no_object=There is no object with the provided id.
|
ui.admin.role_details.add_permission.object_id.error.no_object=There is no object with the provided id.
|
||||||
|
ui.admin.new_user_form.error.username.is_empty=The user name of a user can't be empty.
|
||||||
|
ui.admin.new_user_form.error.username.too_long=The name of a user can't be longer than 32 characters.
|
||||||
|
ui.admin.new_user_form.error.familyname.is_empty=The family name of user can't be empty.
|
||||||
|
ui.admin.new_user_form.error.familyname.too_long=The family name of a user can't be longer then 256 characters.
|
||||||
|
ui.admin.new_user_form.error.givenname.is_empty=The given name of a user can't be empty.
|
||||||
|
ui.admin.new_user_form.error.givenname.too_long=The given name of a user can't be longer than 256 characters.
|
||||||
|
ui.admin.new_user_form.error.email.is_empty=The Email address of a user can't be empty.
|
||||||
|
ui.admin.new_user_form.error.email.too_long=The Email address of a user can't be longer than 256 characters.
|
||||||
|
ui.admin.new_user_form.error.password.is_empty=The password of a new user can't be blank.
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ ccm_core.ccm_objects:
|
||||||
uuid: 9383ffe3-132e-484d-940c-dc9b9da5c6ef
|
uuid: 9383ffe3-132e-484d-940c-dc9b9da5c6ef
|
||||||
- object_id: 2
|
- object_id: 2
|
||||||
display_name: example
|
display_name: example
|
||||||
uuid: 19b3cdac-3ca4-44c0-9b06-dca8e5ae505f
|
uuid: 74528919-5a63-4433-8e7a-4c719d30b7da
|
||||||
- object_id: 3
|
- object_id: 3
|
||||||
display_name: TestConfiguration
|
display_name: TestConfiguration
|
||||||
uuid: ce6a424e-03e0-4297-9b2b-2bb7c42a43d3
|
uuid: ce6a424e-03e0-4297-9b2b-2bb7c42a43d3
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue