CCM NG:
- Login now works - CdiUtil now uses JNDI to lookup CDI BeanManager because that works more reliable. git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@3862 8810af33-2d31-482b-a856-94f89814c4dfpull/2/head
parent
3ac09f8510
commit
dd1556afbb
|
|
@ -37,6 +37,7 @@ import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.enterprise.inject.spi.CDI;
|
import javax.enterprise.inject.spi.CDI;
|
||||||
|
import javax.inject.Inject;
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
@ -67,6 +68,9 @@ public class BebopApplicationServlet extends BaseApplicationServlet {
|
||||||
private static final Logger LOGGER = LogManager.getLogger(
|
private static final Logger LOGGER = LogManager.getLogger(
|
||||||
BebopApplicationServlet.class);
|
BebopApplicationServlet.class);
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private Subject subject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* URL (pathinfo) -> Page object mapping. Based on it (and the http request
|
* URL (pathinfo) -> Page object mapping. Based on it (and the http request
|
||||||
* url) the doService method to selects a page to display
|
* url) the doService method to selects a page to display
|
||||||
|
|
@ -152,7 +156,7 @@ public class BebopApplicationServlet extends BaseApplicationServlet {
|
||||||
final String pathInfo = sreq.getPathInfo();
|
final String pathInfo = sreq.getPathInfo();
|
||||||
Assert.exists(pathInfo, "String pathInfo");
|
Assert.exists(pathInfo, "String pathInfo");
|
||||||
|
|
||||||
final Subject subject = CDI.current().select(Subject.class).get();
|
//final Subject subject = CDI.current().select(Subject.class).get();
|
||||||
LOGGER.debug("Current session is: {}", sreq.getSession().getId());
|
LOGGER.debug("Current session is: {}", sreq.getSession().getId());
|
||||||
LOGGER.debug("Current Shiro session is {}",
|
LOGGER.debug("Current Shiro session is {}",
|
||||||
subject.getSession().getId().toString());
|
subject.getSession().getId().toString());
|
||||||
|
|
|
||||||
|
|
@ -44,9 +44,8 @@ public final class DispatcherConfig {
|
||||||
private String defaultPageClass = "com.arsdigita.bebop.Page";
|
private String defaultPageClass = "com.arsdigita.bebop.Page";
|
||||||
|
|
||||||
public static DispatcherConfig getConfig() {
|
public static DispatcherConfig getConfig() {
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final ConfigurationManager confManager = CdiUtil.createCdiUtil()
|
||||||
final ConfigurationManager confManager = cdiUtil.findBean(
|
.findBean(ConfigurationManager.class);
|
||||||
ConfigurationManager.class);
|
|
||||||
return confManager.findConfiguration(DispatcherConfig.class);
|
return confManager.findConfiguration(DispatcherConfig.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -130,4 +129,5 @@ public final class DispatcherConfig {
|
||||||
staticUrlPrefix,
|
staticUrlPrefix,
|
||||||
defaultPageClass);
|
defaultPageClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,9 +43,8 @@ public final class FormBuilderConfig {
|
||||||
private Boolean interpolateEmailActions;
|
private Boolean interpolateEmailActions;
|
||||||
|
|
||||||
public static FormBuilderConfig getConfig() {
|
public static FormBuilderConfig getConfig() {
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final ConfigurationManager confManager = CdiUtil.createCdiUtil()
|
||||||
final ConfigurationManager confManager = cdiUtil.findBean(
|
.findBean(ConfigurationManager.class);
|
||||||
ConfigurationManager.class);
|
|
||||||
return confManager.findConfiguration(FormBuilderConfig.class);
|
return confManager.findConfiguration(FormBuilderConfig.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,9 +37,8 @@ public class GlobalizationConfig {
|
||||||
private String defaultCharset = "UTF-8";
|
private String defaultCharset = "UTF-8";
|
||||||
|
|
||||||
public static GlobalizationConfig getConfig() {
|
public static GlobalizationConfig getConfig() {
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final ConfigurationManager confManager = CdiUtil.createCdiUtil()
|
||||||
final ConfigurationManager confManager = cdiUtil.findBean(
|
.findBean(ConfigurationManager.class);
|
||||||
ConfigurationManager.class);
|
|
||||||
return confManager.findConfiguration(GlobalizationConfig.class);
|
return confManager.findConfiguration(GlobalizationConfig.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -81,4 +80,5 @@ public class GlobalizationConfig {
|
||||||
super.toString(),
|
super.toString(),
|
||||||
defaultCharset);
|
defaultCharset);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -70,9 +70,6 @@ public final class KernelConfig {
|
||||||
private String defaultLanguage = "en";
|
private String defaultLanguage = "en";
|
||||||
|
|
||||||
public static KernelConfig getConfig() {
|
public static KernelConfig getConfig() {
|
||||||
// final CdiUtil cdiUtil = new CdiUtil();
|
|
||||||
// final ConfigurationManager confManager = cdiUtil.findBean(
|
|
||||||
// ConfigurationManager.class);
|
|
||||||
final ConfigurationManager confManager = CdiUtil.createCdiUtil()
|
final ConfigurationManager confManager = CdiUtil.createCdiUtil()
|
||||||
.findBean(ConfigurationManager.class);
|
.findBean(ConfigurationManager.class);
|
||||||
return confManager.findConfiguration(KernelConfig.class);
|
return confManager.findConfiguration(KernelConfig.class);
|
||||||
|
|
|
||||||
|
|
@ -50,9 +50,8 @@ public final class MailConfig {
|
||||||
private Boolean sendHtml = false;
|
private Boolean sendHtml = false;
|
||||||
|
|
||||||
public static MailConfig getConfig() {
|
public static MailConfig getConfig() {
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final ConfigurationManager confManager = CdiUtil.createCdiUtil()
|
||||||
final ConfigurationManager confManager = cdiUtil.findBean(
|
.findBean(ConfigurationManager.class);
|
||||||
ConfigurationManager.class);
|
|
||||||
return confManager.findConfiguration(MailConfig.class);
|
return confManager.findConfiguration(MailConfig.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,9 +51,8 @@ public final class NotificationConfig {
|
||||||
private Integer simpleQueuePeriod = 900;
|
private Integer simpleQueuePeriod = 900;
|
||||||
|
|
||||||
public static NotificationConfig getConfig() {
|
public static NotificationConfig getConfig() {
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final ConfigurationManager confManager = CdiUtil.createCdiUtil()
|
||||||
final ConfigurationManager confManager = cdiUtil.findBean(
|
.findBean(ConfigurationManager.class);
|
||||||
ConfigurationManager.class);
|
|
||||||
return confManager.findConfiguration(NotificationConfig.class);
|
return confManager.findConfiguration(NotificationConfig.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,9 +49,8 @@ public final class TemplatingConfig {
|
||||||
private Integer stylesheetCacheAge = 3600;
|
private Integer stylesheetCacheAge = 3600;
|
||||||
|
|
||||||
public static TemplatingConfig getConfig() {
|
public static TemplatingConfig getConfig() {
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final ConfigurationManager confManager = CdiUtil.createCdiUtil()
|
||||||
final ConfigurationManager confManager = cdiUtil.findBean(
|
.findBean(ConfigurationManager.class);
|
||||||
ConfigurationManager.class);
|
|
||||||
return confManager.findConfiguration(TemplatingConfig.class);
|
return confManager.findConfiguration(TemplatingConfig.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,11 +55,9 @@ public final class UIConfig {
|
||||||
private String workspaceUrl = "/pvt/";
|
private String workspaceUrl = "/pvt/";
|
||||||
|
|
||||||
public static UIConfig getConfig() {
|
public static UIConfig getConfig() {
|
||||||
// final CdiUtil cdiUtil = new CdiUtil();
|
final ConfigurationManager confManager = CdiUtil.createCdiUtil()
|
||||||
// final ConfigurationManager confManager = cdiUtil.findBean(
|
.findBean(ConfigurationManager.class);
|
||||||
// ConfigurationManager.class);
|
|
||||||
final ConfigurationManager confManager = CDI.current().select(
|
|
||||||
ConfigurationManager.class).get();
|
|
||||||
return confManager.findConfiguration(UIConfig.class);
|
return confManager.findConfiguration(UIConfig.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -116,13 +116,10 @@ public class AdminServlet
|
||||||
ServletException, IOException {
|
ServletException, IOException {
|
||||||
// /////// Some preparational steps ///////////////
|
// /////// Some preparational steps ///////////////
|
||||||
/* Determine access privilege: only logged in users may access */
|
/* Determine access privilege: only logged in users may access */
|
||||||
// final CdiUtil cdiUtil = new CdiUtil();
|
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||||
// final Subject subject = cdiUtil.findBean(Subject.class);
|
final Subject subject = cdiUtil.findBean(Subject.class);
|
||||||
final Subject subject = CDI.current().select(Subject.class).get();
|
final PermissionChecker permissionChecker = cdiUtil.findBean(
|
||||||
// final PermissionChecker permissionChecker = cdiUtil.findBean(
|
PermissionChecker.class);
|
||||||
// PermissionChecker.class);
|
|
||||||
final PermissionChecker permissionChecker = CDI.current().select(
|
|
||||||
PermissionChecker.class).get();
|
|
||||||
|
|
||||||
final ConfigurationManager confManager = CDI.current().select(ConfigurationManager.class).get();
|
final ConfigurationManager confManager = CDI.current().select(ConfigurationManager.class).get();
|
||||||
if (confManager == null) {
|
if (confManager == null) {
|
||||||
|
|
@ -172,9 +169,11 @@ public class AdminServlet
|
||||||
// final Document doc = page.buildDocument(sreq, sresp);
|
// final Document doc = page.buildDocument(sreq, sresp);
|
||||||
// Templating.getPresentationManager().servePage(doc, sreq, sresp);
|
// Templating.getPresentationManager().servePage(doc, sreq, sresp);
|
||||||
// }
|
// }
|
||||||
final Page page = new Page();
|
final Page page = PageFactory.buildPage("admin", "LibreCCM NG Admin");
|
||||||
page.add(new Label("admin"));
|
page.add(new Label("admin"));
|
||||||
|
|
||||||
|
page.lock();
|
||||||
|
|
||||||
final Document doc = page.buildDocument(sreq, sresp);
|
final Document doc = page.buildDocument(sreq, sresp);
|
||||||
Templating.getPresentationManager().servePage(doc, sreq, sresp);
|
Templating.getPresentationManager().servePage(doc, sreq, sresp);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ public class ApplicationsAdministrationTab extends LayoutPanel implements
|
||||||
|
|
||||||
setLeft(applicationTree);
|
setLeft(applicationTree);
|
||||||
|
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||||
final org.libreccm.web.ApplicationManager appManager = cdiUtil.findBean(
|
final org.libreccm.web.ApplicationManager appManager = cdiUtil.findBean(
|
||||||
org.libreccm.web.ApplicationManager.class);
|
org.libreccm.web.ApplicationManager.class);
|
||||||
|
|
||||||
|
|
@ -213,7 +213,7 @@ public class ApplicationsAdministrationTab extends LayoutPanel implements
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Selected key is the name of a instance pane
|
// Selected key is the name of a instance pane
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||||
final ApplicationRepository appRepo = cdiUtil.findBean(
|
final ApplicationRepository appRepo = cdiUtil.findBean(
|
||||||
ApplicationRepository.class);
|
ApplicationRepository.class);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ class GroupEditForm extends GroupForm implements FormInitListener,
|
||||||
final Long id = (Long) state.getValue(USER_ID_PARAM);
|
final Long id = (Long) state.getValue(USER_ID_PARAM);
|
||||||
|
|
||||||
// if (id != null) {
|
// if (id != null) {
|
||||||
// final CdiUtil cdiUtil = new CdiUtil();
|
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||||
// final GroupRepository groupRepository;
|
// final GroupRepository groupRepository;
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
@ -86,7 +86,7 @@ class GroupEditForm extends GroupForm implements FormInitListener,
|
||||||
|
|
||||||
final PageState state = event.getPageState();
|
final PageState state = event.getPageState();
|
||||||
final Long id = (Long) state.getValue(GROUP_ID_PARAM);
|
final Long id = (Long) state.getValue(GROUP_ID_PARAM);
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||||
// final GroupRepository groupRepository;
|
// final GroupRepository groupRepository;
|
||||||
// groupRepository = cdiUtil.findBean(GroupRepository.class);
|
// groupRepository = cdiUtil.findBean(GroupRepository.class);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ class SubMemberPanel extends BoxPanel {
|
||||||
|
|
||||||
if (key != null) {
|
if (key != null) {
|
||||||
final Long userID = new Long(key);
|
final Long userID = new Long(key);
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||||
// final UserRepository userRepository;
|
// final UserRepository userRepository;
|
||||||
// final GroupManager groupManager;
|
// final GroupManager groupManager;
|
||||||
// final GroupRepository groupRepository;
|
// final GroupRepository groupRepository;
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,7 @@ class UserBrowsePane extends SegmentedPanel
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(final ActionEvent event) {
|
public void actionPerformed(final ActionEvent event) {
|
||||||
// final PageState state = event.getPageState();
|
// final PageState state = event.getPageState();
|
||||||
// final CdiUtil cdiUtil = new CdiUtil();
|
// final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||||
// final CcmSessionContext sessionContext;
|
// final CcmSessionContext sessionContext;
|
||||||
|
|
||||||
// sessionContext = cdiUtil.findBean(CcmSessionContext.class);
|
// sessionContext = cdiUtil.findBean(CcmSessionContext.class);
|
||||||
|
|
@ -143,7 +143,7 @@ class UserBrowsePane extends SegmentedPanel
|
||||||
protected Object initialValue(final PageState state) {
|
protected Object initialValue(final PageState state) {
|
||||||
final Long id = (Long) state.getValue(USER_ID_PARAM);
|
final Long id = (Long) state.getValue(USER_ID_PARAM);
|
||||||
|
|
||||||
// final CdiUtil cdiUtil = new CdiUtil();
|
// final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||||
// final UserRepository userRepository;
|
// final UserRepository userRepository;
|
||||||
|
|
||||||
// userRepository = cdiUtil.findBean(UserRepository.class);
|
// userRepository = cdiUtil.findBean(UserRepository.class);
|
||||||
|
|
@ -346,7 +346,7 @@ class UserBrowsePane extends SegmentedPanel
|
||||||
final PageState state = event.getPageState();
|
final PageState state = event.getPageState();
|
||||||
// final BigDecimal id = (BigDecimal) state.getValue(USER_ID_PARAM);
|
// final BigDecimal id = (BigDecimal) state.getValue(USER_ID_PARAM);
|
||||||
//
|
//
|
||||||
// final CdiUtil cdiUtil = new CdiUtil();
|
// final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||||
// final LoginManager loginManager;
|
// final LoginManager loginManager;
|
||||||
|
|
||||||
// loginManager = cdiUtil.findBean(
|
// loginManager = cdiUtil.findBean(
|
||||||
|
|
@ -421,7 +421,7 @@ class UserBrowsePane extends SegmentedPanel
|
||||||
final PageState state = event.getPageState();
|
final PageState state = event.getPageState();
|
||||||
final User user = getUser(state);
|
final User user = getUser(state);
|
||||||
|
|
||||||
// final CdiUtil cdiUtil = new CdiUtil();
|
// final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||||
// final UserRepository userRepository;
|
// final UserRepository userRepository;
|
||||||
|
|
||||||
// userRepository = cdiUtil.findBean(UserRepository.class);
|
// userRepository = cdiUtil.findBean(UserRepository.class);
|
||||||
|
|
@ -461,7 +461,7 @@ class UserBrowsePane extends SegmentedPanel
|
||||||
// User user = getUser(state);
|
// User user = getUser(state);
|
||||||
// user.setBanned(true);
|
// user.setBanned(true);
|
||||||
//
|
//
|
||||||
// final CdiUtil cdiUtil = new CdiUtil();
|
// final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||||
// final UserRepository userRepository;
|
// final UserRepository userRepository;
|
||||||
|
|
||||||
// userRepository = cdiUtil.findBean(UserRepository.class);
|
// userRepository = cdiUtil.findBean(UserRepository.class);
|
||||||
|
|
@ -492,7 +492,7 @@ class UserBrowsePane extends SegmentedPanel
|
||||||
// User user = getUser(state);
|
// User user = getUser(state);
|
||||||
// user.setBanned(false);
|
// user.setBanned(false);
|
||||||
//
|
//
|
||||||
// final CdiUtil cdiUtil = new CdiUtil();
|
// final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||||
// final UserRepository userRepository;
|
// final UserRepository userRepository;
|
||||||
|
|
||||||
// userRepository = cdiUtil.findBean(UserRepository.class);
|
// userRepository = cdiUtil.findBean(UserRepository.class);
|
||||||
|
|
@ -672,7 +672,7 @@ class UserBrowsePane extends SegmentedPanel
|
||||||
PageState ps = event.getPageState();
|
PageState ps = event.getPageState();
|
||||||
String id = (String) m_groupList.getSelectedKey(ps);
|
String id = (String) m_groupList.getSelectedKey(ps);
|
||||||
if (id != null) {
|
if (id != null) {
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||||
// final GroupRepository groupRepository;
|
// final GroupRepository groupRepository;
|
||||||
|
|
||||||
// groupRepository = cdiUtil
|
// groupRepository = cdiUtil
|
||||||
|
|
@ -706,7 +706,7 @@ class UserTableModel implements TableModel {
|
||||||
private int index = 0;
|
private int index = 0;
|
||||||
|
|
||||||
public UserTableModel() {
|
public UserTableModel() {
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||||
// final UserRepository userRepository;
|
// final UserRepository userRepository;
|
||||||
|
|
||||||
// userRepository = cdiUtil.findBean(UserRepository.class);
|
// userRepository = cdiUtil.findBean(UserRepository.class);
|
||||||
|
|
|
||||||
|
|
@ -237,7 +237,7 @@ class UserForm extends Form implements FormValidationListener, AdminConstants {
|
||||||
/**
|
/**
|
||||||
* Verify that primary email and screen name are unique
|
* Verify that primary email and screen name are unique
|
||||||
*/
|
*/
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||||
// final UserRepository userRepository;
|
// final UserRepository userRepository;
|
||||||
|
|
||||||
// userRepository = cdiUtil.findBean(UserRepository.class);
|
// userRepository = cdiUtil.findBean(UserRepository.class);
|
||||||
|
|
|
||||||
|
|
@ -133,7 +133,7 @@ class UserPasswordForm extends Form
|
||||||
|
|
||||||
final PageState state = event.getPageState();
|
final PageState state = event.getPageState();
|
||||||
|
|
||||||
// final CdiUtil cdiUtil = new CdiUtil();
|
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||||
// final UserRepository userRepository;
|
// final UserRepository userRepository;
|
||||||
|
|
||||||
// userRepository = cdiUtil.findBean(UserRepository.class);
|
// userRepository = cdiUtil.findBean(UserRepository.class);
|
||||||
|
|
@ -157,7 +157,7 @@ class UserPasswordForm extends Form
|
||||||
FormData data = event.getFormData();
|
FormData data = event.getFormData();
|
||||||
HttpServletRequest req = state.getRequest();
|
HttpServletRequest req = state.getRequest();
|
||||||
|
|
||||||
// final CdiUtil cdiUtil = new CdiUtil();
|
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||||
// final UserRepository userRepository;
|
// final UserRepository userRepository;
|
||||||
|
|
||||||
// userRepository = cdiUtil.findBean(UserRepository.class);
|
// userRepository = cdiUtil.findBean(UserRepository.class);
|
||||||
|
|
@ -206,7 +206,7 @@ class UserPasswordForm extends Form
|
||||||
final PageState state = event.getPageState();
|
final PageState state = event.getPageState();
|
||||||
final FormData data = event.getFormData();
|
final FormData data = event.getFormData();
|
||||||
|
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||||
// final UserRepository userRepository;
|
// final UserRepository userRepository;
|
||||||
// final UserManager userManager;
|
// final UserManager userManager;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -137,9 +137,8 @@ public class ApplicationInfoPropertySheetModel implements PropertySheetModel {
|
||||||
return applicationType.description();
|
return applicationType.description();
|
||||||
case SINGLETON_PATH:
|
case SINGLETON_PATH:
|
||||||
final String path;
|
final String path;
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final ApplicationRepository appRepo = CdiUtil.createCdiUtil()
|
||||||
final ApplicationRepository appRepo = cdiUtil.findBean(
|
.findBean(ApplicationRepository.class);
|
||||||
ApplicationRepository.class);
|
|
||||||
final List<CcmApplication> instances
|
final List<CcmApplication> instances
|
||||||
= appRepo.findByType(
|
= appRepo.findByType(
|
||||||
applicationType.name());
|
applicationType.name());
|
||||||
|
|
|
||||||
|
|
@ -136,8 +136,8 @@ public class MultiInstanceApplicationPane<T extends CcmApplication>
|
||||||
public ApplicationInstancesTableModel(final Table table,
|
public ApplicationInstancesTableModel(final Table table,
|
||||||
final String appType) {
|
final String appType) {
|
||||||
this.table = table;
|
this.table = table;
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final ApplicationRepository appRepo = CdiUtil.createCdiUtil()
|
||||||
final ApplicationRepository appRepo = cdiUtil.findBean(ApplicationRepository.class);
|
.findBean(ApplicationRepository.class);
|
||||||
final List<CcmApplication> applications = appRepo.
|
final List<CcmApplication> applications = appRepo.
|
||||||
findByType(appType);
|
findByType(appType);
|
||||||
for (CcmApplication application : applications) {
|
for (CcmApplication application : applications) {
|
||||||
|
|
|
||||||
|
|
@ -82,9 +82,8 @@ public class ApplicationTreeModel implements TreeModel {
|
||||||
@Override
|
@Override
|
||||||
public Iterator getChildren(final TreeNode node, final PageState state) {
|
public Iterator getChildren(final TreeNode node, final PageState state) {
|
||||||
if (node instanceof RootTreeNode) {
|
if (node instanceof RootTreeNode) {
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final ApplicationManager appManager = CdiUtil.createCdiUtil()
|
||||||
final ApplicationManager appManager = cdiUtil.findBean(
|
.findBean(ApplicationManager.class);
|
||||||
ApplicationManager.class);
|
|
||||||
|
|
||||||
final Collection<ApplicationType> appTypes = appManager
|
final Collection<ApplicationType> appTypes = appManager
|
||||||
.getApplicationTypes().values();
|
.getApplicationTypes().values();
|
||||||
|
|
@ -94,9 +93,8 @@ public class ApplicationTreeModel implements TreeModel {
|
||||||
final ApplicationTypeTreeNode typeTreeNode
|
final ApplicationTypeTreeNode typeTreeNode
|
||||||
= (ApplicationTypeTreeNode) node;
|
= (ApplicationTypeTreeNode) node;
|
||||||
|
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final ApplicationRepository appRepo = CdiUtil.createCdiUtil()
|
||||||
final ApplicationRepository appRepo = cdiUtil.findBean(
|
.findBean(ApplicationRepository.class);
|
||||||
ApplicationRepository.class);
|
|
||||||
|
|
||||||
final List<CcmApplication> applications = appRepo.findByType(
|
final List<CcmApplication> applications = appRepo.findByType(
|
||||||
typeTreeNode.getObjecType());
|
typeTreeNode.getObjecType());
|
||||||
|
|
@ -113,8 +111,7 @@ public class ApplicationTreeModel implements TreeModel {
|
||||||
|
|
||||||
private List<CcmApplication> retrieveApplicationInstances(
|
private List<CcmApplication> retrieveApplicationInstances(
|
||||||
final ApplicationType applicationType) {
|
final ApplicationType applicationType) {
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final ApplicationRepository appRepo = CdiUtil.createCdiUtil().findBean(
|
||||||
final ApplicationRepository appRepo = cdiUtil.findBean(
|
|
||||||
ApplicationRepository.class);
|
ApplicationRepository.class);
|
||||||
|
|
||||||
return appRepo.findByType(applicationType.name());
|
return appRepo.findByType(applicationType.name());
|
||||||
|
|
@ -122,8 +119,7 @@ public class ApplicationTreeModel implements TreeModel {
|
||||||
|
|
||||||
private List<CcmApplication> retrieveApplicationInstances(
|
private List<CcmApplication> retrieveApplicationInstances(
|
||||||
final String appObjectType) {
|
final String appObjectType) {
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final ApplicationRepository appRepo = CdiUtil.createCdiUtil().findBean(
|
||||||
final ApplicationRepository appRepo = cdiUtil.findBean(
|
|
||||||
ApplicationRepository.class);
|
ApplicationRepository.class);
|
||||||
|
|
||||||
return appRepo.findByType(appObjectType);
|
return appRepo.findByType(appObjectType);
|
||||||
|
|
|
||||||
|
|
@ -202,7 +202,7 @@ public class ChangePasswordForm extends Form
|
||||||
String confirmPassword = (String) m_confirmPassword.getValue(state);
|
String confirmPassword = (String) m_confirmPassword.getValue(state);
|
||||||
|
|
||||||
//check oldPassword
|
//check oldPassword
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||||
final Shiro shiro = cdiUtil.findBean(Shiro.class);
|
final Shiro shiro = cdiUtil.findBean(Shiro.class);
|
||||||
final UserManager userManager = cdiUtil.findBean(UserManager.class);
|
final UserManager userManager = cdiUtil.findBean(UserManager.class);
|
||||||
|
|
||||||
|
|
@ -250,7 +250,7 @@ public class ChangePasswordForm extends Form
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||||
final UserManager userManager = cdiUtil.findBean(UserManager.class);
|
final UserManager userManager = cdiUtil.findBean(UserManager.class);
|
||||||
final Shiro shiro = cdiUtil.findBean(Shiro.class);
|
final Shiro shiro = cdiUtil.findBean(Shiro.class);
|
||||||
final User user = shiro.getUser();
|
final User user = shiro.getUser();
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ public class EmailInitListener implements FormInitListener {
|
||||||
|
|
||||||
s_log.debug("START");
|
s_log.debug("START");
|
||||||
|
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||||
final Subject subject = cdiUtil.findBean(Subject.class);
|
final Subject subject = cdiUtil.findBean(Subject.class);
|
||||||
final Shiro shiro = cdiUtil.findBean(Shiro.class);
|
final Shiro shiro = cdiUtil.findBean(Shiro.class);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ import com.arsdigita.web.URL;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.libreccm.configuration.ConfigurationManager;
|
import org.libreccm.configuration.ConfigurationManager;
|
||||||
|
import org.libreccm.security.UserRepository;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
|
|
@ -130,6 +131,9 @@ public class LoginServlet extends BebopApplicationServlet {
|
||||||
@Inject
|
@Inject
|
||||||
private ConfigurationManager confManager;
|
private ConfigurationManager confManager;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private UserRepository userRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User extension point used to create the pages to server and setup a
|
* User extension point used to create the pages to server and setup a
|
||||||
* URL_MSG - page mapping.
|
* URL_MSG - page mapping.
|
||||||
|
|
@ -141,6 +145,10 @@ public class LoginServlet extends BebopApplicationServlet {
|
||||||
final SecurityConfig securityConfig = confManager.findConfiguration(
|
final SecurityConfig securityConfig = confManager.findConfiguration(
|
||||||
SecurityConfig.class);
|
SecurityConfig.class);
|
||||||
|
|
||||||
|
if (userRepository == null) {
|
||||||
|
throw new IllegalStateException("User repository is not available.");
|
||||||
|
}
|
||||||
|
|
||||||
// Allow world caching for pages without authentication,
|
// Allow world caching for pages without authentication,
|
||||||
// ie, /register, /register/explain-persistent-cookies,
|
// ie, /register, /register/explain-persistent-cookies,
|
||||||
// /register/login-expired, /register/recover-password
|
// /register/login-expired, /register/recover-password
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ public class ScreenNameInitListener implements FormInitListener {
|
||||||
FormData data = event.getFormData();
|
FormData data = event.getFormData();
|
||||||
s_log.debug("START");
|
s_log.debug("START");
|
||||||
|
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||||
final Subject subject = cdiUtil.findBean(Subject.class);
|
final Subject subject = cdiUtil.findBean(Subject.class);
|
||||||
final Shiro shiro = cdiUtil.findBean(Shiro.class);
|
final Shiro shiro = cdiUtil.findBean(Shiro.class);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -67,8 +67,7 @@ public class UserAuthenticationListener implements RequestListener {
|
||||||
throw new IllegalStateException("User is not logged in");
|
throw new IllegalStateException("User is not logged in");
|
||||||
}
|
}
|
||||||
|
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final Subject subject = CdiUtil.createCdiUtil().findBean(Subject.class);
|
||||||
final Subject subject = cdiUtil.findBean(Subject.class);
|
|
||||||
|
|
||||||
return subject;
|
return subject;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -65,8 +65,7 @@ public class UserEditForm extends UserForm
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object initialValue(final PageState ps) {
|
public Object initialValue(final PageState ps) {
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final Shiro shiro = CdiUtil.createCdiUtil().findBean(Shiro.class);
|
||||||
final Shiro shiro = cdiUtil.findBean(Shiro.class);
|
|
||||||
final User result = shiro.getUser();
|
final User result = shiro.getUser();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
@ -103,8 +102,7 @@ public class UserEditForm extends UserForm
|
||||||
FormData data = event.getFormData();
|
FormData data = event.getFormData();
|
||||||
PageState state = event.getPageState();
|
PageState state = event.getPageState();
|
||||||
|
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final UserRepository userRepository = CdiUtil.createCdiUtil().findBean(
|
||||||
final UserRepository userRepository = cdiUtil.findBean(
|
|
||||||
UserRepository.class);
|
UserRepository.class);
|
||||||
|
|
||||||
User user = getUser(state);
|
User user = getUser(state);
|
||||||
|
|
|
||||||
|
|
@ -234,6 +234,7 @@ public abstract class UserForm extends Form
|
||||||
* Gets the current user for initialising the form.
|
* Gets the current user for initialising the form.
|
||||||
*
|
*
|
||||||
* @param state
|
* @param state
|
||||||
|
*
|
||||||
* @return the current user, if the form should not be initialised with user
|
* @return the current user, if the form should not be initialised with user
|
||||||
* data.
|
* data.
|
||||||
*/
|
*/
|
||||||
|
|
@ -246,6 +247,7 @@ public abstract class UserForm extends Form
|
||||||
* users.
|
* users.
|
||||||
*
|
*
|
||||||
* @param event
|
* @param event
|
||||||
|
*
|
||||||
* @throws com.arsdigita.bebop.FormProcessException
|
* @throws com.arsdigita.bebop.FormProcessException
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -255,8 +257,8 @@ public abstract class UserForm extends Form
|
||||||
final PageState state = event.getPageState();
|
final PageState state = event.getPageState();
|
||||||
final FormData data = event.getFormData();
|
final FormData data = event.getFormData();
|
||||||
|
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final UserRepository userRepository = CdiUtil.createCdiUtil().findBean(
|
||||||
final UserRepository userRepository = cdiUtil.findBean(UserRepository.class);
|
UserRepository.class);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (m_newUser) {
|
if (m_newUser) {
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,6 @@ import org.libreccm.security.User;
|
||||||
import org.libreccm.web.ApplicationRepository;
|
import org.libreccm.web.ApplicationRepository;
|
||||||
import org.libreccm.web.CcmApplication;
|
import org.libreccm.web.CcmApplication;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A reusable Bebop component to display the primary attributes of the currently
|
* A reusable Bebop component to display the primary attributes of the currently
|
||||||
* logged in user. Users can extend this class to provide information about
|
* logged in user. Users can extend this class to provide information about
|
||||||
|
|
@ -105,9 +104,8 @@ public class UserInfo extends SimpleContainer {
|
||||||
|
|
||||||
m_contentCenters = new ArrayList<>();
|
m_contentCenters = new ArrayList<>();
|
||||||
|
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final ApplicationRepository appRepo = CdiUtil
|
||||||
final ApplicationRepository appRepo = cdiUtil.findBean(
|
.createCdiUtil().findBean(ApplicationRepository.class);
|
||||||
ApplicationRepository.class);
|
|
||||||
|
|
||||||
m_contentCenters = appRepo.findByType(
|
m_contentCenters = appRepo.findByType(
|
||||||
"com.arsdigita.cms.ContentCenter");
|
"com.arsdigita.cms.ContentCenter");
|
||||||
|
|
@ -185,6 +183,7 @@ public class UserInfo extends SimpleContainer {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param state
|
* @param state
|
||||||
|
*
|
||||||
* @return true if the user is logged in
|
* @return true if the user is logged in
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
@ -194,6 +193,7 @@ public class UserInfo extends SimpleContainer {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param state
|
* @param state
|
||||||
|
*
|
||||||
* @return the User object for which we are generating information
|
* @return the User object for which we are generating information
|
||||||
*
|
*
|
||||||
* @throws IllegalStateException if user is not logged in. Call
|
* @throws IllegalStateException if user is not logged in. Call
|
||||||
|
|
@ -208,8 +208,7 @@ public class UserInfo extends SimpleContainer {
|
||||||
throw new IllegalStateException("user is not logged in");
|
throw new IllegalStateException("user is not logged in");
|
||||||
}
|
}
|
||||||
|
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final Shiro shiro = CdiUtil.createCdiUtil().findBean(Shiro.class);
|
||||||
final Shiro shiro = cdiUtil.findBean(Shiro.class);
|
|
||||||
final User user = shiro.getUser();
|
final User user = shiro.getUser();
|
||||||
|
|
||||||
return user;
|
return user;
|
||||||
|
|
|
||||||
|
|
@ -141,27 +141,6 @@ public class UserLoginForm extends Form implements LoginConstants,
|
||||||
final boolean autoRegistrationOn) {
|
final boolean autoRegistrationOn) {
|
||||||
super(FORM_NAME, panel);
|
super(FORM_NAME, panel);
|
||||||
|
|
||||||
// final ConfigurationManager confManager = CDI.current().select(
|
|
||||||
// ConfigurationManager.class).get();
|
|
||||||
// final BeanManager beanManager = CDI.current().getBeanManager();
|
|
||||||
// final Set<Bean<?>> beans = beanManager.getBeans(
|
|
||||||
// ConfigurationManager.class);
|
|
||||||
// final Iterator<Bean<?>> iterator = beans.iterator();
|
|
||||||
// final ConfigurationManager confManager;
|
|
||||||
// if (iterator.hasNext()) {
|
|
||||||
// @SuppressWarnings("unchecked")
|
|
||||||
// final Bean<ConfigurationManager> bean
|
|
||||||
// = (Bean<ConfigurationManager>) iterator
|
|
||||||
// .next();
|
|
||||||
// final CreationalContext<ConfigurationManager> ctx = beanManager.
|
|
||||||
// createCreationalContext(bean);
|
|
||||||
//
|
|
||||||
// confManager = (ConfigurationManager) beanManager.getReference(
|
|
||||||
// bean, ConfigurationManager.class, ctx);
|
|
||||||
// } else {
|
|
||||||
// throw new UncheckedWrapperException(
|
|
||||||
// "Failed to lookup ConfigurationManager");
|
|
||||||
// }
|
|
||||||
final ConfigurationManager confManager = CdiUtil.createCdiUtil()
|
final ConfigurationManager confManager = CdiUtil.createCdiUtil()
|
||||||
.findBean(ConfigurationManager.class);
|
.findBean(ConfigurationManager.class);
|
||||||
securityConfig = confManager.findConfiguration(SecurityConfig.class);
|
securityConfig = confManager.findConfiguration(SecurityConfig.class);
|
||||||
|
|
@ -378,8 +357,7 @@ public class UserLoginForm extends Form implements LoginConstants,
|
||||||
throws FormProcessException {
|
throws FormProcessException {
|
||||||
PageState state = event.getPageState();
|
PageState state = event.getPageState();
|
||||||
|
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final Subject subject = CdiUtil.createCdiUtil().findBean(Subject.class);
|
||||||
final Subject subject = cdiUtil.findBean(Subject.class);
|
|
||||||
|
|
||||||
final UsernamePasswordToken token = new UsernamePasswordToken(
|
final UsernamePasswordToken token = new UsernamePasswordToken(
|
||||||
m_loginName.getValue(state).toString(),
|
m_loginName.getValue(state).toString(),
|
||||||
|
|
@ -389,11 +367,12 @@ public class UserLoginForm extends Form implements LoginConstants,
|
||||||
try {
|
try {
|
||||||
LOGGER.debug("Trying to login user {}...", subject.toString());
|
LOGGER.debug("Trying to login user {}...", subject.toString());
|
||||||
subject.login(token);
|
subject.login(token);
|
||||||
|
LOGGER.debug("User {} logged in successfully.", token.getUsername());
|
||||||
} catch (AuthenticationException ex) {
|
} catch (AuthenticationException ex) {
|
||||||
onLoginFail(event, ex);
|
onLoginFail(event, ex);
|
||||||
|
LOGGER.debug("Login failed.", ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGGER.debug("User {} logged in successfully.", token.getUsername());
|
|
||||||
LOGGER.debug("subject = {}", subject.toString());
|
LOGGER.debug("subject = {}", subject.toString());
|
||||||
LOGGER.debug("Current session is: {}",
|
LOGGER.debug("Current session is: {}",
|
||||||
state.getRequest().getSession().getId());
|
state.getRequest().getSession().getId());
|
||||||
|
|
|
||||||
|
|
@ -44,9 +44,7 @@ public class UserLogoutListener implements ActionListener {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(final ActionEvent event) {
|
public void actionPerformed(final ActionEvent event) {
|
||||||
|
final Subject subject = CdiUtil.createCdiUtil().findBean(Subject.class);
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
|
||||||
final Subject subject = cdiUtil.findBean(Subject.class);
|
|
||||||
subject.logout();
|
subject.logout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -151,7 +151,7 @@ public class UserNewForm extends UserForm implements FormInitListener,
|
||||||
|
|
||||||
final Exception[] formExceptions = new Exception[]{null};
|
final Exception[] formExceptions = new Exception[]{null};
|
||||||
|
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||||
final Shiro shiro = cdiUtil.findBean(Shiro.class);
|
final Shiro shiro = cdiUtil.findBean(Shiro.class);
|
||||||
|
|
||||||
shiro.getSystemUser().execute(new Callable<Void>() {
|
shiro.getSystemUser().execute(new Callable<Void>() {
|
||||||
|
|
@ -159,9 +159,8 @@ public class UserNewForm extends UserForm implements FormInitListener,
|
||||||
@Override
|
@Override
|
||||||
public Void call() throws Exception {
|
public Void call() throws Exception {
|
||||||
|
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final UserManager userManager = CdiUtil.createCdiUtil()
|
||||||
final UserManager userManager = cdiUtil.findBean(
|
.findBean(UserManager.class);
|
||||||
UserManager.class);
|
|
||||||
userManager.createUser(firstName,
|
userManager.createUser(firstName,
|
||||||
lastName,
|
lastName,
|
||||||
screenName,
|
screenName,
|
||||||
|
|
|
||||||
|
|
@ -22,20 +22,16 @@ import com.arsdigita.util.UncheckedWrapperException;
|
||||||
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.apache.logging.log4j.message.ParameterizedMessage;
|
import org.libreccm.cdi.utils.CdiUtil;
|
||||||
import org.libreccm.configuration.Configuration;
|
import org.libreccm.configuration.Configuration;
|
||||||
import org.libreccm.configuration.ConfigurationManager;
|
import org.libreccm.configuration.ConfigurationManager;
|
||||||
import org.libreccm.configuration.Setting;
|
import org.libreccm.configuration.Setting;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.StringJoiner;
|
import java.util.StringJoiner;
|
||||||
|
|
||||||
import javax.enterprise.context.spi.CreationalContext;
|
|
||||||
import javax.enterprise.inject.spi.Bean;
|
|
||||||
import javax.enterprise.inject.spi.BeanManager;
|
|
||||||
import javax.enterprise.inject.spi.CDI;
|
import javax.enterprise.inject.spi.CDI;
|
||||||
import javax.validation.ConstraintViolation;
|
import javax.validation.ConstraintViolation;
|
||||||
import javax.validation.Validation;
|
import javax.validation.Validation;
|
||||||
|
|
@ -84,36 +80,9 @@ public final class WebConfig {
|
||||||
private String dynamicHostProviderClass;
|
private String dynamicHostProviderClass;
|
||||||
|
|
||||||
public static WebConfig getConfig() {
|
public static WebConfig getConfig() {
|
||||||
final ConfigurationManager confManager = CDI.current().select(
|
|
||||||
ConfigurationManager.class).get();
|
|
||||||
|
|
||||||
// final BeanManager beanManager = CDI.current().getBeanManager();
|
final ConfigurationManager confManager = CdiUtil.createCdiUtil()
|
||||||
// final Set<Bean<?>> beans = beanManager.getBeans(
|
.findBean(ConfigurationManager.class);
|
||||||
// ConfigurationManager.class);
|
|
||||||
// final Iterator<Bean<?>> iterator = beans.iterator();
|
|
||||||
// final ConfigurationManager confManager;
|
|
||||||
// if (iterator.hasNext()) {
|
|
||||||
// @SuppressWarnings("unchecked")
|
|
||||||
// final Bean<ConfigurationManager> bean
|
|
||||||
// = (Bean<ConfigurationManager>) iterator
|
|
||||||
// .next();
|
|
||||||
// final CreationalContext<ConfigurationManager> ctx = beanManager
|
|
||||||
// .createCreationalContext(bean);
|
|
||||||
//
|
|
||||||
// confManager = (ConfigurationManager) beanManager.getReference(
|
|
||||||
// bean, ConfigurationManager.class, ctx);
|
|
||||||
// } else {
|
|
||||||
// LOGGER.error(new ParameterizedMessage(
|
|
||||||
// "No CDI Bean for type {} found.",
|
|
||||||
// ConfigurationManager.class.getName()));
|
|
||||||
// throw new IllegalStateException(String.format(
|
|
||||||
// "No CDI Bean for type \"%s\" found",
|
|
||||||
// ConfigurationManager.class.getName()));
|
|
||||||
// }
|
|
||||||
|
|
||||||
// final CdiUtil cdiUtil = new CdiUtil();
|
|
||||||
// final ConfigurationManager confManager = cdiUtil.findBean(
|
|
||||||
// ConfigurationManager.class);
|
|
||||||
return confManager.findConfiguration(WebConfig.class);
|
return confManager.findConfiguration(WebConfig.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,9 +39,8 @@ public final class WorkflowConfig {
|
||||||
private String alertsSender;
|
private String alertsSender;
|
||||||
|
|
||||||
public static WorkflowConfig getConfig() {
|
public static WorkflowConfig getConfig() {
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final ConfigurationManager confManager = CdiUtil.createCdiUtil()
|
||||||
final ConfigurationManager confManager = cdiUtil.findBean(
|
.findBean(ConfigurationManager.class);
|
||||||
ConfigurationManager.class);
|
|
||||||
return confManager.findConfiguration(WorkflowConfig.class);
|
return confManager.findConfiguration(WorkflowConfig.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -72,9 +72,8 @@ public final class XmlConfig {
|
||||||
private Boolean fullTimeFormatterEnabled = false;
|
private Boolean fullTimeFormatterEnabled = false;
|
||||||
|
|
||||||
public static XmlConfig getConfig() {
|
public static XmlConfig getConfig() {
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final ConfigurationManager confManager = CdiUtil.createCdiUtil()
|
||||||
final ConfigurationManager confManager = cdiUtil.findBean(
|
.findBean(ConfigurationManager.class);
|
||||||
ConfigurationManager.class);
|
|
||||||
return confManager.findConfiguration(XmlConfig.class);
|
return confManager.findConfiguration(XmlConfig.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -137,9 +136,9 @@ public final class XmlConfig {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the class name of the default {@link DocumentBuilderFactory}.
|
* Returns the class name of the default {@link DocumentBuilderFactory}.
|
||||||
* This method encapsulates the default value so that is easy to change. The method is only for
|
* This method encapsulates the default value so that is easy to change. The
|
||||||
* use by the classes in the {@code com.arsdigita.xml} package, therefore the method is
|
* method is only for use by the classes in the {@code com.arsdigita.xml}
|
||||||
* only accessible from the package.
|
* package, therefore the method is only accessible from the package.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -147,7 +146,6 @@ public final class XmlConfig {
|
||||||
return DOM_XERCES;
|
return DOM_XERCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setDomBuilder(final String domBuilder) {
|
public void setDomBuilder(final String domBuilder) {
|
||||||
this.domBuilder = domBuilder;
|
this.domBuilder = domBuilder;
|
||||||
}
|
}
|
||||||
|
|
@ -175,10 +173,10 @@ public final class XmlConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the class name of the default {@link SAXParserFactory}.
|
* Returns the class name of the default {@link SAXParserFactory}. This
|
||||||
* This method encapsulates the default value so that is easy to change. The method is only for
|
* method encapsulates the default value so that is easy to change. The
|
||||||
* use by the classes in the {@code com.arsdigita.xml} package, therefore the method is
|
* method is only for use by the classes in the {@code com.arsdigita.xml}
|
||||||
* only visible in the package.
|
* package, therefore the method is only visible in the package.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -186,7 +184,6 @@ public final class XmlConfig {
|
||||||
return SAX_XERCES;
|
return SAX_XERCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setSaxParser(final String saxParser) {
|
public void setSaxParser(final String saxParser) {
|
||||||
this.saxParser = saxParser;
|
this.saxParser = saxParser;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,9 +36,8 @@ public final class DateFormatterConfig {
|
||||||
private String locale = null;
|
private String locale = null;
|
||||||
|
|
||||||
public static DateFormatterConfig getConfig() {
|
public static DateFormatterConfig getConfig() {
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final ConfigurationManager confManager = CdiUtil.createCdiUtil()
|
||||||
final ConfigurationManager confManager = cdiUtil.findBean(
|
.findBean(ConfigurationManager.class);
|
||||||
ConfigurationManager.class);
|
|
||||||
return confManager.findConfiguration(DateFormatterConfig.class);
|
return confManager.findConfiguration(DateFormatterConfig.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@ import java.util.Set;
|
||||||
import javax.enterprise.context.spi.CreationalContext;
|
import javax.enterprise.context.spi.CreationalContext;
|
||||||
import javax.enterprise.inject.spi.Bean;
|
import javax.enterprise.inject.spi.Bean;
|
||||||
import javax.enterprise.inject.spi.BeanManager;
|
import javax.enterprise.inject.spi.BeanManager;
|
||||||
import javax.enterprise.inject.spi.CDI;
|
|
||||||
import javax.naming.InitialContext;
|
import javax.naming.InitialContext;
|
||||||
import javax.naming.NamingException;
|
import javax.naming.NamingException;
|
||||||
|
|
||||||
|
|
@ -42,10 +41,6 @@ public class CdiUtil {
|
||||||
|
|
||||||
private final BeanManager beanManager;
|
private final BeanManager beanManager;
|
||||||
|
|
||||||
public CdiUtil() {
|
|
||||||
beanManager = CDI.current().getBeanManager();
|
|
||||||
}
|
|
||||||
|
|
||||||
private CdiUtil(final BeanManager beanManager) {
|
private CdiUtil(final BeanManager beanManager) {
|
||||||
this.beanManager = beanManager;
|
this.beanManager = beanManager;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,10 +21,10 @@ package org.libreccm.security;
|
||||||
import static org.libreccm.core.CoreConstants.*;
|
import static org.libreccm.core.CoreConstants.*;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.HashSet;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.NamedQueries;
|
import javax.persistence.NamedQueries;
|
||||||
|
|
@ -65,21 +65,21 @@ public class Group extends Party implements Serializable {
|
||||||
@OneToMany(mappedBy = "group")
|
@OneToMany(mappedBy = "group")
|
||||||
@XmlElementWrapper(name = "group-memberships", namespace = CORE_XML_NS)
|
@XmlElementWrapper(name = "group-memberships", namespace = CORE_XML_NS)
|
||||||
@XmlElement(name = "group-membership", namespace = CORE_XML_NS)
|
@XmlElement(name = "group-membership", namespace = CORE_XML_NS)
|
||||||
private List<GroupMembership> memberships = new ArrayList<>();
|
private Set<GroupMembership> memberships = new HashSet<>();
|
||||||
|
|
||||||
protected Group() {
|
protected Group() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<GroupMembership> getMemberships() {
|
public Set<GroupMembership> getMemberships() {
|
||||||
if (memberships == null) {
|
if (memberships == null) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
return Collections.unmodifiableList(memberships);
|
return Collections.unmodifiableSet(memberships);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setMemberships(final List<GroupMembership> memberships) {
|
protected void setMemberships(final Set<GroupMembership> memberships) {
|
||||||
this.memberships = memberships;
|
this.memberships = memberships;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,10 +23,10 @@ import static org.libreccm.core.CoreConstants.*;
|
||||||
import org.libreccm.core.DefaultEntityGraph;
|
import org.libreccm.core.DefaultEntityGraph;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.HashSet;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
|
|
@ -91,7 +91,7 @@ public class Party implements Serializable {
|
||||||
@OneToMany(mappedBy = "member")
|
@OneToMany(mappedBy = "member")
|
||||||
@XmlElementWrapper(name = "role-memberships", namespace = CORE_XML_NS)
|
@XmlElementWrapper(name = "role-memberships", namespace = CORE_XML_NS)
|
||||||
@XmlElement(name = "role-membership", namespace = CORE_XML_NS)
|
@XmlElement(name = "role-membership", namespace = CORE_XML_NS)
|
||||||
private List<RoleMembership> roleMemberships = new ArrayList<>();
|
private Set<RoleMembership> roleMemberships = new HashSet<>();
|
||||||
|
|
||||||
protected Party() {
|
protected Party() {
|
||||||
super();
|
super();
|
||||||
|
|
@ -113,15 +113,15 @@ public class Party implements Serializable {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<RoleMembership> getRoleMemberships() {
|
public Set<RoleMembership> getRoleMemberships() {
|
||||||
if (roleMemberships == null) {
|
if (roleMemberships == null) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
return Collections.unmodifiableList(roleMemberships);
|
return Collections.unmodifiableSet(roleMemberships);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setRoleMemberships(final List<RoleMembership> roleMemberships) {
|
protected void setRoleMemberships(final Set<RoleMembership> roleMemberships) {
|
||||||
this.roleMemberships = roleMemberships;
|
this.roleMemberships = roleMemberships;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,10 @@ import org.libreccm.workflow.TaskAssignment;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
|
|
@ -83,7 +85,7 @@ public class Role implements Serializable {
|
||||||
@OneToMany(mappedBy = "role")
|
@OneToMany(mappedBy = "role")
|
||||||
@XmlElementWrapper(name = "role-memberships", namespace = CORE_XML_NS)
|
@XmlElementWrapper(name = "role-memberships", namespace = CORE_XML_NS)
|
||||||
@XmlElement(name = "role-membership", namespace = CORE_XML_NS)
|
@XmlElement(name = "role-membership", namespace = CORE_XML_NS)
|
||||||
private List<RoleMembership> memberships = new ArrayList<>();
|
private Set<RoleMembership> memberships = new HashSet<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Permissions granted to the role.
|
* Permissions granted to the role.
|
||||||
|
|
@ -116,15 +118,15 @@ public class Role implements Serializable {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<RoleMembership> getMemberships() {
|
public Set<RoleMembership> getMemberships() {
|
||||||
if (memberships == null) {
|
if (memberships == null) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
return Collections.unmodifiableList(memberships);
|
return Collections.unmodifiableSet(memberships);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setMemberships(final List<RoleMembership> memberships) {
|
protected void setMemberships(final Set<RoleMembership> memberships) {
|
||||||
this.memberships = memberships;
|
this.memberships = memberships;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -111,9 +111,8 @@ public class SecuredCollection<E extends CcmObject> implements Collection<E> {
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public Object[] toArray() {
|
public Object[] toArray() {
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final PermissionChecker permissionChecker = CdiUtil.createCdiUtil()
|
||||||
final PermissionChecker permissionChecker = cdiUtil.findBean(
|
.findBean(PermissionChecker.class);
|
||||||
PermissionChecker.class);
|
|
||||||
|
|
||||||
final Object[] objects = collection.toArray();
|
final Object[] objects = collection.toArray();
|
||||||
for (int i = 0; i < objects.length; i++) {
|
for (int i = 0; i < objects.length; i++) {
|
||||||
|
|
@ -129,9 +128,8 @@ public class SecuredCollection<E extends CcmObject> implements Collection<E> {
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings({"unchecked", "PMD.UseVarargs"})
|
@SuppressWarnings({"unchecked", "PMD.UseVarargs"})
|
||||||
public <T> T[] toArray(final T[] array) {
|
public <T> T[] toArray(final T[] array) {
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final PermissionChecker permissionChecker = CdiUtil.createCdiUtil()
|
||||||
final PermissionChecker permissionChecker = cdiUtil.findBean(
|
.findBean(PermissionChecker.class);
|
||||||
PermissionChecker.class);
|
|
||||||
|
|
||||||
final T[] objects = collection.toArray(array);
|
final T[] objects = collection.toArray(array);
|
||||||
for (int i = 0; i < objects.length; i++) {
|
for (int i = 0; i < objects.length; i++) {
|
||||||
|
|
|
||||||
|
|
@ -90,9 +90,8 @@ class SecuredEntrySet<E extends Map.Entry<K, V>, K, V extends CcmObject>
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public Object[] toArray() {
|
public Object[] toArray() {
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final PermissionChecker permissionChecker = CdiUtil.createCdiUtil()
|
||||||
final PermissionChecker permissionChecker = cdiUtil.findBean(
|
.findBean(PermissionChecker.class);
|
||||||
PermissionChecker.class);
|
|
||||||
|
|
||||||
final Object[] entries = set.toArray();
|
final Object[] entries = set.toArray();
|
||||||
for (int i = 0; i < entries.length; i++) {
|
for (int i = 0; i < entries.length; i++) {
|
||||||
|
|
@ -109,9 +108,8 @@ class SecuredEntrySet<E extends Map.Entry<K, V>, K, V extends CcmObject>
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings({"unchecked", "PMD.UseVarargs"})
|
@SuppressWarnings({"unchecked", "PMD.UseVarargs"})
|
||||||
public <T> T[] toArray(final T[] array) {
|
public <T> T[] toArray(final T[] array) {
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final PermissionChecker permissionChecker = CdiUtil.createCdiUtil()
|
||||||
final PermissionChecker permissionChecker = cdiUtil.findBean(
|
.findBean(PermissionChecker.class);
|
||||||
PermissionChecker.class);
|
|
||||||
|
|
||||||
final E[] entries = (E[]) set.toArray(array);
|
final E[] entries = (E[]) set.toArray(array);
|
||||||
for (int i = 0; i < entries.length; i++) {
|
for (int i = 0; i < entries.length; i++) {
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.security;
|
package org.libreccm.security;
|
||||||
|
|
||||||
|
|
||||||
import static org.libreccm.core.CoreConstants.*;
|
import static org.libreccm.core.CoreConstants.*;
|
||||||
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
|
@ -56,19 +55,20 @@ class SecuredHelper<E extends CcmObject> {
|
||||||
* object with the provided privilege.
|
* object with the provided privilege.
|
||||||
*
|
*
|
||||||
* @param object The object to check.
|
* @param object The object to check.
|
||||||
|
*
|
||||||
* @return The provided {@code object} if the current subject has the
|
* @return The provided {@code object} if the current subject has the
|
||||||
* permission to access it with the provided {@code privilege}. Otherwise a
|
* permission to access it with the provided {@code privilege}.
|
||||||
* placeholder object is returned. The {@link CcmObject#displayName}
|
* Otherwise a placeholder object is returned. The
|
||||||
* property of these object is set to {@code Access denied}.
|
* {@link CcmObject#displayName} property of these object is set to
|
||||||
|
* {@code Access denied}.
|
||||||
*/
|
*/
|
||||||
protected E canAccess(final E object) {
|
protected E canAccess(final E object) {
|
||||||
if (object == null) {
|
if (object == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final PermissionChecker permissionChecker = CdiUtil.createCdiUtil()
|
||||||
final PermissionChecker permissionChecker = cdiUtil.findBean(
|
.findBean(PermissionChecker.class);
|
||||||
PermissionChecker.class);
|
|
||||||
|
|
||||||
if (permissionChecker.isPermitted(requiredPrivilege, object)) {
|
if (permissionChecker.isPermitted(requiredPrivilege, object)) {
|
||||||
return object;
|
return object;
|
||||||
|
|
@ -81,7 +81,8 @@ class SecuredHelper<E extends CcmObject> {
|
||||||
* Helper method for creating an <em>Access denied</em> placeholder object.
|
* Helper method for creating an <em>Access denied</em> placeholder object.
|
||||||
*
|
*
|
||||||
* @return An object of the provided {@link #clazz} with it's
|
* @return An object of the provided {@link #clazz} with it's
|
||||||
* {@link CcmObject#displayName} property set to {@code Access denied}.
|
* {@link CcmObject#displayName} property set to
|
||||||
|
* {@code Access denied}.
|
||||||
*/
|
*/
|
||||||
protected E generateAccessDeniedObject() {
|
protected E generateAccessDeniedObject() {
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,10 @@ import org.libreccm.core.EmailAddress;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.persistence.AssociationOverride;
|
import javax.persistence.AssociationOverride;
|
||||||
import javax.persistence.CollectionTable;
|
import javax.persistence.CollectionTable;
|
||||||
|
|
@ -43,8 +45,8 @@ import javax.persistence.NamedEntityGraph;
|
||||||
import javax.persistence.NamedEntityGraphs;
|
import javax.persistence.NamedEntityGraphs;
|
||||||
import javax.persistence.NamedQueries;
|
import javax.persistence.NamedQueries;
|
||||||
import javax.persistence.NamedQuery;
|
import javax.persistence.NamedQuery;
|
||||||
|
import javax.persistence.NamedSubgraph;
|
||||||
import javax.persistence.OneToMany;
|
import javax.persistence.OneToMany;
|
||||||
import javax.persistence.OrderColumn;
|
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
|
@ -68,12 +70,28 @@ import javax.xml.bind.annotation.XmlTransient;
|
||||||
+ "u.primaryEmailAddress.address = :emailAddress")
|
+ "u.primaryEmailAddress.address = :emailAddress")
|
||||||
})
|
})
|
||||||
@NamedEntityGraphs({
|
@NamedEntityGraphs({
|
||||||
@NamedEntityGraph(name = "User.withGroupAndRoleMemberships",
|
@NamedEntityGraph(
|
||||||
|
name = "User.withGroupAndRoleMemberships",
|
||||||
attributeNodes = {
|
attributeNodes = {
|
||||||
@NamedAttributeNode(
|
@NamedAttributeNode(
|
||||||
value = "groupMemberships"),
|
value = "groupMemberships"),
|
||||||
@NamedAttributeNode(
|
@NamedAttributeNode(
|
||||||
value = "roleMemberships")})
|
value = "roleMemberships",
|
||||||
|
subgraph = "role")},
|
||||||
|
subgraphs = {
|
||||||
|
@NamedSubgraph(
|
||||||
|
name = "role",
|
||||||
|
attributeNodes = {
|
||||||
|
@NamedAttributeNode(value = "role",
|
||||||
|
subgraph = "permissions")
|
||||||
|
}),
|
||||||
|
@NamedSubgraph(
|
||||||
|
name = "permissions",
|
||||||
|
attributeNodes = {
|
||||||
|
@NamedAttributeNode(value = "permissions")}
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
@DefaultEntityGraph("User.withGroupAndRoleMemberships")
|
@DefaultEntityGraph("User.withGroupAndRoleMemberships")
|
||||||
@XmlRootElement(name = "user", namespace = CORE_XML_NS)
|
@XmlRootElement(name = "user", namespace = CORE_XML_NS)
|
||||||
|
|
@ -157,7 +175,7 @@ public class User extends Party implements Serializable {
|
||||||
@OneToMany(mappedBy = "member")
|
@OneToMany(mappedBy = "member")
|
||||||
@XmlElementWrapper(name = "group-memberships", namespace = CORE_XML_NS)
|
@XmlElementWrapper(name = "group-memberships", namespace = CORE_XML_NS)
|
||||||
@XmlElement(name = "group-membership", namespace = CORE_XML_NS)
|
@XmlElement(name = "group-membership", namespace = CORE_XML_NS)
|
||||||
private List<GroupMembership> groupMemberships = new ArrayList<>();
|
private Set<GroupMembership> groupMemberships = new HashSet<>();
|
||||||
|
|
||||||
protected User() {
|
protected User() {
|
||||||
super();
|
super();
|
||||||
|
|
@ -232,12 +250,12 @@ public class User extends Party implements Serializable {
|
||||||
this.passwordResetRequired = passwordResetRequired;
|
this.passwordResetRequired = passwordResetRequired;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<GroupMembership> getGroupMemberships() {
|
public Set<GroupMembership> getGroupMemberships() {
|
||||||
return Collections.unmodifiableList(groupMemberships);
|
return Collections.unmodifiableSet(groupMemberships);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setGroupMemberships(
|
protected void setGroupMemberships(
|
||||||
final List<GroupMembership> groupMemberships) {
|
final Set<GroupMembership> groupMemberships) {
|
||||||
this.groupMemberships = groupMemberships;
|
this.groupMemberships = groupMemberships;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ import org.libreccm.core.AbstractEntityRepository;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import javax.enterprise.context.ApplicationScoped;
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.persistence.EntityGraph;
|
import javax.persistence.EntityGraph;
|
||||||
import javax.persistence.TypedQuery;
|
import javax.persistence.TypedQuery;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue