Search in sources :

Example 1 with AdminMenu

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

the class AdminNavigationServiceImpl method buildMenu.

@Override
public AdminMenu buildMenu(AdminUser adminUser) {
    AdminMenu adminMenu = new AdminMenu();
    List<AdminModule> modules = adminNavigationDao.readAllAdminModules();
    populateAdminMenu(adminUser, adminMenu, modules);
    return adminMenu;
}
Also used : AdminMenu(org.broadleafcommerce.openadmin.server.security.domain.AdminMenu) AdminModule(org.broadleafcommerce.openadmin.server.security.domain.AdminModule)

Example 2 with AdminMenu

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

the class AdminModuleProcessor method populateModelVariables.

@Override
public Map<String, Object> populateModelVariables(String tagName, Map<String, String> tagAttributes, BroadleafTemplateContext context) {
    String resultVar = tagAttributes.get("resultVar");
    Map<String, Object> newModelVars = new HashMap<>();
    AdminUser user = getPersistentAdminUser();
    if (user != null) {
        AdminMenu menu = adminNavigationService.buildMenu(user);
        newModelVars.put(resultVar, menu);
    }
    return newModelVars;
}
Also used : AdminMenu(org.broadleafcommerce.openadmin.server.security.domain.AdminMenu) HashMap(java.util.HashMap) AdminUser(org.broadleafcommerce.openadmin.server.security.domain.AdminUser)

Example 3 with AdminMenu

use of org.broadleafcommerce.openadmin.server.security.domain.AdminMenu 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

AdminMenu (org.broadleafcommerce.openadmin.server.security.domain.AdminMenu)3 AdminModule (org.broadleafcommerce.openadmin.server.security.domain.AdminModule)2 HashMap (java.util.HashMap)1 AdminSection (org.broadleafcommerce.openadmin.server.security.domain.AdminSection)1 AdminUser (org.broadleafcommerce.openadmin.server.security.domain.AdminUser)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1