Search in sources :

Example 16 with AdminSection

use of org.broadleafcommerce.openadmin.server.security.domain.AdminSection in project BroadleafCommerce by BroadleafCommerce.

the class AdminAbstractController method setModelAttributes.

// ************************
// GENERIC HELPER METHODS *
// ************************
/**
 * Attributes to add to the model on every request
 *
 * @param model
 * @param sectionKey
 */
protected void setModelAttributes(Model model, String sectionKey) {
    AdminSection section = adminNavigationService.findAdminSectionByURI("/" + sectionKey);
    if (section != null) {
        model.addAttribute("sectionKey", sectionKey);
        model.addAttribute(CURRENT_ADMIN_MODULE_ATTRIBUTE_NAME, section.getModule());
        model.addAttribute(CURRENT_ADMIN_SECTION_ATTRIBUTE_NAME, section);
    }
    extensionManager.getProxy().setAdditionalModelAttributes(model, sectionKey);
}
Also used : AdminSection(org.broadleafcommerce.openadmin.server.security.domain.AdminSection)

Example 17 with AdminSection

use of org.broadleafcommerce.openadmin.server.security.domain.AdminSection in project BroadleafCommerce by BroadleafCommerce.

the class AdminLoginController method loginSuccess.

@RequestMapping(value = { "/", "/loginSuccess" }, method = RequestMethod.GET)
public String loginSuccess(HttpServletRequest request, HttpServletResponse response, Model model) {
    AdminMenu adminMenu = adminNavigationService.buildMenu(getPersistentAdminUser());
    if (!adminMenu.getAdminModules().isEmpty()) {
        AdminModule first = adminMenu.getAdminModules().get(0);
        List<AdminSection> sections = first.getSections();
        if (!sections.isEmpty()) {
            AdminSection adminSection = sections.get(0);
            return "redirect:" + adminSection.getUrl();
        }
    }
    return "noAccess";
}
Also used : AdminMenu(org.broadleafcommerce.openadmin.server.security.domain.AdminMenu) AdminModule(org.broadleafcommerce.openadmin.server.security.domain.AdminModule) AdminSection(org.broadleafcommerce.openadmin.server.security.domain.AdminSection) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

AdminSection (org.broadleafcommerce.openadmin.server.security.domain.AdminSection)17 HashMap (java.util.HashMap)3 Query (javax.persistence.Query)3 TypedQuery (javax.persistence.TypedQuery)3 NoResultException (javax.persistence.NoResultException)2 HttpServletRequest (javax.servlet.http.HttpServletRequest)2 BroadleafRequestContext (org.broadleafcommerce.common.web.BroadleafRequestContext)2 Property (org.broadleafcommerce.openadmin.dto.Property)2 AdminModule (org.broadleafcommerce.openadmin.server.security.domain.AdminModule)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 IOException (java.io.IOException)1 DateFormatSymbols (java.text.DateFormatSymbols)1 ParseException (java.text.ParseException)1 SimpleDateFormat (java.text.SimpleDateFormat)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 HttpServletRequestWrapper (javax.servlet.http.HttpServletRequestWrapper)1 BeanComparator (org.apache.commons.beanutils.BeanComparator)1