Package com.sparc.knappsack.components.entities

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


    @Autowired(required = true)
    private EventDeliveryFactory eventDeliveryFactory;

    @RequestMapping(method = RequestMethod.GET)
    public String showActivatePage(Model model, @RequestParam(required = false) Boolean error) {
        User user = userService.getUserFromSecurityContext();

        if (user.isActivated()) {
            return "redirect:/home";
        }

        if (user.isActivated()) {
            model.addAttribute("activated", true);
        } else {
            model.addAttribute("activated", false);
        }
View Full Code Here


        return "activateTH";
    }

    @RequestMapping(value = "/{code}", method = RequestMethod.GET)
    public String activate(@PathVariable String code, final RedirectAttributes redirectAttributes) {
        User user = userService.getUserFromSecurityContext();

        if (user.isActivated()) {
            return "redirect:/home";
        }

        if (userService.activate(user.getId(), code)) {
            userService.updateSecurityContext(userService.get(user.getId()));
            EventDelivery deliveryMechanism = eventDeliveryFactory.getEventDelivery(EventType.USER_ACCOUNT_ACTIVATION_SUCCESS);
            if (deliveryMechanism != null) {
                deliveryMechanism.sendNotifications(user);
            }
            redirectAttributes.addFlashAttribute("activationSuccess", true);
View Full Code Here

    @RequestMapping(value = "/sendCode", method = RequestMethod.GET)
    public @ResponseBody Result sendCode() {
        Result result = new Result();
        result.setResult(false);

        User user = userService.getUserFromSecurityContext();

        boolean success = false;

        EventDelivery deliveryMechanism = eventDeliveryFactory.getEventDelivery(EventType.USER_ACCOUNT_ACTIVATION);
        if (deliveryMechanism != null) {
View Full Code Here

    @Override
    public void validate(Object target, Errors errors) {
        BatchInvitationForm form = (BatchInvitationForm) target;

        User user = userService.getUserFromSecurityContext();
        if (user == null || user.getActiveOrganization() == null) {
            errors.reject("batchInvitationValidator.error.generic");
            return;
        }

        // Check if User Roles are valid
View Full Code Here

    @Override
    public void validate(Object o, Errors errors) {
        PasswordForm passwordForm = (PasswordForm) o;

        User user = userService.getUserFromSecurityContext();

        if (isPasswordEmpty(passwordForm.getOriginalPassword())) {
            errors.rejectValue(ORIGINAL_PASSWORD_FIELD, "passwordValidator.emptyOriginalPassword");
        } else if (!passwordEncoder.isPasswordValid(user.getPassword(), passwordForm.getOriginalPassword(), user.getUsername())) {
            errors.rejectValue(ORIGINAL_PASSWORD_FIELD, "passwordValidator.originalPasswordMismatch");
        }

        if (!isPasswordValid(passwordForm.getFirstNewPassword())) {
            errors.rejectValue(FIRST_NEW_PASSWORD_FIELD, "passwordValidator.password.invalid");
View Full Code Here

    @Autowired(required = true)
    private ApplicationService applicationService;

    @RequestMapping(value = "/search", method = RequestMethod.GET)
    public String displayPage(Model model, UserAgentInfo userAgentInfo) {
        User user = userService.getUserFromSecurityContext();
        List<Application> applications = userService.getApplicationsForUser(user, userAgentInfo.getApplicationType());

        ComparatorChain chain = new ComparatorChain();
        chain.addComparator(new ApplicationNameComparator());
        chain.addComparator(new ApplicationDescriptionComparator());
View Full Code Here

        return "searchTH";
    }

    @RequestMapping(value = "/search", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody List<ApplicationModel> search(@RequestParam(value = "searchCriteria", required = true) String searchCriteria, UserAgentInfo userAgentInfo) {
        User user = userService.getUserFromSecurityContext();

        List<ApplicationModel> searchResults = new ArrayList<ApplicationModel>();
        try {
            searchResults = searchService.searchApplications(URLDecoder.decode(searchCriteria.toLowerCase(), "UTF-8"), user, userAgentInfo.getApplicationType());
            for (ApplicationModel applicationModel : searchResults) {
View Full Code Here

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

    public
    @ResponseBody
    Result setActiveOrganization( @ApiParam(name = "organizationId", value = "The organization ID", required = true, internalDescription = "java.lang.Long") @PathVariable Long organizationId) {
        checkRequiredEntity(organizationService, organizationId);

        User user = userService.getUserFromSecurityContext();
        userService.setActiveOrganization(user, organizationId);
        Result result = new Result();
        result.setResult(true);
        result.setValue(organizationId);
View Full Code Here

    @ApiError(code = 500, reason = "Process error")
    @RequestMapping(value = "/branding", method = RequestMethod.GET, produces = contentType)
    public
    @ResponseBody
    Branding getBranding() {
        User user = userService.getUserFromSecurityContext();

        return customBrandingService.getCustomBrandingModel(user.getActiveOrganization().getCustomBranding(), Branding.class);
    }
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.