package com.junabazar.config;

import com.junabazar.inventory.model.db.User;
import com.junabazar.inventory.repository.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.AuditorAware;
import org.springframework.security.core.context.SecurityContextHolder;

/**
 * Created by dharihar on 16/11/2016.
 */
public class AuditorAwareImpl implements AuditorAware<User>{

    @Autowired
    private UserRepository userRepository;

    @Override
    public User getCurrentAuditor() {
        String emailId = SecurityContextHolder.getContext().getAuthentication().getName();
        return userRepository.findByEmail(emailId);
    }
}

@@ -627,16 +627,147 @@
 Name();%0A
+        if(emailId == null %7C%7C %22anonymousUser%22.equalsIgnoreCase(emailId))%7B%0A            return userRepository.findOne(2L);%0A        %7D%0A
         

Add default user