Package com.sparc.knappsack.components.entities

Examples of com.sparc.knappsack.components.entities.User


    public
    @ResponseBody
    List<Application> searchApplications(
            @ApiParam(name = "criteria", value = "The search criteria", required = true, internalDescription = "java.lang.String")
            @PathVariable String criteria, UserAgentInfo userAgentInfo) {
        User user = userService.getUserFromSecurityContext();

        List<Application> searchResults = new ArrayList<Application>();
        try {
            searchResults = searchService.searchApplications(URLDecoder.decode(criteria.toLowerCase(), "UTF-8"), user, userAgentInfo.getApplicationType(), Application.class);
        } catch (UnsupportedEncodingException e) {
View Full Code Here


    }

    @PreAuthorize("((#groupId != null ? isUserInDomain(#groupId) : true) and (#categoryId != null ? hasAccessToCategory(#categoryId, #userAgentInfo.applicationType) : true)) or hasRole('ROLE_ADMIN')")
    @RequestMapping(value = "/home", method = RequestMethod.GET)
    public String home(UserAgentInfo userAgentInfo, Model model, @RequestParam(value = "grp", required = false) Long groupId, @RequestParam(value = "ctg", required = false) Long categoryId, @RequestParam(value = "type", required = false) ApplicationType applicationType) {
        User user = userService.getUserFromSecurityContext();

        List<ApplicationModel> applicationModels;
        if ((groupId != null && groupId > 0) || (categoryId != null && categoryId > 0) || applicationType != null) {
            applicationModels = userService.getApplicationsForUserFiltered(user, userAgentInfo.getApplicationType(), groupId, categoryId, applicationType);
        } else {
            applicationModels = userService.getApplicationModelsForUser(user, userAgentInfo.getApplicationType());
        }

        model.addAttribute("applications", applicationModels);

        if (user.getActiveOrganization() == null) {
            model.addAttribute("doesUserRelationshipExist", false);
        } else {
            model.addAttribute("doesUserRelationshipExist", true);
        }
View Full Code Here

    private ModelAndView createModelAndView(HttpServletRequest request, Exception ex, String viewName, String errorId) {
        ModelAndView modelAndView = new ModelAndView(viewName);
        modelAndView.getModel().put("exception", ex);

        User user = userService.getUserFromSecurityContext();
        if (user == null) {
            HttpSession session = request.getSession(false);
            if (session != null) {
                SecurityContext context = (SecurityContext) session.getAttribute("SPRING_SECURITY_CONTEXT");
                if (context != null) {
View Full Code Here

        return modelAndView;
    }

    private String generateLogErrorMessage(String errorId) {
        User user = userService.getUserFromSecurityContext();
        return LoggingUtil.generateLogErrorMessage(user, errorId);
    }
View Full Code Here

    @ApiError(code = 500, reason = "Process error")
    @RequestMapping(method = RequestMethod.GET, produces = contentType)
    public
    @ResponseBody
    Category[] categories(UserAgentInfo userAgentInfo) {
        User user = userService.getUserFromSecurityContext();
        List<Category> categoryModels = userService.getCategoryModelsForUser(user, userAgentInfo.getApplicationType(), Category.class, SortOrder.ASCENDING);
        return categoryModels.toArray(new Category[categoryModels.size()]);
    }
View Full Code Here

    public
    @ResponseBody
    Application[] displayApplicationsForCategory(@ApiParam(name = "categoryId", value = "The category ID", required = true, internalDescription = "java.lang.Long") @PathVariable Long categoryId, UserAgentInfo userAgentInfo) {
        checkRequiredEntity(categoryService, categoryId);

        User user = userService.getUserFromSecurityContext();
        List<Application> applicationModels = userService.getApplicationModelsForUser(user, userAgentInfo.getApplicationType(), categoryId, Application.class);
        return applicationModels.toArray(new Application[applicationModels.size()]);
    }
View Full Code Here

    @ApiError(code = 500, reason = "Process error")
    @RequestMapping(method = RequestMethod.GET, produces = contentType)
    public
    @ResponseBody
    Group[] getGroups() {
        User user = userService.getUserFromSecurityContext();
        List<Group> groupModels = userService.getGroupModelsForActiveOrganization(user, Group.class, SortOrder.ASCENDING);

        return groupModels.toArray(new Group[groupModels.size()]);
    }
View Full Code Here

    @PreAuthorize("hasAccessToApplication(#id) or hasRole('ROLE_ADMIN')")
    @RequestMapping(value = "/detail/{id}", method = RequestMethod.GET)
    public String loadDetailPage(HttpServletRequest request, Model model,  @PathVariable Long id, UserAgentInfo userAgentInfo) {
        checkRequiredEntity(applicationService, id);
        User user = userService.getUserFromSecurityContext();
        Application application = applicationService.get(id);

        ApplicationModel applicationModel = applicationService.createApplicationModel(application, true);
        if (applicationModel != null) {
            applicationModel.setCanUserEdit(userService.canUserEditApplication(user, application));
View Full Code Here

//        invalidateSession(request, response);

        Result result = new Result();
        result.setResult(false);

        User user = userService.getByEmail(email);

        boolean success = userControllerService.resetPassword(user);

        result.setResult(success);
View Full Code Here

        if (groupForm.getName() == null || "".equals(groupForm.getName())) {
            errors.rejectValue(NAME_FIELD, "groupValidator.emptyName");
        }

        if (!errors.hasFieldErrors(NAME_FIELD)) {
            User user = userService.getUserFromSecurityContext();
            if (user == null) {
                errors.reject("groupValidator.generic");
                return;
            }

            Organization organization = user.getActiveOrganization();
            if (organization == null) {
                errors.reject("groupValidator.generic");
            }

            Group group = groupService.get(groupForm.getName(), organization.getId());
View Full Code Here

TOP

Related Classes of com.sparc.knappsack.components.entities.User

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.