use of com.salesmanager.core.model.common.audit.AuditSection in project shopizer by shopizer-ecommerce.
the class PersistableAuditAspect method afterReturning.
@AfterReturning(value = "execution(* populate(..))", returning = "result")
public void afterReturning(JoinPoint joinPoint, Object result) {
try {
if (result instanceof Auditable) {
Auditable entity = (Auditable) result;
AuditSection audit = entity.getAuditSection();
if (entity.getAuditSection() == null) {
audit = new AuditSection();
}
audit.setDateModified(new Date());
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
if (auth != null) {
if (auth instanceof UsernamePasswordAuthenticationToken) {
// api only is captured
com.salesmanager.shop.store.security.user.JWTUser user = (com.salesmanager.shop.store.security.user.JWTUser) auth.getPrincipal();
audit.setModifiedBy(user.getUsername());
}
}
// TODO put in log audit log trail
entity.setAuditSection(audit);
}
} catch (Throwable e) {
LOGGER.error("Error while setting audit values" + e.getMessage());
}
}
use of com.salesmanager.core.model.common.audit.AuditSection in project shopizer by shopizer-ecommerce.
the class JWTAdminServicesImpl method userDetails.
private UserDetails userDetails(String userName, User user, Collection<GrantedAuthority> authorities) {
AuditSection section = null;
section = user.getAuditSection();
Date lastModified = null;
return new JWTUser(user.getId(), userName, user.getFirstName(), user.getLastName(), user.getAdminEmail(), user.getAdminPassword(), authorities, true, lastModified);
}
use of com.salesmanager.core.model.common.audit.AuditSection in project shopizer by shopizer-ecommerce.
the class JWTCustomerServicesImpl method userDetails.
@Override
protected UserDetails userDetails(String userName, Customer customer, Collection<GrantedAuthority> authorities) {
AuditSection section = null;
section = customer.getAuditSection();
Date lastModified = null;
return new JWTUser(customer.getId(), userName, customer.getBilling().getFirstName(), customer.getBilling().getLastName(), customer.getEmailAddress(), customer.getPassword(), authorities, true, lastModified);
}
Aggregations