CCM NG: Cleanup of the Vaadin prototype
git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@5092 8810af33-2d31-482b-a856-94f89814c4df
Former-commit-id: 6661456806
pull/2/head
parent
4a7b2bb85c
commit
85fcbd92cd
|
|
@ -1,8 +1,8 @@
|
|||
alter table CCM_CMS.PAGES_APP
|
||||
drop constraint FK3wkyn4oxa65f7svtj917m61jc;
|
||||
drop constraint if exists FK3wkyn4oxa65f7svtj917m61jc;
|
||||
|
||||
alter table CCM_CMS.PAGES_APP
|
||||
drop contraint FKrrk4g7my3e4qkdoeiygkqxduy;
|
||||
drop constraint if exists FKrrk4g7my3e4qkdoeiygkqxduy;
|
||||
|
||||
alter table CCM_CMS.PAGES_APP
|
||||
drop column if exists SITE_ID;
|
||||
|
|
@ -10,4 +10,4 @@ alter table CCM_CMS.PAGES_APP
|
|||
alter table CCM_CMS.PAGES_APP
|
||||
add constraint FKk4jb5fylibg2pbbaypyt6f8lb
|
||||
foreign key (OBJECT_ID)
|
||||
references SITE_AWARE_APPLICATIONS;
|
||||
references CCM_CORE.SITE_AWARE_APPLICATIONS;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
alter table CCM_CMS.PAGES_APP
|
||||
drop constraint FK3wkyn4oxa65f7svtj917m61jc;
|
||||
drop constraint if exists FK3wkyn4oxa65f7svtj917m61jc;
|
||||
|
||||
alter table CCM_CMS.PAGES_APP
|
||||
drop contraint FKrrk4g7my3e4qkdoeiygkqxduy;
|
||||
drop constraint if exists FKrrk4g7my3e4qkdoeiygkqxduy;
|
||||
|
||||
alter table CCM_CMS.PAGES_APP
|
||||
drop column if exists SITE_ID;
|
||||
|
|
@ -10,4 +10,4 @@ alter table CCM_CMS.PAGES_APP
|
|||
alter table CCM_CMS.PAGES_APP
|
||||
add constraint FKk4jb5fylibg2pbbaypyt6f8lb
|
||||
foreign key (OBJECT_ID)
|
||||
references SITE_AWARE_APPLICATIONS;
|
||||
references CCM_CORE.SITE_AWARE_APPLICATIONS;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ drop schema if exists CCM_CORE;
|
|||
|
||||
drop sequence if exists HIBERNATE_SEQUENCE;
|
||||
|
||||
|
||||
create schema CCM_CMS;
|
||||
|
||||
create schema CCM_CORE;
|
||||
|
|
@ -818,6 +817,7 @@ drop sequence if exists HIBERNATE_SEQUENCE;
|
|||
PAGE_ID bigint not null,
|
||||
INDEX_PAGE_TEMPLATE varchar(255),
|
||||
ITEM_PAGE_TEMPLATE varchar(255),
|
||||
THEME_NAME varchar(255),
|
||||
THEME varchar(255) not null,
|
||||
primary key (PAGE_ID, THEME)
|
||||
);
|
||||
|
|
@ -832,7 +832,6 @@ drop sequence if exists HIBERNATE_SEQUENCE;
|
|||
create table CCM_CMS.PAGES_APP (
|
||||
OBJECT_ID bigint not null,
|
||||
CATEGORY_DOMAIN_ID bigint,
|
||||
SITE_ID bigint,
|
||||
primary key (OBJECT_ID)
|
||||
);
|
||||
|
||||
|
|
@ -1433,10 +1432,10 @@ drop sequence if exists HIBERNATE_SEQUENCE;
|
|||
SETTING_ID bigint not null,
|
||||
CONFIGURATION_CLASS varchar(512) not null,
|
||||
NAME varchar(512) not null,
|
||||
SETTING_VALUE_BOOLEAN boolean,
|
||||
SETTING_VALUE_DOUBLE double,
|
||||
SETTING_VALUE_BIG_DECIMAL decimal(19,2),
|
||||
SETTING_VALUE_STRING varchar(1024),
|
||||
SETTING_VALUE_BOOLEAN boolean,
|
||||
SETTING_VALUE_LONG bigint,
|
||||
primary key (SETTING_ID)
|
||||
);
|
||||
|
|
@ -1458,6 +1457,12 @@ drop sequence if exists HIBERNATE_SEQUENCE;
|
|||
value varchar(255)
|
||||
);
|
||||
|
||||
create table CCM_CORE.SITE_AWARE_APPLICATIONS (
|
||||
OBJECT_ID bigint not null,
|
||||
SITE_ID bigint,
|
||||
primary key (OBJECT_ID)
|
||||
);
|
||||
|
||||
create table CCM_CORE.SITES (
|
||||
DEFAULT_SITE boolean,
|
||||
DEFAULT_THEME varchar(255),
|
||||
|
|
@ -2351,14 +2356,9 @@ drop sequence if exists HIBERNATE_SEQUENCE;
|
|||
references CCM_CORE.CATEGORY_DOMAINS;
|
||||
|
||||
alter table CCM_CMS.PAGES_APP
|
||||
add constraint FK3wkyn4oxa65f7svtj917m61jc
|
||||
foreign key (SITE_ID)
|
||||
references CCM_CORE.SITES;
|
||||
|
||||
alter table CCM_CMS.PAGES_APP
|
||||
add constraint FKrrk4g7my3e4qkdoeiygkqxduy
|
||||
add constraint FKk4jb5fylibg2pbbaypyt6f8lb
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.APPLICATIONS;
|
||||
references CCM_CORE.SITE_AWARE_APPLICATIONS;
|
||||
|
||||
alter table CCM_CMS.RELATED_LINKS
|
||||
add constraint FKb517dnfj56oby2s34jp1omuim
|
||||
|
|
@ -2840,6 +2840,16 @@ drop sequence if exists HIBERNATE_SEQUENCE;
|
|||
foreign key (LIST_ID)
|
||||
references CCM_CORE.SETTINGS;
|
||||
|
||||
alter table CCM_CORE.SITE_AWARE_APPLICATIONS
|
||||
add constraint FKopo91c29jaunpcusjwlphhxkd
|
||||
foreign key (SITE_ID)
|
||||
references CCM_CORE.SITES;
|
||||
|
||||
alter table CCM_CORE.SITE_AWARE_APPLICATIONS
|
||||
add constraint FKslbu2qagg23dmdu01lun7oh7x
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.APPLICATIONS;
|
||||
|
||||
alter table CCM_CORE.SITES
|
||||
add constraint FKrca95c6p023men53b8ayu26kp
|
||||
foreign key (OBJECT_ID)
|
||||
|
|
|
|||
|
|
@ -817,6 +817,7 @@ drop sequence if exists HIBERNATE_SEQUENCE;
|
|||
PAGE_ID int8 not null,
|
||||
INDEX_PAGE_TEMPLATE varchar(255),
|
||||
ITEM_PAGE_TEMPLATE varchar(255),
|
||||
THEME_NAME varchar(255),
|
||||
THEME varchar(255) not null,
|
||||
primary key (PAGE_ID, THEME)
|
||||
);
|
||||
|
|
@ -831,7 +832,6 @@ drop sequence if exists HIBERNATE_SEQUENCE;
|
|||
create table CCM_CMS.PAGES_APP (
|
||||
OBJECT_ID int8 not null,
|
||||
CATEGORY_DOMAIN_ID int8,
|
||||
SITE_ID int8,
|
||||
primary key (OBJECT_ID)
|
||||
);
|
||||
|
||||
|
|
@ -1432,10 +1432,10 @@ drop sequence if exists HIBERNATE_SEQUENCE;
|
|||
SETTING_ID int8 not null,
|
||||
CONFIGURATION_CLASS varchar(512) not null,
|
||||
NAME varchar(512) not null,
|
||||
SETTING_VALUE_BOOLEAN boolean,
|
||||
SETTING_VALUE_DOUBLE float8,
|
||||
SETTING_VALUE_BIG_DECIMAL numeric(19, 2),
|
||||
SETTING_VALUE_STRING varchar(1024),
|
||||
SETTING_VALUE_BOOLEAN boolean,
|
||||
SETTING_VALUE_LONG int8,
|
||||
primary key (SETTING_ID)
|
||||
);
|
||||
|
|
@ -1457,6 +1457,12 @@ drop sequence if exists HIBERNATE_SEQUENCE;
|
|||
value varchar(255)
|
||||
);
|
||||
|
||||
create table CCM_CORE.SITE_AWARE_APPLICATIONS (
|
||||
OBJECT_ID int8 not null,
|
||||
SITE_ID int8,
|
||||
primary key (OBJECT_ID)
|
||||
);
|
||||
|
||||
create table CCM_CORE.SITES (
|
||||
DEFAULT_SITE boolean,
|
||||
DEFAULT_THEME varchar(255),
|
||||
|
|
@ -2350,14 +2356,9 @@ drop sequence if exists HIBERNATE_SEQUENCE;
|
|||
references CCM_CORE.CATEGORY_DOMAINS;
|
||||
|
||||
alter table CCM_CMS.PAGES_APP
|
||||
add constraint FK3wkyn4oxa65f7svtj917m61jc
|
||||
foreign key (SITE_ID)
|
||||
references CCM_CORE.SITES;
|
||||
|
||||
alter table CCM_CMS.PAGES_APP
|
||||
add constraint FKrrk4g7my3e4qkdoeiygkqxduy
|
||||
add constraint FKk4jb5fylibg2pbbaypyt6f8lb
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.APPLICATIONS;
|
||||
references CCM_CORE.SITE_AWARE_APPLICATIONS;
|
||||
|
||||
alter table CCM_CMS.RELATED_LINKS
|
||||
add constraint FKb517dnfj56oby2s34jp1omuim
|
||||
|
|
@ -2839,6 +2840,16 @@ drop sequence if exists HIBERNATE_SEQUENCE;
|
|||
foreign key (LIST_ID)
|
||||
references CCM_CORE.SETTINGS;
|
||||
|
||||
alter table CCM_CORE.SITE_AWARE_APPLICATIONS
|
||||
add constraint FKopo91c29jaunpcusjwlphhxkd
|
||||
foreign key (SITE_ID)
|
||||
references CCM_CORE.SITES;
|
||||
|
||||
alter table CCM_CORE.SITE_AWARE_APPLICATIONS
|
||||
add constraint FKslbu2qagg23dmdu01lun7oh7x
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.APPLICATIONS;
|
||||
|
||||
alter table CCM_CORE.SITES
|
||||
add constraint FKrca95c6p023men53b8ayu26kp
|
||||
foreign key (OBJECT_ID)
|
||||
|
|
|
|||
|
|
@ -28,16 +28,17 @@ import com.arsdigita.toolbox.ui.LayoutPanel;
|
|||
import com.arsdigita.util.LockableImpl;
|
||||
import com.arsdigita.util.SystemInformation;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.parsers.SAXParserFactory;
|
||||
import javax.xml.transform.TransformerConfigurationException;
|
||||
import javax.xml.transform.TransformerFactory;
|
||||
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
|
|
@ -280,7 +281,9 @@ public class SystemInformationTab extends LayoutPanel {
|
|||
return "???";
|
||||
}
|
||||
case DOCUMENT_BUILDER_FACTORY_INDEX:
|
||||
return DocumentBuilderFactory.newInstance().getClass()
|
||||
return DocumentBuilderFactory
|
||||
.newInstance()
|
||||
.getClass()
|
||||
.getName();
|
||||
case DOCUMENT_BUILDER_INDEX:
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@ import java.util.HashMap;
|
|||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* Provides the system name of the CCM Spin off (eg aplaws or ScientificCMS) and
|
||||
|
|
@ -110,7 +112,7 @@ public class SystemInformation {
|
|||
*
|
||||
* @throws IllegalArgumentException if key is null or empty
|
||||
*/
|
||||
final public String get(final String key) throws IllegalArgumentException {
|
||||
public final String get(final String key) throws IllegalArgumentException {
|
||||
if (key == null || key.isEmpty()) {
|
||||
throw new IllegalArgumentException(
|
||||
"Parameter key must not be null or empty.");
|
||||
|
|
@ -123,15 +125,27 @@ public class SystemInformation {
|
|||
*
|
||||
* @return iterator of map
|
||||
*/
|
||||
final public Iterator<Map.Entry<String, String>> iterator() {
|
||||
public final Iterator<Map.Entry<String, String>> iterator() {
|
||||
return sysInfo.entrySet().iterator();
|
||||
}
|
||||
|
||||
public final Set<Map.Entry<String, String>> getEntries() {
|
||||
return sysInfo.entrySet();
|
||||
}
|
||||
|
||||
public final Stream<Map.Entry<String, String>> getEntriesAsStream() {
|
||||
return sysInfo.entrySet().stream();
|
||||
}
|
||||
|
||||
public final int size() {
|
||||
return sysInfo.size();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
final public boolean isEmpty() {
|
||||
public final boolean isEmpty() {
|
||||
return sysInfo.isEmpty();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,14 +22,12 @@ import com.arsdigita.ui.admin.AdminUiConstants;
|
|||
|
||||
import com.vaadin.cdi.CDIView;
|
||||
import com.vaadin.navigator.View;
|
||||
import com.vaadin.navigator.ViewChangeListener;
|
||||
import com.vaadin.server.VaadinServlet;
|
||||
import com.vaadin.ui.CssLayout;
|
||||
import com.vaadin.ui.CustomComponent;
|
||||
import com.vaadin.ui.TabSheet;
|
||||
import com.vaadin.ui.VerticalLayout;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.inject.Inject;
|
||||
import javax.servlet.ServletContext;
|
||||
|
||||
|
|
@ -47,7 +45,7 @@ public class AdminView extends CustomComponent implements View {
|
|||
|
||||
public static final String VIEWNAME = "admin";
|
||||
|
||||
private ResourceBundle bundle;
|
||||
private final ResourceBundle bundle;
|
||||
|
||||
private final AdminViewController controller;
|
||||
|
||||
|
|
@ -58,6 +56,8 @@ public class AdminView extends CustomComponent implements View {
|
|||
private final JpqlConsole jpqlConsole;
|
||||
|
||||
private final ConfigurationTab configurationTab;
|
||||
|
||||
private final SystemInformationTab sysInfoTab;
|
||||
|
||||
@Inject
|
||||
protected AdminView(final AdminViewController controller) {
|
||||
|
|
@ -89,6 +89,9 @@ public class AdminView extends CustomComponent implements View {
|
|||
configurationTab = new ConfigurationTab();
|
||||
tabSheet.addTab(configurationTab, "Configuration");
|
||||
|
||||
sysInfoTab = new SystemInformationTab(controller);
|
||||
tabSheet.addTab(sysInfoTab, "System Information");
|
||||
|
||||
final CssLayout footer = new CssLayout();
|
||||
footer.setHeight("5em");
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@ package org.libreccm.admin.ui;
|
|||
import com.vaadin.cdi.ViewScoped;
|
||||
import org.libreccm.l10n.GlobalizationHelper;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
|
|
@ -30,7 +32,9 @@ import javax.inject.Inject;
|
|||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@ViewScoped
|
||||
class AdminViewController {
|
||||
class AdminViewController implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 4880298854970416968L;
|
||||
|
||||
@Inject
|
||||
private ConfigurationsTabController confTabController;
|
||||
|
|
|
|||
|
|
@ -19,12 +19,16 @@
|
|||
package org.libreccm.admin.ui;
|
||||
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
|
||||
import com.vaadin.cdi.ViewScoped;
|
||||
import org.libreccm.configuration.ConfigurationManager;
|
||||
import org.libreccm.configuration.SettingManager;
|
||||
import org.libreccm.l10n.GlobalizationHelper;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
|
|
@ -32,7 +36,9 @@ import java.util.Locale;
|
|||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@ViewScoped
|
||||
class ConfigurationsTabController {
|
||||
class ConfigurationsTabController implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -5492006905558481631L;
|
||||
|
||||
@Inject
|
||||
private GlobalizationHelper globalizationHelper;
|
||||
|
|
|
|||
|
|
@ -36,7 +36,8 @@ import java.util.stream.Stream;
|
|||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@ViewScoped
|
||||
class ConfigurationsTableDataProvider extends AbstractDataProvider<ConfigurationsGridRowData, String> {
|
||||
class ConfigurationsTableDataProvider
|
||||
extends AbstractDataProvider<ConfigurationsGridRowData, String> {
|
||||
|
||||
private static final long serialVersionUID = -7001151229931864885L;
|
||||
|
||||
|
|
|
|||
|
|
@ -38,11 +38,8 @@ import com.vaadin.ui.VerticalLayout;
|
|||
import com.vaadin.ui.Window;
|
||||
import com.vaadin.ui.components.grid.HeaderCell;
|
||||
import com.vaadin.ui.components.grid.HeaderRow;
|
||||
import com.vaadin.ui.renderers.ButtonRenderer;
|
||||
import com.vaadin.ui.themes.ValoTheme;
|
||||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
import org.libreccm.security.Group;
|
||||
import org.libreccm.security.GroupRepository;
|
||||
import org.libreccm.security.Role;
|
||||
import org.libreccm.security.RoleRepository;
|
||||
import org.libreccm.security.User;
|
||||
|
|
@ -68,7 +65,7 @@ class GroupDetails extends Window {
|
|||
private static final String COL_ROLE_REMOVE = "remove";
|
||||
|
||||
private final Group group;
|
||||
private final GroupRepository groupRepo;
|
||||
private final GroupsController controller;
|
||||
|
||||
private boolean dataHasChanged = false;
|
||||
|
||||
|
|
@ -78,13 +75,13 @@ class GroupDetails extends Window {
|
|||
private HorizontalLayout saveCancelButtons;
|
||||
|
||||
protected GroupDetails(final Group group,
|
||||
final GroupRepository groupRepo) {
|
||||
final GroupsController controller) {
|
||||
|
||||
super(String.format("Edit group %s", group.getName()));
|
||||
|
||||
this.group = group;
|
||||
this.groupRepo = groupRepo;
|
||||
|
||||
this.controller = controller;
|
||||
|
||||
addWidgets();
|
||||
}
|
||||
|
||||
|
|
@ -148,11 +145,9 @@ class GroupDetails extends Window {
|
|||
|
||||
dataHasChanged = false;
|
||||
|
||||
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||
|
||||
final GroupMembersController membersController = cdiUtil
|
||||
.findBean(GroupMembersController.class);
|
||||
|
||||
final GroupMembersController membersController = controller
|
||||
.getMembersController();
|
||||
|
||||
final Grid<User> membersGrid = new Grid<>();
|
||||
membersGrid.addColumn(User::getName)
|
||||
.setId(COL_USER_NAME)
|
||||
|
|
@ -167,19 +162,24 @@ class GroupDetails extends Window {
|
|||
.addColumn(user -> user.getPrimaryEmailAddress().getAddress())
|
||||
.setId(COL_EMAIL)
|
||||
.setCaption("E-Mail");
|
||||
membersGrid.addColumn(user -> bundle.getString(
|
||||
"ui.groups.members.remove"),
|
||||
new ButtonRenderer<>(event -> {
|
||||
membersController
|
||||
.removeMemberFromGroup(event.getItem(),
|
||||
group);
|
||||
membersGrid.getDataProvider().refreshAll();
|
||||
}))
|
||||
membersGrid.addComponentColumn(user -> {
|
||||
final Button removeButton = new Button(
|
||||
bundle.getString("ui.groups.members.remove"),
|
||||
VaadinIcons.CLOSE_CIRCLE_O);
|
||||
removeButton.addClickListener(event -> {
|
||||
membersController.removeMemberFromGroup(user,
|
||||
group);
|
||||
membersGrid.getDataProvider().refreshAll();
|
||||
});
|
||||
removeButton.addStyleNames(ValoTheme.BUTTON_TINY,
|
||||
ValoTheme.BUTTON_DANGER);
|
||||
return removeButton;
|
||||
})
|
||||
.setId(COL_REMOVE);
|
||||
|
||||
membersGrid.setWidth("100%");
|
||||
|
||||
final UserRepository userRepo = cdiUtil.findBean(UserRepository.class);
|
||||
final UserRepository userRepo = controller.getUserRepository();
|
||||
|
||||
final HeaderRow membersGridHeader = membersGrid.prependHeaderRow();
|
||||
final Button addMemberButton = new Button("Add member");
|
||||
|
|
@ -189,6 +189,7 @@ class GroupDetails extends Window {
|
|||
final UserSelector userSelector = new UserSelector(
|
||||
"Select users to add to group",
|
||||
"Add selected users to group",
|
||||
controller.getUserSelectorDataProvider(),
|
||||
userRepo.findByGroup(group),
|
||||
(selectedUsers -> {
|
||||
selectedUsers.forEach(user -> {
|
||||
|
|
@ -213,31 +214,35 @@ class GroupDetails extends Window {
|
|||
membersGridHeaderCell
|
||||
.setComponent(new HorizontalLayout(addMemberButton));
|
||||
|
||||
final GroupMembersTableDataProvider usersDataProvider = cdiUtil
|
||||
.findBean(GroupMembersTableDataProvider.class);
|
||||
final GroupMembersTableDataProvider usersDataProvider = controller
|
||||
.getMembersTableDataProvider();
|
||||
usersDataProvider.setGroup(group);
|
||||
membersGrid.setDataProvider(usersDataProvider);
|
||||
|
||||
final GroupRolesController rolesController = cdiUtil
|
||||
.findBean(GroupRolesController.class);
|
||||
final GroupRolesController rolesController = controller
|
||||
.getRolesController();
|
||||
final Grid<Role> rolesGrid = new Grid<>();
|
||||
rolesGrid
|
||||
.addColumn(Role::getName)
|
||||
.setId(COL_ROLE_NAME)
|
||||
.setCaption("Role Name");
|
||||
rolesGrid
|
||||
.addColumn(role -> bundle
|
||||
.getString("ui.groups.roles.remove"),
|
||||
new ButtonRenderer<>(event -> {
|
||||
rolesController
|
||||
.removeRoleFromGroup(event.getItem(), group);
|
||||
rolesGrid.getDataProvider().refreshAll();
|
||||
}))
|
||||
rolesGrid.addComponentColumn(role -> {
|
||||
final Button removeButton = new Button(
|
||||
bundle.getString("ui.groups.roles.remove"),
|
||||
VaadinIcons.CLOSE_CIRCLE_O);
|
||||
removeButton.addClickListener(event -> {
|
||||
rolesController.removeRoleFromGroup(role, group);
|
||||
rolesGrid.getDataProvider().refreshAll();
|
||||
});
|
||||
removeButton.addStyleNames(ValoTheme.BUTTON_TINY,
|
||||
ValoTheme.BUTTON_DANGER);
|
||||
return removeButton;
|
||||
})
|
||||
.setId(COL_ROLE_REMOVE);
|
||||
|
||||
rolesGrid.setWidth("100%");
|
||||
|
||||
final RoleRepository roleRepo = cdiUtil.findBean(RoleRepository.class);
|
||||
final RoleRepository roleRepo = controller.getRoleRepository();
|
||||
|
||||
final HeaderRow rolesGridHeader = rolesGrid.prependHeaderRow();
|
||||
final Button addRoleButton = new Button("Add role");
|
||||
|
|
@ -247,6 +252,7 @@ class GroupDetails extends Window {
|
|||
final RoleSelector roleSelector = new RoleSelector(
|
||||
"Select role(s) to add to group",
|
||||
"Add selected role(s) to group",
|
||||
controller.getRoleSelectorDataProvider(),
|
||||
roleRepo.findByParty(group),
|
||||
(selectedRoles -> {
|
||||
selectedRoles.forEach(role -> {
|
||||
|
|
@ -267,15 +273,15 @@ class GroupDetails extends Window {
|
|||
rolesGridHeaderCell
|
||||
.setComponent(new HorizontalLayout(addRoleButton));
|
||||
|
||||
final GroupRolesTableDataProvider rolesDataProvider = cdiUtil
|
||||
.findBean(GroupRolesTableDataProvider.class);
|
||||
final GroupRolesTableDataProvider rolesDataProvider = controller
|
||||
.getRolesTableDataProvider();
|
||||
rolesDataProvider.setGroup(group);
|
||||
rolesGrid.setDataProvider(rolesDataProvider);
|
||||
|
||||
final TabSheet tabs = new TabSheet();
|
||||
tabs.addTab(membersGrid, "Members");
|
||||
tabs.addTab(rolesGrid, "Roles");
|
||||
|
||||
|
||||
final VerticalLayout windowLayout = new VerticalLayout(propertiesPanel,
|
||||
tabs);
|
||||
|
||||
|
|
@ -325,7 +331,7 @@ class GroupDetails extends Window {
|
|||
notificationText = String.format("Saved changes to group %s",
|
||||
group.getName());
|
||||
|
||||
groupRepo.save(group);
|
||||
controller.getGroupRepository().save(group);
|
||||
|
||||
dataHasChanged = false;
|
||||
close();
|
||||
|
|
|
|||
|
|
@ -18,11 +18,18 @@
|
|||
*/
|
||||
package org.libreccm.admin.ui;
|
||||
|
||||
import org.libreccm.security.*;
|
||||
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.io.Serializable;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Inject;
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
|
|
@ -30,7 +37,9 @@ import java.util.Set;
|
|||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@RequestScoped
|
||||
class GroupMembersController {
|
||||
class GroupMembersController implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 9206311321172059643L;
|
||||
|
||||
@Inject
|
||||
private UserRepository userRepo;
|
||||
|
|
|
|||
|
|
@ -40,8 +40,7 @@ import java.util.stream.Stream;
|
|||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@ViewScoped
|
||||
class GroupMembersTableDataProvider
|
||||
extends AbstractDataProvider<User, String> {
|
||||
class GroupMembersTableDataProvider extends AbstractDataProvider<User, String> {
|
||||
|
||||
private static final long serialVersionUID = -1924910843845830008L;
|
||||
|
||||
|
|
|
|||
|
|
@ -18,11 +18,18 @@
|
|||
*/
|
||||
package org.libreccm.admin.ui;
|
||||
|
||||
import org.libreccm.security.*;
|
||||
import org.libreccm.security.Group;
|
||||
import org.libreccm.security.GroupRepository;
|
||||
import org.libreccm.security.Role;
|
||||
import org.libreccm.security.RoleManager;
|
||||
import org.libreccm.security.RoleRepository;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Inject;
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
|
|
@ -30,7 +37,9 @@ import java.util.Set;
|
|||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@RequestScoped
|
||||
class GroupRolesController {
|
||||
class GroupRolesController implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 428573362835344406L;
|
||||
|
||||
@Inject
|
||||
private RoleRepository roleRepo;
|
||||
|
|
|
|||
|
|
@ -40,8 +40,7 @@ import java.util.stream.Stream;
|
|||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@ViewScoped
|
||||
class GroupRolesTableDataProvider
|
||||
extends AbstractDataProvider<Role, String> {
|
||||
class GroupRolesTableDataProvider extends AbstractDataProvider<Role, String> {
|
||||
|
||||
private static final long serialVersionUID = 7981493169013788121L;
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ import com.vaadin.ui.Window;
|
|||
import com.vaadin.ui.components.grid.HeaderCell;
|
||||
import com.vaadin.ui.components.grid.HeaderRow;
|
||||
import com.vaadin.ui.themes.ValoTheme;
|
||||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
import org.libreccm.security.Group;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -42,22 +41,22 @@ class GroupSelector extends Window {
|
|||
private static final String COL_NAME = "groupname";
|
||||
|
||||
protected GroupSelector(final String caption,
|
||||
final String actionLabel,
|
||||
final List<Group> excludedGroups,
|
||||
final GroupSelectionAction action) {
|
||||
final String actionLabel,
|
||||
final GroupSelectorDataProvider dataProvider,
|
||||
final List<Group> excludedGroups,
|
||||
final GroupSelectionAction action) {
|
||||
|
||||
addWidgets(caption, actionLabel, excludedGroups, action);
|
||||
addWidgets(caption, actionLabel, dataProvider, excludedGroups, action);
|
||||
}
|
||||
|
||||
private void addWidgets(final String caption,
|
||||
final String actionLabel,
|
||||
final GroupSelectorDataProvider dataProvider,
|
||||
final List<Group> excludedGroups,
|
||||
final GroupSelectionAction action) {
|
||||
|
||||
setCaption(caption);
|
||||
|
||||
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||
|
||||
final Grid<Group> groupsGrid = new Grid<>();
|
||||
groupsGrid
|
||||
.addColumn(Group::getName)
|
||||
|
|
@ -86,14 +85,10 @@ class GroupSelector extends Window {
|
|||
final HeaderCell actionsCell = actions.getCell(COL_NAME);
|
||||
actionsCell.setComponent(new HorizontalLayout(actionButton,
|
||||
clearButton));
|
||||
|
||||
final GroupSelectorDataProvider dataProvider = cdiUtil
|
||||
.findBean(GroupSelectorDataProvider.class);
|
||||
|
||||
|
||||
dataProvider.setExcludedGroups(excludedGroups);
|
||||
|
||||
groupsGrid.setDataProvider(dataProvider);
|
||||
|
||||
|
||||
setContent(groupsGrid);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,10 @@ package org.libreccm.admin.ui;
|
|||
import com.vaadin.cdi.ViewScoped;
|
||||
import org.libreccm.security.GroupManager;
|
||||
import org.libreccm.security.GroupRepository;
|
||||
import org.libreccm.security.RoleRepository;
|
||||
import org.libreccm.security.UserRepository;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
|
|
@ -29,15 +33,85 @@ import javax.inject.Inject;
|
|||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@ViewScoped
|
||||
public class GroupsController {
|
||||
class GroupsController implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 4112198806815494041L;
|
||||
|
||||
@Inject
|
||||
private GroupManager groupManager;
|
||||
|
||||
@Inject
|
||||
private GroupMembersController membersController;
|
||||
|
||||
@Inject
|
||||
private GroupMembersTableDataProvider membersTableDataProvider;
|
||||
|
||||
@Inject
|
||||
private GroupRepository groupRepository;
|
||||
|
||||
@Inject
|
||||
private GroupsTableDataProvider groupsTableDataProvider;
|
||||
|
||||
@Inject
|
||||
private GroupRolesController rolesController;
|
||||
|
||||
@Inject
|
||||
private RoleRepository roleRepository;
|
||||
|
||||
@Inject
|
||||
private GroupRolesTableDataProvider rolesTableDataProvider;
|
||||
|
||||
@Inject
|
||||
private RoleSelectorDataProvider roleSelectorDataProvider;
|
||||
|
||||
@Inject
|
||||
private UserRepository userRepository;
|
||||
|
||||
@Inject
|
||||
private UserSelectorDataProvider userSelectorDataProvider;
|
||||
|
||||
protected GroupManager getGroupManager() {
|
||||
return groupManager;
|
||||
}
|
||||
|
||||
protected GroupMembersController getMembersController() {
|
||||
return membersController;
|
||||
}
|
||||
|
||||
protected GroupMembersTableDataProvider getMembersTableDataProvider() {
|
||||
return membersTableDataProvider;
|
||||
}
|
||||
|
||||
protected GroupRepository getGroupRepository() {
|
||||
return groupRepository;
|
||||
}
|
||||
|
||||
protected GroupsTableDataProvider getGroupsTableDataProvider() {
|
||||
return groupsTableDataProvider;
|
||||
}
|
||||
|
||||
protected GroupRolesController getRolesController() {
|
||||
return rolesController;
|
||||
}
|
||||
|
||||
protected RoleRepository getRoleRepository() {
|
||||
return roleRepository;
|
||||
}
|
||||
|
||||
protected GroupRolesTableDataProvider getRolesTableDataProvider() {
|
||||
return rolesTableDataProvider;
|
||||
}
|
||||
|
||||
protected RoleSelectorDataProvider getRoleSelectorDataProvider() {
|
||||
return roleSelectorDataProvider;
|
||||
}
|
||||
|
||||
protected UserRepository getUserRepository() {
|
||||
return userRepository;
|
||||
}
|
||||
|
||||
protected UserSelectorDataProvider getUserSelectorDataProvider() {
|
||||
return userSelectorDataProvider;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,13 +31,13 @@ import com.vaadin.ui.VerticalLayout;
|
|||
import com.vaadin.ui.Window;
|
||||
import com.vaadin.ui.components.grid.HeaderCell;
|
||||
import com.vaadin.ui.components.grid.HeaderRow;
|
||||
import com.vaadin.ui.renderers.ButtonRenderer;
|
||||
import com.vaadin.ui.themes.ValoTheme;
|
||||
import org.libreccm.l10n.GlobalizationHelper;
|
||||
import org.libreccm.l10n.LocalizedTextsUtil;
|
||||
import org.libreccm.security.Group;
|
||||
import org.libreccm.security.GroupRepository;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -58,46 +58,60 @@ class GroupsTable extends Grid<Group> {
|
|||
protected GroupsTable(final UsersGroupsRolesController controller) {
|
||||
|
||||
super();
|
||||
|
||||
|
||||
super.setDataProvider(controller.getGroupsTableDataProvider());
|
||||
|
||||
final ResourceBundle bundle = ResourceBundle
|
||||
.getBundle(AdminUiConstants.ADMIN_BUNDLE,
|
||||
UI.getCurrent().getLocale());
|
||||
final GlobalizationHelper globalizationHelper = controller
|
||||
.getGlobalizationHelper();
|
||||
|
||||
final LocalizedTextsUtil adminBundle = globalizationHelper
|
||||
.getLocalizedTextsUtil(AdminUiConstants.ADMIN_BUNDLE);
|
||||
|
||||
addColumn(Group::getName)
|
||||
.setId(COL_NAME)
|
||||
.setCaption(bundle.getString("ui.admin.groups.table.name"));
|
||||
addColumn(user -> bundle.getString("ui.admin.groups.table.edit"),
|
||||
new ButtonRenderer<>(event -> {
|
||||
// final GroupEditor groupEditor = new GroupEditor(
|
||||
final GroupDetails groupDetails = new GroupDetails(
|
||||
event.getItem(),
|
||||
controller.getGroupRepository());
|
||||
groupDetails.center();
|
||||
groupDetails.setWidth("50%");
|
||||
groupDetails.setHeight("100%");
|
||||
UI.getCurrent().addWindow(groupDetails);
|
||||
}))
|
||||
.setCaption(adminBundle.getText("ui.admin.groups.table.name"));
|
||||
addComponentColumn(group -> {
|
||||
final Button editButton = new Button(
|
||||
adminBundle.getText("ui.admin.groups.table.edit"),
|
||||
VaadinIcons.EDIT);
|
||||
editButton.addClickListener(event -> {
|
||||
final GroupDetails groupDetails = new GroupDetails(
|
||||
group,
|
||||
controller.getGroupsController());
|
||||
groupDetails.setModal(true);
|
||||
groupDetails.center();
|
||||
groupDetails.setWidth("50%");
|
||||
groupDetails.setHeight("100%");
|
||||
UI.getCurrent().addWindow(groupDetails);
|
||||
});
|
||||
editButton.addStyleName(ValoTheme.BUTTON_TINY);
|
||||
return editButton;
|
||||
})
|
||||
.setId(COL_EDIT);
|
||||
addColumn(user -> bundle.getString("ui.admin.groups.table.delete"),
|
||||
new ButtonRenderer<>(event -> {
|
||||
final ConfirmDeleteDialog dialog
|
||||
= new ConfirmDeleteDialog(
|
||||
event.getItem(),
|
||||
controller.getGroupRepository());
|
||||
dialog.center();
|
||||
UI.getCurrent().addWindow(dialog);
|
||||
}))
|
||||
addComponentColumn(group -> {
|
||||
final Button deleteButton = new Button(adminBundle.getText(
|
||||
"ui.admin.groups.table.delete"),
|
||||
VaadinIcons.CLOSE_CIRCLE_O);
|
||||
deleteButton.addClickListener(event -> {
|
||||
final ConfirmDeleteDialog dialog = new ConfirmDeleteDialog(
|
||||
group, controller.getGroupRepository(), adminBundle);
|
||||
dialog.setModal(true);
|
||||
dialog.center();
|
||||
UI.getCurrent().addWindow(dialog);
|
||||
});
|
||||
deleteButton.addStyleNames(ValoTheme.BUTTON_TINY,
|
||||
ValoTheme.BUTTON_DANGER);
|
||||
return deleteButton;
|
||||
})
|
||||
.setId(COL_DELETE);
|
||||
|
||||
final HeaderRow filterRow = appendHeaderRow();
|
||||
final HeaderCell GroupNameFilterCell = filterRow.getCell(COL_NAME);
|
||||
groupNameFilter = new TextField();
|
||||
groupNameFilter.setPlaceholder(bundle
|
||||
.getString("ui.admin.users.table.filter.groupname.placeholder"));
|
||||
groupNameFilter.setDescription(bundle
|
||||
.getString("ui.admin.users.table.filter.groupname.description"));
|
||||
groupNameFilter.setPlaceholder(adminBundle
|
||||
.getText("ui.admin.users.table.filter.groupname.placeholder"));
|
||||
groupNameFilter.setDescription(adminBundle
|
||||
.getText("ui.admin.users.table.filter.groupname.description"));
|
||||
groupNameFilter.addStyleName(ValoTheme.TEXTFIELD_TINY);
|
||||
groupNameFilter
|
||||
.addValueChangeListener(event -> {
|
||||
|
|
@ -110,8 +124,8 @@ class GroupsTable extends Grid<Group> {
|
|||
final HeaderCell actionsCell = actionsRow.join(COL_NAME,
|
||||
COL_EDIT,
|
||||
COL_DELETE);
|
||||
clearFiltersButton = new Button(bundle
|
||||
.getString("ui.admin.users.table.filter.clear"));
|
||||
clearFiltersButton = new Button(adminBundle
|
||||
.getText("ui.admin.users.table.filter.clear"));
|
||||
clearFiltersButton.setStyleName(ValoTheme.BUTTON_TINY);
|
||||
clearFiltersButton.setIcon(VaadinIcons.BACKSPACE);
|
||||
clearFiltersButton.addClickListener(event -> {
|
||||
|
|
@ -144,26 +158,24 @@ class GroupsTable extends Grid<Group> {
|
|||
private final GroupRepository groupRepo;
|
||||
|
||||
public ConfirmDeleteDialog(final Group group,
|
||||
final GroupRepository groupRepo) {
|
||||
final GroupRepository groupRepo,
|
||||
final LocalizedTextsUtil adminBundle) {
|
||||
|
||||
this.group = group;
|
||||
this.groupRepo = groupRepo;
|
||||
|
||||
final ResourceBundle bundle = ResourceBundle
|
||||
.getBundle(AdminUiConstants.ADMIN_BUNDLE,
|
||||
UI.getCurrent().getLocale());
|
||||
|
||||
final MessageFormat messageFormat = new MessageFormat(
|
||||
bundle.getString("ui.admin.groups.delete.confirm"));
|
||||
adminBundle.getText("ui.admin.groups.delete.confirm"));
|
||||
|
||||
final Label text = new Label(messageFormat
|
||||
.format(new Object[]{group.getName()}));
|
||||
|
||||
final Button yesButton
|
||||
= new Button(bundle.getString("ui.admin.yes"));
|
||||
= new Button(adminBundle.getText("ui.admin.yes"));
|
||||
yesButton.addClickListener(event -> deleteGroup());
|
||||
|
||||
final Button noButton = new Button(bundle.getString("ui.admin.no"));
|
||||
final Button noButton = new Button(adminBundle
|
||||
.getText("ui.admin.no"));
|
||||
noButton.addClickListener(event -> close());
|
||||
|
||||
final HorizontalLayout buttons = new HorizontalLayout(yesButton,
|
||||
|
|
|
|||
|
|
@ -18,11 +18,14 @@
|
|||
*/
|
||||
package org.libreccm.admin.ui;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Inject;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.Query;
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
|
|
@ -31,7 +34,9 @@ import java.util.Objects;
|
|||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@RequestScoped
|
||||
class JpqlConsoleController {
|
||||
class JpqlConsoleController implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1625999285594476564L;
|
||||
|
||||
@Inject
|
||||
private EntityManager entityManager;
|
||||
|
|
|
|||
|
|
@ -18,22 +18,18 @@
|
|||
*/
|
||||
package org.libreccm.admin.ui;
|
||||
|
||||
import com.arsdigita.ui.admin.AdminUiConstants;
|
||||
|
||||
import com.vaadin.icons.VaadinIcons;
|
||||
import com.vaadin.ui.Button;
|
||||
import com.vaadin.ui.Grid;
|
||||
import com.vaadin.ui.HorizontalLayout;
|
||||
import com.vaadin.ui.UI;
|
||||
import com.vaadin.ui.Window;
|
||||
import com.vaadin.ui.components.grid.HeaderCell;
|
||||
import com.vaadin.ui.components.grid.HeaderRow;
|
||||
import com.vaadin.ui.themes.ValoTheme;
|
||||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
import org.libreccm.security.Party;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -46,26 +42,22 @@ class PartySelector extends Window {
|
|||
private static final String COL_PARTY_NAME = "partyname";
|
||||
|
||||
protected PartySelector(final String caption,
|
||||
final String actionLabel,
|
||||
final List<Party> excludedParties,
|
||||
final PartySelectionAction action) {
|
||||
final String actionLabel,
|
||||
final PartySelectorDataProvider dataProvider,
|
||||
final List<Party> excludedParties,
|
||||
final PartySelectionAction action) {
|
||||
|
||||
addWidgets(caption, actionLabel, excludedParties, action);
|
||||
addWidgets(caption, actionLabel, dataProvider, excludedParties, action);
|
||||
}
|
||||
|
||||
private void addWidgets(final String caption,
|
||||
final String actionLabel,
|
||||
final PartySelectorDataProvider dataProvider,
|
||||
final List<Party> excludedParties,
|
||||
final PartySelectionAction action) {
|
||||
|
||||
setCaption(caption);
|
||||
|
||||
final ResourceBundle bundle = ResourceBundle
|
||||
.getBundle(AdminUiConstants.ADMIN_BUNDLE,
|
||||
UI.getCurrent().getLocale());
|
||||
|
||||
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||
|
||||
final Grid<Party> partiesGrid = new Grid<>();
|
||||
partiesGrid
|
||||
.addColumn(Party::getName)
|
||||
|
|
@ -94,12 +86,10 @@ class PartySelector extends Window {
|
|||
final HeaderCell actionsCell = actions.getCell(COL_PARTY_NAME);
|
||||
actionsCell.setComponent(new HorizontalLayout(actionButton,
|
||||
clearButton));
|
||||
|
||||
final PartySelectorDataProvider dataProvider = cdiUtil
|
||||
.findBean(PartySelectorDataProvider.class);
|
||||
|
||||
dataProvider.setExcludedParties(excludedParties);
|
||||
partiesGrid.setDataProvider(dataProvider);
|
||||
|
||||
|
||||
setContent(partiesGrid);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,13 +32,10 @@ import com.vaadin.ui.VerticalLayout;
|
|||
import com.vaadin.ui.Window;
|
||||
import com.vaadin.ui.components.grid.HeaderCell;
|
||||
import com.vaadin.ui.components.grid.HeaderRow;
|
||||
import com.vaadin.ui.renderers.ButtonRenderer;
|
||||
import com.vaadin.ui.themes.ValoTheme;
|
||||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
import org.libreccm.security.Party;
|
||||
import org.libreccm.security.PartyRepository;
|
||||
import org.libreccm.security.Role;
|
||||
import org.libreccm.security.RoleManager;
|
||||
import org.libreccm.security.RoleRepository;
|
||||
|
||||
import java.util.ResourceBundle;
|
||||
|
|
@ -54,22 +51,16 @@ class RoleDetails extends Window {
|
|||
private static final String COL_MEMBER_NAME = "partyname";
|
||||
private static final String COL_MEMBER_REMOVE = "member_remove";
|
||||
|
||||
// private final UsersGroupsRolesTab usersGroupsRoles;
|
||||
private final Role role;
|
||||
private final RoleRepository roleRepo;
|
||||
private final RoleManager roleManager;
|
||||
private final RolesController controller;
|
||||
|
||||
protected RoleDetails(final Role role,
|
||||
// final UsersGroupsRolesTab usersGroupsRoles,
|
||||
final RoleRepository roleRepo,
|
||||
final RoleManager roleManager) {
|
||||
final RolesController controller) {
|
||||
|
||||
super(String.format("Details of role %s", role.getName()));
|
||||
|
||||
// this.usersGroupsRoles = usersGroupsRoles;
|
||||
this.role = role;
|
||||
this.roleRepo = roleRepo;
|
||||
this.roleManager = roleManager;
|
||||
this.controller = controller;
|
||||
|
||||
addWidgets();
|
||||
}
|
||||
|
|
@ -95,9 +86,9 @@ class RoleDetails extends Window {
|
|||
final Button editButton = new Button(
|
||||
bundle.getString("ui.admin.roles.table.edit"),
|
||||
event -> {
|
||||
final RoleEditor editor = new RoleEditor(role,
|
||||
// usersGroupsRoles,
|
||||
roleRepo);
|
||||
final RoleEditor editor = new RoleEditor(
|
||||
role,
|
||||
controller.getRoleRepository());
|
||||
editor.center();
|
||||
UI.getCurrent().addWindow(editor);
|
||||
});
|
||||
|
|
@ -105,29 +96,32 @@ class RoleDetails extends Window {
|
|||
final VerticalLayout layout = new VerticalLayout(formLayout,
|
||||
editButton);
|
||||
|
||||
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||
final RolePartiesController partiesController = controller
|
||||
.getPartiesController();
|
||||
|
||||
final RolePartiesController partiesController = cdiUtil.findBean(
|
||||
RolePartiesController.class);
|
||||
final Grid<Party> partiesGrid = new Grid<>();
|
||||
partiesGrid
|
||||
.addColumn(Party::getName)
|
||||
.setId(COL_MEMBER_NAME)
|
||||
.setCaption("Name");
|
||||
partiesGrid
|
||||
.addColumn(party -> bundle
|
||||
.getString("ui.role.parties.remove"),
|
||||
new ButtonRenderer<>(event -> {
|
||||
partiesController
|
||||
.removePartyFromRole(event.getItem(), role);
|
||||
partiesGrid.getDataProvider().refreshAll();
|
||||
}))
|
||||
.addComponentColumn(party -> {
|
||||
final Button removeButton = new Button(
|
||||
bundle.getString("ui.role.parties.remove"),
|
||||
VaadinIcons.CLOSE_CIRCLE_O);
|
||||
removeButton.addClickListener(event -> {
|
||||
partiesController.removePartyFromRole(party, role);
|
||||
partiesGrid.getDataProvider().refreshAll();
|
||||
});
|
||||
removeButton.addStyleNames(ValoTheme.BUTTON_TINY,
|
||||
ValoTheme.BUTTON_DANGER);
|
||||
return removeButton;
|
||||
})
|
||||
.setId(COL_MEMBER_REMOVE);
|
||||
|
||||
partiesGrid.setWidth("100%");
|
||||
|
||||
final PartyRepository partyRepo = cdiUtil
|
||||
.findBean(PartyRepository.class);
|
||||
final PartyRepository partyRepo = controller.getPartyRepository();
|
||||
|
||||
final HeaderRow partiesGridHeader = partiesGrid.prependHeaderRow();
|
||||
final Button addPartyButton = new Button("Add member");
|
||||
|
|
@ -135,9 +129,10 @@ class RoleDetails extends Window {
|
|||
addPartyButton.setStyleName(ValoTheme.BUTTON_TINY);
|
||||
addPartyButton.addClickListener(event -> {
|
||||
final PartySelector partySelector = new PartySelector(
|
||||
"Select parties to add to role",
|
||||
"Add selected parties to role",
|
||||
partyRepo.findByRole(role),
|
||||
"Select parties to add to role",
|
||||
"Add selected parties to role",
|
||||
controller.getPartySelectorDataProvider(),
|
||||
partyRepo.findByRole(role),
|
||||
selectedParties -> {
|
||||
selectedParties.forEach(party -> {
|
||||
partiesController.assignPartyToRole(party, role);
|
||||
|
|
@ -152,20 +147,19 @@ class RoleDetails extends Window {
|
|||
UI.getCurrent().addWindow(partySelector);
|
||||
});
|
||||
final HeaderCell partiesGridHeaderCell = partiesGridHeader
|
||||
.join(COL_MEMBER_NAME, COL_MEMBER_REMOVE);
|
||||
.join(COL_MEMBER_NAME, COL_MEMBER_REMOVE);
|
||||
partiesGridHeaderCell
|
||||
.setComponent(new HorizontalLayout(addPartyButton));
|
||||
|
||||
final RolePartiesDataProvider partiesDataProvider = cdiUtil
|
||||
.findBean(RolePartiesDataProvider.class);
|
||||
|
||||
final RolePartiesDataProvider partiesDataProvider = controller
|
||||
.getRolePartiesDataProvider();
|
||||
partiesDataProvider.setRole(role);
|
||||
partiesGrid.setDataProvider(partiesDataProvider);
|
||||
|
||||
|
||||
final TabSheet tabs = new TabSheet();
|
||||
tabs.addTab(layout, "Details");
|
||||
tabs.addTab(partiesGrid, "Members");
|
||||
|
||||
|
||||
|
||||
setContent(tabs);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,11 +18,19 @@
|
|||
*/
|
||||
package org.libreccm.admin.ui;
|
||||
|
||||
import org.libreccm.security.*;
|
||||
|
||||
import org.libreccm.security.Party;
|
||||
import org.libreccm.security.PartyRepository;
|
||||
import org.libreccm.security.Role;
|
||||
import org.libreccm.security.RoleManager;
|
||||
import org.libreccm.security.RoleRepository;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Inject;
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
|
|
@ -30,7 +38,9 @@ import java.util.Set;
|
|||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@RequestScoped
|
||||
class RolePartiesController {
|
||||
class RolePartiesController implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -4256699834158368925L;
|
||||
|
||||
@Inject
|
||||
private PartyRepository partyRepo;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ import com.vaadin.ui.Window;
|
|||
import com.vaadin.ui.components.grid.HeaderCell;
|
||||
import com.vaadin.ui.components.grid.HeaderRow;
|
||||
import com.vaadin.ui.themes.ValoTheme;
|
||||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
import org.libreccm.security.Role;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -43,21 +42,21 @@ class RoleSelector extends Window {
|
|||
|
||||
protected RoleSelector(final String caption,
|
||||
final String actionLabel,
|
||||
final RoleSelectorDataProvider dataProvider,
|
||||
final List<Role> excludedRoles,
|
||||
final RoleSelectionAction action) {
|
||||
|
||||
addWidgets(caption, actionLabel, excludedRoles, action);
|
||||
addWidgets(caption, actionLabel, dataProvider, excludedRoles, action);
|
||||
}
|
||||
|
||||
private void addWidgets(final String caption,
|
||||
final String actionLabel,
|
||||
final RoleSelectorDataProvider dataProvider,
|
||||
final List<Role> excludedRoles,
|
||||
final RoleSelectionAction action) {
|
||||
|
||||
setCaption(caption);
|
||||
|
||||
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||
|
||||
final Grid<Role> rolesGrid = new Grid<>();
|
||||
rolesGrid
|
||||
.addColumn(Role::getName)
|
||||
|
|
@ -87,11 +86,8 @@ class RoleSelector extends Window {
|
|||
actionsCell.setComponent(new HorizontalLayout(actionButton,
|
||||
clearButton));
|
||||
|
||||
final RoleSelectorDataProvider dataProvider = cdiUtil
|
||||
.findBean(RoleSelectorDataProvider.class);
|
||||
|
||||
dataProvider.setExcludedRoles(excludedRoles);
|
||||
|
||||
rolesGrid.setDataProvider(dataProvider);
|
||||
|
||||
setContent(rolesGrid);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
* Copyright (C) 2017 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 org.libreccm.admin.ui;
|
||||
|
||||
import org.libreccm.security.PartyRepository;
|
||||
import org.libreccm.security.RoleRepository;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@RequestScoped
|
||||
class RolesController implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 429870757932223171L;
|
||||
|
||||
@Inject
|
||||
private RolePartiesController partiesController;
|
||||
|
||||
@Inject
|
||||
private PartyRepository partyRepository;
|
||||
|
||||
@Inject
|
||||
private PartySelectorDataProvider partySelectorDataProvider;
|
||||
|
||||
@Inject
|
||||
private RolePartiesDataProvider rolePartiesDataProvider;
|
||||
|
||||
@Inject
|
||||
private RoleRepository roleRepository;
|
||||
|
||||
protected RolePartiesController getPartiesController() {
|
||||
return partiesController;
|
||||
}
|
||||
|
||||
protected PartyRepository getPartyRepository() {
|
||||
return partyRepository;
|
||||
}
|
||||
|
||||
protected PartySelectorDataProvider getPartySelectorDataProvider() {
|
||||
return partySelectorDataProvider;
|
||||
}
|
||||
|
||||
protected RoleRepository getRoleRepository() {
|
||||
return roleRepository;
|
||||
}
|
||||
|
||||
protected RolePartiesDataProvider getRolePartiesDataProvider() {
|
||||
return rolePartiesDataProvider;
|
||||
}
|
||||
}
|
||||
|
|
@ -32,15 +32,14 @@ import com.vaadin.ui.Window;
|
|||
|
||||
import com.vaadin.ui.components.grid.HeaderCell;
|
||||
import com.vaadin.ui.components.grid.HeaderRow;
|
||||
import com.vaadin.ui.renderers.ButtonRenderer;
|
||||
import com.vaadin.ui.themes.ValoTheme;
|
||||
import org.libreccm.l10n.LocalizedTextsUtil;
|
||||
import org.libreccm.security.Role;
|
||||
import org.libreccm.security.RoleRepository;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.Locale;
|
||||
import java.util.Optional;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -62,16 +61,16 @@ class RolesTable extends Grid<Role> {
|
|||
protected RolesTable(final UsersGroupsRolesController controller) {
|
||||
|
||||
super();
|
||||
|
||||
|
||||
super.setDataProvider(controller.getRolesTableDataProvider());
|
||||
|
||||
final ResourceBundle bundle = ResourceBundle
|
||||
.getBundle(AdminUiConstants.ADMIN_BUNDLE,
|
||||
UI.getCurrent().getLocale());
|
||||
final LocalizedTextsUtil adminTextUtils = controller
|
||||
.getGlobalizationHelper()
|
||||
.getLocalizedTextsUtil(AdminUiConstants.ADMIN_BUNDLE);
|
||||
|
||||
addColumn(Role::getName)
|
||||
.setId(COL_NAME)
|
||||
.setCaption(bundle.getString("ui.admin.roles.table.name"));
|
||||
.setCaption(adminTextUtils.getText("ui.admin.roles.table.name"));
|
||||
addColumn(role -> {
|
||||
if (role.getDescription().hasValue(UI.getCurrent().getLocale())) {
|
||||
return role.getDescription()
|
||||
|
|
@ -93,36 +92,52 @@ class RolesTable extends Grid<Role> {
|
|||
}
|
||||
})
|
||||
.setId(COL_DESCRIPTION)
|
||||
.setCaption(bundle.getString("ui.admin.roles.table.description"));
|
||||
addColumn(user -> bundle.getString("ui.admin.roles.table.edit"),
|
||||
new ButtonRenderer<>(event -> {
|
||||
final RoleDetails roleDetails = new RoleDetails(
|
||||
event.getItem(),
|
||||
controller.getRoleRepository(),
|
||||
controller.getRoleManager());
|
||||
roleDetails.center();
|
||||
roleDetails.setWidth("80%");
|
||||
UI.getCurrent().addWindow(roleDetails);
|
||||
}))
|
||||
.setCaption(adminTextUtils.getText(
|
||||
"ui.admin.roles.table.description"));
|
||||
addComponentColumn(role -> {
|
||||
final Button editButton = new Button(
|
||||
adminTextUtils.getText("ui.admin.roles.table.edit"),
|
||||
VaadinIcons.EDIT);
|
||||
editButton.addClickListener(event -> {
|
||||
final RoleDetails roleDetails = new RoleDetails(
|
||||
role,
|
||||
controller.getRolesController());
|
||||
roleDetails.setModal(true);
|
||||
roleDetails.center();
|
||||
roleDetails.setWidth("80%");
|
||||
UI.getCurrent().addWindow(roleDetails);
|
||||
});
|
||||
editButton.addStyleName(ValoTheme.BUTTON_TINY);
|
||||
return editButton;
|
||||
})
|
||||
.setId(COL_EDIT);
|
||||
addColumn(user -> bundle.getString("ui.admin.roles.table.delete"),
|
||||
new ButtonRenderer<>(event -> {
|
||||
final ConfirmDeleteDialog dialog
|
||||
= new ConfirmDeleteDialog(
|
||||
event.getItem(),
|
||||
controller.getRoleRepository());
|
||||
dialog.center();
|
||||
UI.getCurrent().addWindow(dialog);
|
||||
}))
|
||||
addColumn(role -> {
|
||||
final Button deleteButton = new Button(
|
||||
adminTextUtils.getText("ui.admin.roles.table.delete"),
|
||||
VaadinIcons.MINUS_CIRCLE_O);
|
||||
deleteButton.addClickListener(event -> {
|
||||
final ConfirmDeleteDialog dialog
|
||||
= new ConfirmDeleteDialog(
|
||||
role,
|
||||
controller.getRoleRepository(),
|
||||
adminTextUtils);
|
||||
dialog.setModal(true);
|
||||
dialog.center();
|
||||
UI.getCurrent().addWindow(dialog);
|
||||
});
|
||||
deleteButton.addStyleNames(ValoTheme.BUTTON_TINY,
|
||||
ValoTheme.BUTTON_DANGER);
|
||||
return deleteButton;
|
||||
})
|
||||
.setId(COL_DELETE);
|
||||
|
||||
final HeaderRow filterRow = appendHeaderRow();
|
||||
final HeaderCell GroupNameFilterCell = filterRow.getCell(COL_NAME);
|
||||
roleNameFilter = new TextField();
|
||||
roleNameFilter.setPlaceholder(bundle
|
||||
.getString("ui.admin.users.table.filter.rolename.placeholder"));
|
||||
roleNameFilter.setDescription(bundle
|
||||
.getString("ui.admin.users.table.filter.rolename.description"));
|
||||
roleNameFilter.setPlaceholder(adminTextUtils
|
||||
.getText("ui.admin.users.table.filter.rolename.placeholder"));
|
||||
roleNameFilter.setDescription(adminTextUtils
|
||||
.getText("ui.admin.users.table.filter.rolename.description"));
|
||||
roleNameFilter.addStyleName(ValoTheme.TEXTFIELD_TINY);
|
||||
roleNameFilter
|
||||
.addValueChangeListener(event -> {
|
||||
|
|
@ -136,8 +151,8 @@ class RolesTable extends Grid<Role> {
|
|||
COL_DESCRIPTION,
|
||||
COL_EDIT,
|
||||
COL_DELETE);
|
||||
clearFiltersButton = new Button(bundle
|
||||
.getString("ui.admin.users.table.filter.clear"));
|
||||
clearFiltersButton = new Button(adminTextUtils
|
||||
.getText("ui.admin.users.table.filter.clear"));
|
||||
clearFiltersButton.setStyleName(ValoTheme.BUTTON_TINY);
|
||||
clearFiltersButton.setIcon(VaadinIcons.BACKSPACE);
|
||||
clearFiltersButton.addClickListener(event -> {
|
||||
|
|
@ -170,25 +185,23 @@ class RolesTable extends Grid<Role> {
|
|||
private final RoleRepository roleRepo;
|
||||
|
||||
public ConfirmDeleteDialog(final Role role,
|
||||
final RoleRepository roleRepo) {
|
||||
final RoleRepository roleRepo,
|
||||
final LocalizedTextsUtil adminBundle) {
|
||||
this.role = role;
|
||||
this.roleRepo = roleRepo;
|
||||
|
||||
final ResourceBundle bundle = ResourceBundle
|
||||
.getBundle(AdminUiConstants.ADMIN_BUNDLE,
|
||||
UI.getCurrent().getLocale());
|
||||
|
||||
final MessageFormat messageFormat = new MessageFormat(
|
||||
bundle.getString("ui.admin.roles.delete.confirm"));
|
||||
adminBundle.getText("ui.admin.roles.delete.confirm"));
|
||||
|
||||
final Label text = new Label(messageFormat
|
||||
.format(new Object[]{role.getName()}));
|
||||
|
||||
final Button yesButton
|
||||
= new Button(bundle.getString("ui.admin.yes"));
|
||||
= new Button(adminBundle.getText("ui.admin.yes"));
|
||||
yesButton.addClickListener(event -> deleteRole());
|
||||
|
||||
final Button noButton = new Button(bundle.getString("ui.admin.no"));
|
||||
final Button noButton = new Button(adminBundle
|
||||
.getText("ui.admin.no"));
|
||||
noButton.addClickListener(event -> close());
|
||||
|
||||
final HorizontalLayout buttons = new HorizontalLayout(yesButton,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,259 @@
|
|||
/*
|
||||
* Copyright (C) 2017 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 org.libreccm.admin.ui;
|
||||
|
||||
import com.arsdigita.ui.admin.AdminUiConstants;
|
||||
import com.arsdigita.util.SystemInformation;
|
||||
|
||||
import com.vaadin.data.provider.AbstractDataProvider;
|
||||
import com.vaadin.data.provider.Query;
|
||||
import com.vaadin.ui.CustomComponent;
|
||||
import com.vaadin.ui.Grid;
|
||||
import com.vaadin.ui.VerticalLayout;
|
||||
import org.libreccm.l10n.LocalizedTextsUtil;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Properties;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.parsers.SAXParserFactory;
|
||||
import javax.xml.transform.TransformerConfigurationException;
|
||||
import javax.xml.transform.TransformerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
class SystemInformationTab extends CustomComponent {
|
||||
|
||||
private static final long serialVersionUID = 2060924579790730222L;
|
||||
|
||||
private static final String COL_PROPERTY_NAME = "col_name";
|
||||
private static final String COL_PROPERTY_VALUE = "col_value";
|
||||
|
||||
protected SystemInformationTab(final AdminViewController controller) {
|
||||
|
||||
final LocalizedTextsUtil adminTextsUtil = controller
|
||||
.getGlobalizationHelper()
|
||||
.getLocalizedTextsUtil(AdminUiConstants.ADMIN_BUNDLE);
|
||||
|
||||
final Grid<Map.Entry<String, String>> ccmSysInfoGrid = new Grid<>();
|
||||
ccmSysInfoGrid
|
||||
.setCaption(adminTextsUtil.getText("ui.admin.sysinfo.appinfo"));
|
||||
ccmSysInfoGrid
|
||||
.addColumn(Map.Entry::getKey)
|
||||
.setCaption("Property")
|
||||
.setId(COL_PROPERTY_NAME);
|
||||
ccmSysInfoGrid
|
||||
.addColumn(Map.Entry::getValue)
|
||||
.setCaption("Value")
|
||||
.setId(COL_PROPERTY_VALUE);
|
||||
ccmSysInfoGrid.setDataProvider(new CcmSysInfoDataProvider());
|
||||
ccmSysInfoGrid.setWidth("30em");
|
||||
|
||||
final Grid<Map.Entry<Object, Object>> systemPropsGrid = new Grid<>();
|
||||
systemPropsGrid.setCaption(adminTextsUtil
|
||||
.getText("ui.admin.sysinfo.java_system_properties"));
|
||||
systemPropsGrid
|
||||
.addColumn(entry -> Objects.toString(entry.getKey()))
|
||||
.setCaption("Name")
|
||||
.setId(COL_PROPERTY_NAME);
|
||||
systemPropsGrid
|
||||
.addColumn(entry -> Objects.toString(entry.getValue()))
|
||||
.setCaption("Vaue")
|
||||
.setId(COL_PROPERTY_VALUE);
|
||||
systemPropsGrid.setDataProvider(new JavaSystemPropertiesDataProvider());
|
||||
systemPropsGrid.setWidth("30em");
|
||||
|
||||
final Grid<Map.Entry<String, String>> xmlConfigGrid = new Grid<>();
|
||||
xmlConfigGrid
|
||||
.setCaption(adminTextsUtil.getText("ui.admin.sysinfo.xml_config"));
|
||||
xmlConfigGrid
|
||||
.addColumn(Map.Entry::getKey)
|
||||
.setCaption("Property")
|
||||
.setId(COL_PROPERTY_NAME);
|
||||
xmlConfigGrid
|
||||
.addColumn(Map.Entry::getValue)
|
||||
.setCaption("Value")
|
||||
.setId(COL_PROPERTY_VALUE);
|
||||
xmlConfigGrid.setDataProvider(new XmlConfigDataProvider());
|
||||
xmlConfigGrid.setWidth("30em");
|
||||
|
||||
final VerticalLayout layout = new VerticalLayout(ccmSysInfoGrid,
|
||||
systemPropsGrid,
|
||||
xmlConfigGrid);
|
||||
|
||||
super.setCompositionRoot(layout);
|
||||
}
|
||||
|
||||
private class CcmSysInfoDataProvider
|
||||
extends AbstractDataProvider<Map.Entry<String, String>, String> {
|
||||
|
||||
private static final long serialVersionUID = 958711041782982594L;
|
||||
|
||||
private final SystemInformation sysInfo = SystemInformation
|
||||
.getInstance();
|
||||
|
||||
@Override
|
||||
public boolean isInMemory() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size(final Query<Map.Entry<String, String>, String> query) {
|
||||
return sysInfo.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<Map.Entry<String, String>> fetch(
|
||||
final Query<Map.Entry<String, String>, String> query) {
|
||||
|
||||
return sysInfo.getEntriesAsStream();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class JavaSystemPropertiesDataProvider
|
||||
extends AbstractDataProvider<Map.Entry<Object, Object>, String> {
|
||||
|
||||
private static final long serialVersionUID = -6971113377859500433L;
|
||||
|
||||
private final Properties systemProperties = System.getProperties();
|
||||
|
||||
@Override
|
||||
public boolean isInMemory() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size(final Query<Map.Entry<Object, Object>, String> query) {
|
||||
|
||||
return systemProperties.entrySet().size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<Map.Entry<Object, Object>> fetch(
|
||||
final Query<Map.Entry<Object, Object>, String> query) {
|
||||
|
||||
return systemProperties.entrySet().stream();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class XmlConfigDataProvider
|
||||
extends AbstractDataProvider<Map.Entry<String, String>, String> {
|
||||
|
||||
private static final long serialVersionUID = 3724329522046019159L;
|
||||
|
||||
@Override
|
||||
public boolean isInMemory() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size(final Query<Map.Entry<String, String>, String> query) {
|
||||
return 6;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<Map.Entry<String, String>> fetch(
|
||||
final Query<Map.Entry<String, String>, String> query) {
|
||||
|
||||
final Map<String, String> properties = new HashMap<>();
|
||||
properties.put("XML Transformer Factory",
|
||||
getTransformerFactory());
|
||||
properties.put("XML Transformer", getTransformer());
|
||||
properties.put("XML Document Builder Factory",
|
||||
getDocumentBuilderFactory());
|
||||
properties.put("XML Document Builder", getDocumentBuilder());
|
||||
properties.put("SAX Parser Factory", getSaxParserFactory());
|
||||
properties.put("SAX Parser", getSaxParser());
|
||||
|
||||
return properties.entrySet().stream();
|
||||
}
|
||||
|
||||
private String getTransformerFactory() {
|
||||
return TransformerFactory
|
||||
.newInstance()
|
||||
.getClass()
|
||||
.getName();
|
||||
}
|
||||
|
||||
private String getTransformer() {
|
||||
try {
|
||||
return TransformerFactory
|
||||
.newInstance()
|
||||
.newTransformer()
|
||||
.getClass()
|
||||
.getName();
|
||||
} catch (TransformerConfigurationException ex) {
|
||||
|
||||
return "???";
|
||||
}
|
||||
}
|
||||
|
||||
private String getDocumentBuilderFactory() {
|
||||
return DocumentBuilderFactory
|
||||
.newInstance()
|
||||
.getClass()
|
||||
.getName();
|
||||
}
|
||||
|
||||
private String getDocumentBuilder() {
|
||||
try {
|
||||
return DocumentBuilderFactory
|
||||
.newInstance()
|
||||
.newDocumentBuilder()
|
||||
.getClass()
|
||||
.getName();
|
||||
} catch (ParserConfigurationException ex) {
|
||||
|
||||
return "???";
|
||||
}
|
||||
}
|
||||
|
||||
private String getSaxParserFactory() {
|
||||
return SAXParserFactory
|
||||
.newInstance()
|
||||
.getClass()
|
||||
.getName();
|
||||
}
|
||||
|
||||
private String getSaxParser() {
|
||||
try {
|
||||
return SAXParserFactory
|
||||
.newInstance()
|
||||
.newSAXParser()
|
||||
.getClass()
|
||||
.getName();
|
||||
} catch (ParserConfigurationException
|
||||
| SAXException ex) {
|
||||
|
||||
return "???";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -32,16 +32,12 @@ import com.vaadin.ui.VerticalLayout;
|
|||
import com.vaadin.ui.Window;
|
||||
import com.vaadin.ui.components.grid.HeaderCell;
|
||||
import com.vaadin.ui.components.grid.HeaderRow;
|
||||
import com.vaadin.ui.renderers.ButtonRenderer;
|
||||
import com.vaadin.ui.themes.ValoTheme;
|
||||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
import org.libreccm.security.Group;
|
||||
import org.libreccm.security.GroupRepository;
|
||||
import org.libreccm.security.Role;
|
||||
import org.libreccm.security.RoleRepository;
|
||||
import org.libreccm.security.User;
|
||||
import org.libreccm.security.UserManager;
|
||||
import org.libreccm.security.UserRepository;
|
||||
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
|
|
@ -60,18 +56,14 @@ class UserDetails extends Window {
|
|||
private static final String COL_ROLE_REMOVE = "role_remove";
|
||||
|
||||
private final User user;
|
||||
private final UserRepository userRepo;
|
||||
private final UserManager userManager;
|
||||
private final UsersController controller;
|
||||
|
||||
protected UserDetails(final User user,
|
||||
final UserRepository userRepo,
|
||||
final UserManager userManager) {
|
||||
protected UserDetails(final User user, final UsersController controller) {
|
||||
|
||||
super(String.format("Details of user %s", user.getName()));
|
||||
|
||||
this.user = user;
|
||||
this.userRepo = userRepo;
|
||||
this.userManager = userManager;
|
||||
this.controller = controller;
|
||||
|
||||
addWidgets();
|
||||
}
|
||||
|
|
@ -127,8 +119,8 @@ class UserDetails extends Window {
|
|||
bundle.getString("ui.admin.users.table.edit"),
|
||||
event -> {
|
||||
final UserEditor editor = new UserEditor(user,
|
||||
userRepo,
|
||||
userManager);
|
||||
controller);
|
||||
editor.setModal(true);
|
||||
editor.center();
|
||||
UI.getCurrent().addWindow(editor);
|
||||
});
|
||||
|
|
@ -136,29 +128,31 @@ class UserDetails extends Window {
|
|||
final VerticalLayout layout = new VerticalLayout(formLayout,
|
||||
editButton);
|
||||
|
||||
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||
|
||||
final UserGroupsController groupsController = cdiUtil
|
||||
.findBean(UserGroupsController.class);
|
||||
final UserGroupsController groupsController = controller
|
||||
.getGroupsController();
|
||||
final Grid<Group> groupsGrid = new Grid<>();
|
||||
groupsGrid
|
||||
.addColumn(Group::getName)
|
||||
.setId(COL_GROUP_NAME)
|
||||
.setCaption("Group");
|
||||
groupsGrid
|
||||
.addColumn(group -> bundle
|
||||
.getString("ui.user.groups.remove"),
|
||||
new ButtonRenderer<>(event -> {
|
||||
groupsController
|
||||
.removeUserFromGroup(user, event.getItem());
|
||||
groupsGrid.getDataProvider().refreshAll();
|
||||
}))
|
||||
.addComponentColumn(group -> {
|
||||
final Button removeButton = new Button(
|
||||
bundle.getString("ui.user.groups.remove"),
|
||||
VaadinIcons.MINUS_CIRCLE_O);
|
||||
removeButton.addClickListener(event -> {
|
||||
groupsController.removeUserFromGroup(user, group);
|
||||
groupsGrid.getDataProvider().refreshAll();
|
||||
});
|
||||
removeButton.addStyleNames(ValoTheme.BUTTON_TINY,
|
||||
ValoTheme.BUTTON_DANGER);
|
||||
return removeButton;
|
||||
})
|
||||
.setId(COL_GROUP_REMOVE);
|
||||
|
||||
groupsGrid.setWidth("100%");
|
||||
|
||||
final GroupRepository groupRepo = cdiUtil
|
||||
.findBean(GroupRepository.class);
|
||||
final GroupRepository groupRepo = controller.getGroupRepository();
|
||||
|
||||
final HeaderRow groupsGridHeader = groupsGrid.prependHeaderRow();
|
||||
final Button addGroupButton = new Button("Add group");
|
||||
|
|
@ -168,6 +162,7 @@ class UserDetails extends Window {
|
|||
final GroupSelector groupSelector = new GroupSelector(
|
||||
"Select group(s) to which the user is added.",
|
||||
"Add user to selected groups",
|
||||
controller.getGroupSelectorDataProvider(),
|
||||
groupRepo.findByMember(user),
|
||||
selectedGroups -> {
|
||||
selectedGroups.forEach(group -> {
|
||||
|
|
@ -187,31 +182,36 @@ class UserDetails extends Window {
|
|||
groupsGridHeaderCell
|
||||
.setComponent(new HorizontalLayout(addGroupButton));
|
||||
|
||||
final UserGroupsTableDataProvider groupsDataProvider = cdiUtil
|
||||
.findBean(UserGroupsTableDataProvider.class);
|
||||
final UserGroupsTableDataProvider groupsDataProvider = controller
|
||||
.getGroupsTableDataProvider();
|
||||
groupsDataProvider.setUser(user);
|
||||
groupsGrid.setDataProvider(groupsDataProvider);
|
||||
|
||||
final UserRolesController rolesController = cdiUtil
|
||||
.findBean(UserRolesController.class);
|
||||
final UserRolesController rolesController = controller
|
||||
.getRolesController();
|
||||
final Grid<Role> rolesGrid = new Grid<>();
|
||||
rolesGrid
|
||||
.addColumn(Role::getName)
|
||||
.setId(COL_ROLE_NAME)
|
||||
.setCaption("Role");
|
||||
rolesGrid
|
||||
.addColumn(role -> bundle
|
||||
.getString("ui.user.roles.remove"),
|
||||
new ButtonRenderer<>(event -> {
|
||||
rolesController
|
||||
.removeRoleFromUser(event.getItem(), user);
|
||||
rolesGrid.getDataProvider().refreshAll();
|
||||
}))
|
||||
.setId(COL_ROLE_REMOVE);
|
||||
.addComponentColumn(role -> {
|
||||
final Button removeButton = new Button(
|
||||
bundle.getString("ui.user.roles.remove"),
|
||||
VaadinIcons.MINUS_CIRCLE_O);
|
||||
removeButton.addClickListener(event -> {
|
||||
rolesController.removeRoleFromUser(role, user);
|
||||
rolesGrid.getDataProvider().refreshAll();
|
||||
});
|
||||
removeButton.addStyleNames(ValoTheme.BUTTON_TINY,
|
||||
ValoTheme.BUTTON_DANGER);
|
||||
return removeButton;
|
||||
})
|
||||
.setId(COL_ROLE_NAME);
|
||||
|
||||
rolesGrid.setWidth("100%");
|
||||
|
||||
final RoleRepository roleRepo = cdiUtil.findBean(RoleRepository.class);
|
||||
final RoleRepository roleRepo = controller.getRoleRepository();
|
||||
|
||||
final HeaderRow rolesGridHeader = rolesGrid.prependHeaderRow();
|
||||
final Button addRoleButton = new Button("Add role");
|
||||
|
|
@ -221,6 +221,7 @@ class UserDetails extends Window {
|
|||
final RoleSelector roleSelector = new RoleSelector(
|
||||
"Select role(s) to add to group",
|
||||
"Add selected role(s) to group",
|
||||
controller.getRoleSelectorDataProvider(),
|
||||
roleRepo.findByParty(user),
|
||||
(selectedRoles -> {
|
||||
selectedRoles.forEach(role -> {
|
||||
|
|
@ -241,8 +242,8 @@ class UserDetails extends Window {
|
|||
rolesGridHeaderCell
|
||||
.setComponent(new HorizontalLayout(addRoleButton));
|
||||
|
||||
final UserRolesTableDataProvider rolesDataProvider = cdiUtil
|
||||
.findBean(UserRolesTableDataProvider.class);
|
||||
final UserRolesTableDataProvider rolesDataProvider = controller
|
||||
.getRolesTableDataProvider();
|
||||
rolesDataProvider.setUser(user);
|
||||
rolesGrid.setDataProvider(rolesDataProvider);
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@ import com.vaadin.ui.Window;
|
|||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
import org.libreccm.core.EmailAddress;
|
||||
import org.libreccm.core.UnexpectedErrorException;
|
||||
import org.libreccm.security.ChallengeManager;
|
||||
|
|
@ -68,12 +67,12 @@ class UserEditor extends Window {
|
|||
DO_NOTHING,
|
||||
GENERATE_AND_SEND,
|
||||
SET,
|
||||
|
||||
}
|
||||
|
||||
private final User user;
|
||||
private final UserRepository userRepo;
|
||||
private final UserManager userManager;
|
||||
private final ChallengeManager challengeManager;
|
||||
|
||||
private boolean dataHasChanged = false;
|
||||
|
||||
|
|
@ -87,27 +86,27 @@ class UserEditor extends Window {
|
|||
private CheckBox passwordResetRequired;
|
||||
private CheckBox banned;
|
||||
|
||||
protected UserEditor(final UserRepository userRepo,
|
||||
final UserManager userManager) {
|
||||
protected UserEditor(final UsersController controller) {
|
||||
|
||||
super("Create new user");
|
||||
|
||||
user = null;
|
||||
this.userRepo = userRepo;
|
||||
this.userManager = userManager;
|
||||
userRepo = controller.getUserRepository();
|
||||
userManager = controller.getUserManager();
|
||||
challengeManager = controller.getChallengeManager();
|
||||
|
||||
addWidgets();
|
||||
}
|
||||
|
||||
public UserEditor(final User user,
|
||||
final UserRepository userRepo,
|
||||
final UserManager userManager) {
|
||||
final UsersController controller) {
|
||||
|
||||
super(String.format("Edit user %s", user.getName()));
|
||||
|
||||
this.user = user;
|
||||
this.userRepo = userRepo;
|
||||
this.userManager = userManager;
|
||||
userRepo = controller.getUserRepository();
|
||||
userManager = controller.getUserManager();
|
||||
challengeManager = controller.getChallengeManager();
|
||||
|
||||
addWidgets();
|
||||
}
|
||||
|
|
@ -411,9 +410,6 @@ class UserEditor extends Window {
|
|||
switch (passwordOptions.getValue()) {
|
||||
case GENERATE_AND_SEND: {
|
||||
userManager.updatePassword(currentUser, null);
|
||||
final ChallengeManager challengeManager = CdiUtil
|
||||
.createCdiUtil()
|
||||
.findBean(ChallengeManager.class);
|
||||
try {
|
||||
challengeManager.sendPasswordRecover(currentUser);
|
||||
} catch (MessagingException ex) {
|
||||
|
|
|
|||
|
|
@ -18,11 +18,19 @@
|
|||
*/
|
||||
package org.libreccm.admin.ui;
|
||||
|
||||
import org.libreccm.security.*;
|
||||
import org.libreccm.l10n.GlobalizationHelper;
|
||||
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.io.Serializable;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Inject;
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
|
|
@ -30,7 +38,12 @@ import java.util.Set;
|
|||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@RequestScoped
|
||||
class UserGroupsController {
|
||||
class UserGroupsController implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -3226620773017042743L;
|
||||
|
||||
@Inject
|
||||
private GlobalizationHelper globalizationHelper;
|
||||
|
||||
@Inject
|
||||
private GroupRepository groupRepo;
|
||||
|
|
@ -41,6 +54,10 @@ class UserGroupsController {
|
|||
@Inject
|
||||
private UserRepository userRepo;
|
||||
|
||||
protected GlobalizationHelper getGlobalizationHelper() {
|
||||
return globalizationHelper;
|
||||
}
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
protected void addUserToGroups(final User user, final Set<Group> groups) {
|
||||
|
||||
|
|
@ -55,31 +72,31 @@ class UserGroupsController {
|
|||
.orElseThrow(() -> new IllegalArgumentException(String
|
||||
.format("No Group with ID %d in the database.",
|
||||
group.getPartyId())));
|
||||
|
||||
|
||||
final User theUser = userRepo
|
||||
.findById(user.getPartyId())
|
||||
.orElseThrow(() -> new IllegalArgumentException(String
|
||||
.format("No user with ID %d in the database. ",
|
||||
user.getPartyId())));
|
||||
|
||||
|
||||
groupManager.addMemberToGroup(theUser, theGroup);
|
||||
}
|
||||
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
protected void removeUserFromGroup(final User user, final Group group) {
|
||||
|
||||
|
||||
final Group theGroup = groupRepo
|
||||
.findById(group.getPartyId())
|
||||
.orElseThrow(() -> new IllegalArgumentException(String
|
||||
.format("No Group with ID %d in the database.",
|
||||
group.getPartyId())));
|
||||
|
||||
|
||||
final User theUser = userRepo
|
||||
.findById(user.getPartyId())
|
||||
.orElseThrow(() -> new IllegalArgumentException(String
|
||||
.format("No user with ID %d in the database. ",
|
||||
user.getPartyId())));
|
||||
|
||||
|
||||
groupManager.removeMemberFromGroup(theUser, theGroup);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,11 +18,18 @@
|
|||
*/
|
||||
package org.libreccm.admin.ui;
|
||||
|
||||
import org.libreccm.security.*;
|
||||
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.io.Serializable;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Inject;
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
|
|
@ -30,7 +37,9 @@ import java.util.Set;
|
|||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@RequestScoped
|
||||
class UserRolesController {
|
||||
class UserRolesController implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1136907020235869523L;
|
||||
|
||||
@Inject
|
||||
private RoleRepository roleRepo;
|
||||
|
|
|
|||
|
|
@ -18,22 +18,18 @@
|
|||
*/
|
||||
package org.libreccm.admin.ui;
|
||||
|
||||
import com.arsdigita.ui.admin.AdminUiConstants;
|
||||
|
||||
import com.vaadin.icons.VaadinIcons;
|
||||
import com.vaadin.ui.Button;
|
||||
import com.vaadin.ui.Grid;
|
||||
import com.vaadin.ui.HorizontalLayout;
|
||||
import com.vaadin.ui.UI;
|
||||
import com.vaadin.ui.Window;
|
||||
import com.vaadin.ui.components.grid.HeaderCell;
|
||||
import com.vaadin.ui.components.grid.HeaderRow;
|
||||
import com.vaadin.ui.themes.ValoTheme;
|
||||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
import org.libreccm.security.User;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -50,25 +46,21 @@ class UserSelector extends Window {
|
|||
|
||||
protected UserSelector(final String caption,
|
||||
final String actionLabel,
|
||||
final UserSelectorDataProvider dataProvider,
|
||||
final List<User> excludedUsers,
|
||||
final UserSelectionAction action) {
|
||||
|
||||
addWidgets(caption, actionLabel, excludedUsers, action);
|
||||
addWidgets(caption, actionLabel, dataProvider, excludedUsers, action);
|
||||
}
|
||||
|
||||
private void addWidgets(final String caption,
|
||||
final String actionLabel,
|
||||
final UserSelectorDataProvider dataProvider,
|
||||
final List<User> excludedUsers,
|
||||
final UserSelectionAction action) {
|
||||
|
||||
setCaption(caption);
|
||||
|
||||
final ResourceBundle bundle = ResourceBundle
|
||||
.getBundle(AdminUiConstants.ADMIN_BUNDLE,
|
||||
UI.getCurrent().getLocale());
|
||||
|
||||
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||
|
||||
final Grid<User> usersGrid = new Grid<>();
|
||||
usersGrid
|
||||
.addColumn(User::getName)
|
||||
|
|
@ -113,8 +105,6 @@ class UserSelector extends Window {
|
|||
actionsCell.setComponent(new HorizontalLayout(actionButton,
|
||||
clearButton));
|
||||
|
||||
final UserSelectorDataProvider dataProvider = cdiUtil
|
||||
.findBean(UserSelectorDataProvider.class);
|
||||
dataProvider.setExcludedUsers(excludedUsers);
|
||||
usersGrid.setDataProvider(dataProvider);
|
||||
|
||||
|
|
|
|||
|
|
@ -19,9 +19,14 @@
|
|||
package org.libreccm.admin.ui;
|
||||
|
||||
import com.vaadin.cdi.ViewScoped;
|
||||
import org.libreccm.security.ChallengeManager;
|
||||
import org.libreccm.security.GroupRepository;
|
||||
import org.libreccm.security.RoleRepository;
|
||||
import org.libreccm.security.UserManager;
|
||||
import org.libreccm.security.UserRepository;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
|
|
@ -30,7 +35,33 @@ import javax.inject.Inject;
|
|||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@ViewScoped
|
||||
class UsersController {
|
||||
class UsersController implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -3133073086999101093L;
|
||||
|
||||
@Inject
|
||||
private GroupRepository groupRepository;
|
||||
|
||||
@Inject
|
||||
private GroupSelectorDataProvider groupSelectorDataProvider;
|
||||
|
||||
@Inject
|
||||
private UserGroupsController groupsController;
|
||||
|
||||
@Inject
|
||||
private UserGroupsTableDataProvider groupsTableDataProvider;
|
||||
|
||||
@Inject
|
||||
private UserRolesController rolesController;
|
||||
|
||||
@Inject
|
||||
private UserRolesTableDataProvider rolesTableDataProvider;
|
||||
|
||||
@Inject
|
||||
private RoleRepository roleRepository;
|
||||
|
||||
@Inject
|
||||
private RoleSelectorDataProvider roleSelectorDataProvider;
|
||||
|
||||
@Inject
|
||||
private UserManager userManager;
|
||||
|
|
@ -41,8 +72,23 @@ class UsersController {
|
|||
@Inject
|
||||
private UsersTableDataProvider usersTableDataProvider;
|
||||
|
||||
protected UsersController() {
|
||||
super();
|
||||
@Inject
|
||||
private ChallengeManager challengeManager;
|
||||
|
||||
protected GroupRepository getGroupRepository() {
|
||||
return groupRepository;
|
||||
}
|
||||
|
||||
protected GroupSelectorDataProvider getGroupSelectorDataProvider() {
|
||||
return groupSelectorDataProvider;
|
||||
}
|
||||
|
||||
protected UserGroupsController getGroupsController() {
|
||||
return groupsController;
|
||||
}
|
||||
|
||||
protected UserGroupsTableDataProvider getGroupsTableDataProvider() {
|
||||
return groupsTableDataProvider;
|
||||
}
|
||||
|
||||
protected UserManager getUserManager() {
|
||||
|
|
@ -53,10 +99,28 @@ class UsersController {
|
|||
return userRepository;
|
||||
}
|
||||
|
||||
protected RoleRepository getRoleRepository() {
|
||||
return roleRepository;
|
||||
}
|
||||
|
||||
protected UserRolesTableDataProvider getRolesTableDataProvider() {
|
||||
return rolesTableDataProvider;
|
||||
}
|
||||
|
||||
protected UserRolesController getRolesController() {
|
||||
return rolesController;
|
||||
}
|
||||
|
||||
protected RoleSelectorDataProvider getRoleSelectorDataProvider() {
|
||||
return roleSelectorDataProvider;
|
||||
}
|
||||
|
||||
protected UsersTableDataProvider getUsersTableDataProvider() {
|
||||
return usersTableDataProvider;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public ChallengeManager getChallengeManager() {
|
||||
return challengeManager;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
package org.libreccm.admin.ui;
|
||||
|
||||
import org.libreccm.l10n.GlobalizationHelper;
|
||||
import org.libreccm.security.GroupManager;
|
||||
import org.libreccm.security.GroupRepository;
|
||||
import org.libreccm.security.RoleManager;
|
||||
|
|
@ -25,6 +26,8 @@ import org.libreccm.security.RoleRepository;
|
|||
import org.libreccm.security.UserManager;
|
||||
import org.libreccm.security.UserRepository;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Inject;
|
||||
|
||||
|
|
@ -33,7 +36,12 @@ import javax.inject.Inject;
|
|||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@RequestScoped
|
||||
class UsersGroupsRolesController {
|
||||
class UsersGroupsRolesController implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -1994224681148412678L;
|
||||
|
||||
@Inject
|
||||
private GlobalizationHelper globalizationHelper;
|
||||
|
||||
@Inject
|
||||
private GroupManager groupManager;
|
||||
|
|
@ -41,9 +49,15 @@ class UsersGroupsRolesController {
|
|||
@Inject
|
||||
private GroupRepository groupRepository;
|
||||
|
||||
@Inject
|
||||
private GroupsController groupsController;
|
||||
|
||||
@Inject
|
||||
private GroupsTableDataProvider groupsTableDataProvider;
|
||||
|
||||
@Inject
|
||||
private RolesController rolesController;
|
||||
|
||||
@Inject
|
||||
private RoleManager roleManager;
|
||||
|
||||
|
|
@ -59,42 +73,61 @@ class UsersGroupsRolesController {
|
|||
@Inject
|
||||
private UserRepository userRepository;
|
||||
|
||||
@Inject
|
||||
private UsersController usersController;
|
||||
|
||||
@Inject
|
||||
private UsersTableDataProvider usersTableDataProvider;
|
||||
|
||||
public GroupManager getGroupManager() {
|
||||
protected GlobalizationHelper getGlobalizationHelper() {
|
||||
return globalizationHelper;
|
||||
}
|
||||
|
||||
protected GroupManager getGroupManager() {
|
||||
return groupManager;
|
||||
}
|
||||
|
||||
public GroupRepository getGroupRepository() {
|
||||
protected GroupRepository getGroupRepository() {
|
||||
return groupRepository;
|
||||
}
|
||||
|
||||
public GroupsTableDataProvider getGroupsTableDataProvider() {
|
||||
protected GroupsController getGroupsController() {
|
||||
return groupsController;
|
||||
}
|
||||
|
||||
protected GroupsTableDataProvider getGroupsTableDataProvider() {
|
||||
return groupsTableDataProvider;
|
||||
}
|
||||
|
||||
public RoleManager getRoleManager() {
|
||||
protected RolesController getRolesController() {
|
||||
return rolesController;
|
||||
}
|
||||
|
||||
protected RoleManager getRoleManager() {
|
||||
return roleManager;
|
||||
}
|
||||
|
||||
public RoleRepository getRoleRepository() {
|
||||
protected RoleRepository getRoleRepository() {
|
||||
return RoleRepository;
|
||||
}
|
||||
|
||||
public RolesTableDataProvider getRolesTableDataProvider() {
|
||||
protected RolesTableDataProvider getRolesTableDataProvider() {
|
||||
return rolesTableDataProvider;
|
||||
}
|
||||
|
||||
public UserManager getUserManager() {
|
||||
protected UserManager getUserManager() {
|
||||
return userManager;
|
||||
}
|
||||
|
||||
public UserRepository getUserRepository() {
|
||||
protected UserRepository getUserRepository() {
|
||||
return userRepository;
|
||||
}
|
||||
|
||||
public UsersTableDataProvider getUsersTableDataProvider() {
|
||||
protected UsersController getUsersController() {
|
||||
return usersController;
|
||||
}
|
||||
|
||||
protected UsersTableDataProvider getUsersTableDataProvider() {
|
||||
return usersTableDataProvider;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,11 +29,10 @@ import com.vaadin.ui.UI;
|
|||
|
||||
import com.vaadin.ui.components.grid.HeaderCell;
|
||||
import com.vaadin.ui.components.grid.HeaderRow;
|
||||
import com.vaadin.ui.renderers.ButtonRenderer;
|
||||
import com.vaadin.ui.themes.ValoTheme;
|
||||
import org.libreccm.l10n.LocalizedTextsUtil;
|
||||
import org.libreccm.security.User;
|
||||
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -61,73 +60,75 @@ class UsersTable extends Grid<User> {
|
|||
super();
|
||||
|
||||
setDataProvider(controller.getUsersTableDataProvider());
|
||||
|
||||
final ResourceBundle bundle = ResourceBundle
|
||||
.getBundle(AdminUiConstants.ADMIN_BUNDLE,
|
||||
UI.getCurrent().getLocale());
|
||||
|
||||
final LocalizedTextsUtil adminTextsUtil = controller
|
||||
.getGlobalizationHelper()
|
||||
.getLocalizedTextsUtil(AdminUiConstants.ADMIN_BUNDLE);
|
||||
|
||||
super.addColumn(User::getName)
|
||||
.setId(COL_USER_NAME)
|
||||
.setCaption(bundle.getString("ui.admin.users.table.screenname"));
|
||||
.setCaption(adminTextsUtil
|
||||
.getText("ui.admin.users.table.screenname"));
|
||||
super.addColumn(User::getGivenName)
|
||||
.setId(COL_GIVEN_NAME)
|
||||
.setCaption(bundle.getString("ui.admin.users.table.givenname"));
|
||||
.setCaption(adminTextsUtil.getText("ui.admin.users.table.givenname"));
|
||||
super.addColumn(User::getFamilyName)
|
||||
.setId(COL_FAMILY_NAME)
|
||||
.setCaption(bundle.getString("ui.admin.users.table.familyname"));
|
||||
.setCaption(adminTextsUtil
|
||||
.getText("ui.admin.users.table.familyname"));
|
||||
super.addColumn(user -> user.getPrimaryEmailAddress().getAddress())
|
||||
.setId(COL_EMAIL)
|
||||
.setCaption(bundle.getString("ui.admin.users.table.primary_email"));
|
||||
.setCaption(adminTextsUtil.getText(
|
||||
"ui.admin.users.table.primary_email"));
|
||||
super.addColumn(user -> {
|
||||
if (user.isBanned()) {
|
||||
return bundle.getString("ui.admin.user.banned_yes");
|
||||
return adminTextsUtil.getText("ui.admin.user.banned_yes");
|
||||
} else {
|
||||
return bundle.getString("ui.admin.user.banned_no");
|
||||
return adminTextsUtil.getText("ui.admin.user.banned_no");
|
||||
}
|
||||
})
|
||||
.setId(COL_BANNED)
|
||||
.setCaption("Banned?");
|
||||
super.addColumn(user -> {
|
||||
if (user.isPasswordResetRequired()) {
|
||||
return bundle.getString(
|
||||
return adminTextsUtil.getText(
|
||||
"ui.admin.user.password_reset_required_yes");
|
||||
} else {
|
||||
return bundle.getString(
|
||||
return adminTextsUtil.getText(
|
||||
"ui.admin.user.password_reset_required_no");
|
||||
}
|
||||
})
|
||||
.setId(COL_PASSWORD_RESET_REQUIRED)
|
||||
.setCaption(bundle
|
||||
.getString("ui.admin.users.table.password_reset_required"));
|
||||
super.addColumn(user -> bundle.getString("ui.admin.users.table.edit"),
|
||||
new ButtonRenderer<>(event -> {
|
||||
// final UserEditor editor = new UserEditor(
|
||||
// event.getItem(),
|
||||
// usersGroupsRoles,
|
||||
// view.getUserRepository(),
|
||||
// view.getUserManager());
|
||||
// editor.center();
|
||||
// UI.getCurrent().addWindow(editor);
|
||||
final UserDetails details = new UserDetails(
|
||||
event.getItem(),
|
||||
controller.getUserRepository(),
|
||||
controller.getUserManager());
|
||||
details.center();
|
||||
details.setWidth("66.6%");
|
||||
details.addCloseListener(closeEvent -> {
|
||||
getDataProvider().refreshAll();
|
||||
});
|
||||
UI.getCurrent().addWindow(details);
|
||||
}))
|
||||
.setCaption(adminTextsUtil.getText(
|
||||
"ui.admin.users.table.password_reset_required"));
|
||||
super.addComponentColumn(user -> {
|
||||
final Button editButton = new Button(
|
||||
adminTextsUtil.getText("ui.admin.users.table.edit"),
|
||||
VaadinIcons.EDIT);
|
||||
editButton.addClickListener(event -> {
|
||||
final UserDetails details = new UserDetails(
|
||||
user,
|
||||
controller.getUsersController());
|
||||
details.setModal(true);
|
||||
details.center();
|
||||
details.setWidth("66.6%");
|
||||
details.addCloseListener(closeEvent -> {
|
||||
getDataProvider().refreshAll();
|
||||
});
|
||||
UI.getCurrent().addWindow(details);
|
||||
});
|
||||
editButton.addStyleName(ValoTheme.BUTTON_TINY);
|
||||
return editButton;
|
||||
})
|
||||
.setId(COL_EDIT);
|
||||
|
||||
final HeaderRow filterRow = appendHeaderRow();
|
||||
final HeaderCell userNameFilterCell = filterRow.getCell(COL_USER_NAME);
|
||||
userNameFilter = new TextField();
|
||||
userNameFilter.setPlaceholder(bundle
|
||||
.getString("ui.admin.users.table.filter.screenname.placeholder"));
|
||||
userNameFilter.setDescription(bundle
|
||||
.getString("ui.admin.users.table.filter.screenname.description"));
|
||||
userNameFilter.setPlaceholder(adminTextsUtil
|
||||
.getText("ui.admin.users.table.filter.screenname.placeholder"));
|
||||
userNameFilter.setDescription(adminTextsUtil
|
||||
.getText("ui.admin.users.table.filter.screenname.description"));
|
||||
userNameFilter.addStyleName(ValoTheme.TEXTFIELD_TINY);
|
||||
userNameFilter
|
||||
.addValueChangeListener(event -> {
|
||||
|
|
@ -142,8 +143,8 @@ class UsersTable extends Grid<User> {
|
|||
COL_FAMILY_NAME,
|
||||
COL_EMAIL,
|
||||
COL_BANNED);
|
||||
clearFiltersButton = new Button(bundle
|
||||
.getString("ui.admin.users.table.filter.clear"));
|
||||
clearFiltersButton = new Button(adminTextsUtil
|
||||
.getText("ui.admin.users.table.filter.clear"));
|
||||
clearFiltersButton.addStyleName(ValoTheme.BUTTON_TINY);
|
||||
clearFiltersButton.addClickListener(event -> {
|
||||
userNameFilter.setValue("");
|
||||
|
|
@ -153,9 +154,8 @@ class UsersTable extends Grid<User> {
|
|||
createUserButton.addStyleName(ValoTheme.BUTTON_TINY);
|
||||
createUserButton.setIcon(VaadinIcons.PLUS);
|
||||
createUserButton.addClickListener(event -> {
|
||||
final UserEditor userEditor = new UserEditor(
|
||||
controller.getUserRepository(),
|
||||
controller.getUserManager());
|
||||
final UserEditor userEditor = new UserEditor(controller
|
||||
.getUsersController());
|
||||
userEditor.addCloseListener(closeEvent -> {
|
||||
getDataProvider().refreshAll();
|
||||
});
|
||||
|
|
@ -168,34 +168,4 @@ class UsersTable extends Grid<User> {
|
|||
actionsCell.setComponent(actionsLayout);
|
||||
}
|
||||
|
||||
// public void localize() {
|
||||
//
|
||||
// final ResourceBundle bundle = ResourceBundle
|
||||
// .getBundle(AdminUiConstants.ADMIN_BUNDLE,
|
||||
// UI.getCurrent().getLocale());
|
||||
//
|
||||
// getColumn(COL_USER_NAME)
|
||||
// .setCaption(bundle.getString("ui.admin.users.table.screenname"));
|
||||
// getColumn(COL_GIVEN_NAME)
|
||||
// .setCaption(bundle.getString("ui.admin.users.table.givenname"));
|
||||
// getColumn(COL_FAMILY_NAME)
|
||||
// .setCaption(bundle.getString("ui.admin.users.table.familyname"));
|
||||
// getColumn(COL_EMAIL)
|
||||
// .setCaption(bundle.getString("ui.admin.users.table.primary_email"));
|
||||
// getColumn(COL_BANNED)
|
||||
// .setCaption(bundle.getString("ui.admin.users.table.banned"));
|
||||
// getColumn(COL_PASSWORD_RESET_REQUIRED)
|
||||
// .setCaption(bundle.getString(
|
||||
// "ui.admin.users.table.password_reset_required"));
|
||||
//
|
||||
// userNameFilter.setPlaceholder(bundle
|
||||
// .getString("ui.admin.users.table.filter.screenname.placeholder"));
|
||||
// userNameFilter.setDescription(bundle
|
||||
// .getString("ui.admin.users.table.filter.screenname.description"));
|
||||
//
|
||||
// clearFiltersButton.setCaption(bundle
|
||||
// .getString("ui.admin.users.table.filter.clear"));
|
||||
//
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -130,17 +130,19 @@ public class GlobalizationHelper implements Serializable {
|
|||
}
|
||||
|
||||
public Locale getNegotiatedLocale() {
|
||||
|
||||
final KernelConfig kernelConfig = confManager.findConfiguration(
|
||||
KernelConfig.class);
|
||||
|
||||
Locale preferred = kernelConfig.getDefaultLocale();
|
||||
|
||||
final Locale selectedLocale = getSelectedLocale();
|
||||
if (selectedLocale == null || !kernelConfig.hasLanguage(selectedLocale
|
||||
.getLanguage())) {
|
||||
if (selectedLocale == null
|
||||
|| !kernelConfig.hasLanguage(selectedLocale.getLanguage())) {
|
||||
|
||||
final Enumeration<Locale> acceptedLocales = request.getLocales();
|
||||
|
||||
while (acceptedLocales.hasMoreElements()) {
|
||||
|
||||
final Locale current = acceptedLocales.nextElement();
|
||||
if (kernelConfig.hasLanguage(current.getLanguage())) {
|
||||
preferred = new Locale(current.getLanguage());
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@
|
|||
*/
|
||||
package org.libreccm.sites;
|
||||
|
||||
import static org.libreccm.core.CoreConstants.*;
|
||||
|
||||
import org.libreccm.web.CcmApplication;
|
||||
|
||||
import java.util.Objects;
|
||||
|
|
@ -33,7 +35,7 @@ import javax.persistence.Table;
|
|||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "SITE_AWARE_APPLICATIONS")
|
||||
@Table(name = "SITE_AWARE_APPLICATIONS", schema = DB_SCHEMA)
|
||||
public class SiteAwareApplication extends CcmApplication {
|
||||
|
||||
private static final long serialVersionUID = -8892544588904174406L;
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
create table SITE_AWARE_APPLICATIONS (
|
||||
create table CCM_CORE.SITE_AWARE_APPLICATIONS (
|
||||
OBJECT_ID bigint not null,
|
||||
SITE_ID bigint,
|
||||
primary key (OBJECT_ID)
|
||||
);
|
||||
|
||||
alter table SITE_AWARE_APPLICATIONS
|
||||
alter table CCM_CORE.SITE_AWARE_APPLICATIONS
|
||||
add constraint FKopo91c29jaunpcusjwlphhxkd
|
||||
foreign key (SITE_ID)
|
||||
references CCM_CORE.SITES;
|
||||
|
||||
alter table SITE_AWARE_APPLICATIONS
|
||||
alter table CCM_CORE.SITE_AWARE_APPLICATIONS
|
||||
add constraint FKslbu2qagg23dmdu01lun7oh7x
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.APPLICATIONS;
|
||||
|
|
@ -1,15 +1,15 @@
|
|||
create table SITE_AWARE_APPLICATIONS (
|
||||
create table CCM_CORE.SITE_AWARE_APPLICATIONS (
|
||||
OBJECT_ID int8 not null,
|
||||
SITE_ID int8,
|
||||
primary key (OBJECT_ID)
|
||||
);
|
||||
|
||||
alter table SITE_AWARE_APPLICATIONS
|
||||
alter table CCM_CORE.SITE_AWARE_APPLICATIONS
|
||||
add constraint FKopo91c29jaunpcusjwlphhxkd
|
||||
foreign key (SITE_ID)
|
||||
references CCM_CORE.SITES;
|
||||
|
||||
alter table SITE_AWARE_APPLICATIONS
|
||||
alter table CCM_CORE.SITE_AWARE_APPLICATIONS
|
||||
add constraint FKslbu2qagg23dmdu01lun7oh7x
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.APPLICATIONS;
|
||||
|
|
@ -2,7 +2,6 @@ drop schema if exists CCM_CORE;
|
|||
|
||||
drop sequence if exists HIBERNATE_SEQUENCE;
|
||||
|
||||
|
||||
create schema CCM_CORE;
|
||||
|
||||
create table CCM_CORE.APPLICATIONS (
|
||||
|
|
@ -531,10 +530,10 @@ drop sequence if exists HIBERNATE_SEQUENCE;
|
|||
CONFIGURATION_CLASS varchar(512) not null,
|
||||
NAME varchar(512) not null,
|
||||
SETTING_VALUE_STRING varchar(1024),
|
||||
SETTING_VALUE_BOOLEAN boolean,
|
||||
SETTING_VALUE_DOUBLE double,
|
||||
SETTING_VALUE_BIG_DECIMAL decimal(19,2),
|
||||
SETTING_VALUE_LONG bigint,
|
||||
SETTING_VALUE_BOOLEAN boolean,
|
||||
primary key (SETTING_ID)
|
||||
);
|
||||
|
||||
|
|
@ -555,6 +554,12 @@ drop sequence if exists HIBERNATE_SEQUENCE;
|
|||
value varchar(255)
|
||||
);
|
||||
|
||||
create table CCM_CORE.SITE_AWARE_APPLICATIONS (
|
||||
OBJECT_ID bigint not null,
|
||||
SITE_ID bigint,
|
||||
primary key (OBJECT_ID)
|
||||
);
|
||||
|
||||
create table CCM_CORE.SITES (
|
||||
DEFAULT_SITE boolean,
|
||||
DEFAULT_THEME varchar(255),
|
||||
|
|
@ -1117,6 +1122,16 @@ drop sequence if exists HIBERNATE_SEQUENCE;
|
|||
foreign key (LIST_ID)
|
||||
references CCM_CORE.SETTINGS;
|
||||
|
||||
alter table CCM_CORE.SITE_AWARE_APPLICATIONS
|
||||
add constraint FKopo91c29jaunpcusjwlphhxkd
|
||||
foreign key (SITE_ID)
|
||||
references CCM_CORE.SITES;
|
||||
|
||||
alter table CCM_CORE.SITE_AWARE_APPLICATIONS
|
||||
add constraint FKslbu2qagg23dmdu01lun7oh7x
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.APPLICATIONS;
|
||||
|
||||
alter table CCM_CORE.SITES
|
||||
add constraint FKrca95c6p023men53b8ayu26kp
|
||||
foreign key (OBJECT_ID)
|
||||
|
|
|
|||
|
|
@ -530,10 +530,10 @@ drop sequence if exists HIBERNATE_SEQUENCE;
|
|||
CONFIGURATION_CLASS varchar(512) not null,
|
||||
NAME varchar(512) not null,
|
||||
SETTING_VALUE_STRING varchar(1024),
|
||||
SETTING_VALUE_BOOLEAN boolean,
|
||||
SETTING_VALUE_DOUBLE float8,
|
||||
SETTING_VALUE_BIG_DECIMAL numeric(19, 2),
|
||||
SETTING_VALUE_LONG int8,
|
||||
SETTING_VALUE_BOOLEAN boolean,
|
||||
primary key (SETTING_ID)
|
||||
);
|
||||
|
||||
|
|
@ -554,6 +554,12 @@ drop sequence if exists HIBERNATE_SEQUENCE;
|
|||
value varchar(255)
|
||||
);
|
||||
|
||||
create table CCM_CORE.SITE_AWARE_APPLICATIONS (
|
||||
OBJECT_ID int8 not null,
|
||||
SITE_ID int8,
|
||||
primary key (OBJECT_ID)
|
||||
);
|
||||
|
||||
create table CCM_CORE.SITES (
|
||||
DEFAULT_SITE boolean,
|
||||
DEFAULT_THEME varchar(255),
|
||||
|
|
@ -1116,6 +1122,16 @@ drop sequence if exists HIBERNATE_SEQUENCE;
|
|||
foreign key (LIST_ID)
|
||||
references CCM_CORE.SETTINGS;
|
||||
|
||||
alter table CCM_CORE.SITE_AWARE_APPLICATIONS
|
||||
add constraint FKopo91c29jaunpcusjwlphhxkd
|
||||
foreign key (SITE_ID)
|
||||
references CCM_CORE.SITES;
|
||||
|
||||
alter table CCM_CORE.SITE_AWARE_APPLICATIONS
|
||||
add constraint FKslbu2qagg23dmdu01lun7oh7x
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.APPLICATIONS;
|
||||
|
||||
alter table CCM_CORE.SITES
|
||||
add constraint FKrca95c6p023men53b8ayu26kp
|
||||
foreign key (OBJECT_ID)
|
||||
|
|
|
|||
Loading…
Reference in New Issue