added userdata, email to lowercase

This commit is contained in:
_Bastler 2021-10-28 11:51:22 +02:00
parent 2af3b8cd63
commit 67a66e3cb9
17 changed files with 366 additions and 104 deletions

View File

@ -3,6 +3,7 @@
*/
package de.bstly.we.borrow.businesslogic;
import java.util.Iterator;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
@ -28,15 +29,17 @@ import de.bstly.we.borrow.repository.BorrowItemManualSlotRepository;
import de.bstly.we.borrow.repository.BorrowItemPeriodSlotRepository;
import de.bstly.we.borrow.repository.BorrowItemRepository;
import de.bstly.we.borrow.repository.BorrowRequestRepository;
import de.bstly.we.businesslogic.UserDataProvider;
import de.bstly.we.businesslogic.UserManager;
import de.bstly.we.email.businesslogic.EmailManager;
import de.bstly.we.model.User;
import de.bstly.we.model.UserData;
/**
* The Class BorrowItemManager.
*/
@Component
public class BorrowItemManager {
public class BorrowItemManager implements UserDataProvider {
@Autowired
private BorrowItemRepository borrowItemRepository;
@ -252,4 +255,40 @@ public class BorrowItemManager {
// TODO: send email
}
/*
* @see de.bstly.we.businesslogic.UserDataProvider#getId()
*/
@Override
public String getId() {
return "borrow-items";
}
/*
* @see de.bstly.we.businesslogic.UserDataProvider#getUserData(java.lang.Long)
*/
@Override
public List<UserData> getUserData(Long userId) {
List<UserData> result = Lists.newArrayList();
Iterator<BorrowItem> items = borrowItemRepository.findAll(qBorrowItem.owner.eq(userId))
.iterator();
while (items.hasNext()) {
result.add(items.next());
}
return result;
}
/*
* @see de.bstly.we.businesslogic.UserDataProvider#purgeUserData(java.lang.Long)
*/
@Override
public void purgeUserData(Long userId) {
Iterator<BorrowItem> items = borrowItemRepository.findAll(qBorrowItem.owner.eq(userId))
.iterator();
while (items.hasNext()) {
delete(items.next());
}
}
}

View File

@ -6,6 +6,8 @@ package de.bstly.we.borrow.businesslogic;
import java.text.ParseException;
import java.time.Instant;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
@ -14,6 +16,7 @@ import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import com.beust.jcommander.internal.Lists;
import com.nimbusds.jose.JOSEException;
import com.nimbusds.jose.JOSEObjectType;
import com.nimbusds.jose.JWSHeader;
@ -26,16 +29,18 @@ import de.bstly.we.borrow.model.BorrowRequest;
import de.bstly.we.borrow.model.BorrowRequestStatus;
import de.bstly.we.borrow.model.QBorrowRequest;
import de.bstly.we.borrow.repository.BorrowRequestRepository;
import de.bstly.we.businesslogic.UserDataProvider;
import de.bstly.we.businesslogic.UserManager;
import de.bstly.we.jwt.businesslogic.JwtKeyManager;
import de.bstly.we.jwt.model.JwtKey;
import de.bstly.we.model.User;
import de.bstly.we.model.UserData;
/**
* The Class BorrowRequestManager.
*/
@Component
public class BorrowRequestManager {
public class BorrowRequestManager implements UserDataProvider {
@Autowired
private BorrowRequestRepository borrowRequestRepository;
@ -63,10 +68,10 @@ public class BorrowRequestManager {
/**
* Gets the for user.
*
* @param userId the user id
* @param page the page
* @param size the size
* @param sortBy the sort by
* @param userId the user id
* @param page the page
* @param size the size
* @param sortBy the sort by
* @param descending the descending
* @return the for user
*/
@ -79,11 +84,11 @@ public class BorrowRequestManager {
/**
* Gets the for user and stauts.
*
* @param userId the user id
* @param status the status
* @param page the page
* @param size the size
* @param sortBy the sort by
* @param userId the user id
* @param status the status
* @param page the page
* @param size the size
* @param sortBy the sort by
* @param descending the descending
* @return the for user and stauts
*/
@ -98,10 +103,10 @@ public class BorrowRequestManager {
/**
* Gets the for owner.
*
* @param userId the user id
* @param page the page
* @param size the size
* @param sortBy the sort by
* @param userId the user id
* @param page the page
* @param size the size
* @param sortBy the sort by
* @param descending the descending
* @return the for owner
*/
@ -114,11 +119,11 @@ public class BorrowRequestManager {
/**
* Gets the for owner and status.
*
* @param userId the user id
* @param status the status
* @param page the page
* @param size the size
* @param sortBy the sort by
* @param userId the user id
* @param status the status
* @param page the page
* @param size the size
* @param sortBy the sort by
* @param descending the descending
* @return the for owner and status
*/
@ -160,7 +165,7 @@ public class BorrowRequestManager {
* Creates the code.
*
* @param borrowRequest the borrow request
* @param issuer the issuer
* @param issuer the issuer
* @return the signed JWT
* @throws JOSEException the JOSE exception
*/
@ -217,7 +222,7 @@ public class BorrowRequestManager {
*
* @param jwt the jwt
* @return true, if successful
* @throws JOSEException the JOSE exception
* @throws JOSEException the JOSE exception
* @throws ParseException the parse exception
*/
public boolean verify(SignedJWT jwt) throws JOSEException, ParseException {
@ -239,4 +244,51 @@ public class BorrowRequestManager {
return jwt.verify(jwtKeyManager.createVerfifier(jwtKey));
}
/*
* @see de.bstly.we.businesslogic.UserDataProvider#getId()
*/
@Override
public String getId() {
return "borrow-requests";
}
/*
* @see de.bstly.we.businesslogic.UserDataProvider#getUserData(java.lang.Long)
*/
@Override
public List<UserData> getUserData(Long userId) {
List<UserData> result = Lists.newArrayList();
Iterator<BorrowRequest> userRequests = borrowRequestRepository
.findAll(qBorrowRequest.user.eq(userId)).iterator();
while (userRequests.hasNext()) {
result.add(userRequests.next());
}
Iterator<BorrowRequest> ownerRequests = borrowRequestRepository.findAllByOwner(userId)
.iterator();
while (ownerRequests.hasNext()) {
result.add(ownerRequests.next());
}
return result;
}
/*
* @see de.bstly.we.businesslogic.UserDataProvider#purgeUserData(java.lang.Long)
*/
@Override
public void purgeUserData(Long userId) {
Iterator<BorrowRequest> userRequests = borrowRequestRepository
.findAll(qBorrowRequest.user.eq(userId)).iterator();
while (userRequests.hasNext()) {
delete(userRequests.next());
}
Iterator<BorrowRequest> ownerRequests = borrowRequestRepository.findAllByOwner(userId)
.iterator();
while (ownerRequests.hasNext()) {
delete(ownerRequests.next());
}
}
}

View File

@ -19,13 +19,15 @@ import javax.persistence.Transient;
import com.fasterxml.jackson.annotation.JsonInclude;
import de.bstly.we.model.UserData;
/**
* The Class BorrowItem.
*/
@Entity
@Table(name = "borrow_items")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class BorrowItem {
public class BorrowItem implements UserData {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)

View File

@ -16,12 +16,14 @@ import javax.persistence.Lob;
import javax.persistence.Table;
import javax.persistence.Transient;
import de.bstly.we.model.UserData;
/**
* The Class BorrowRequest.
*/
@Entity
@Table(name = "borrow_requests")
public class BorrowRequest {
public class BorrowRequest implements UserData {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)

View File

@ -24,7 +24,17 @@ public interface BorrowRequestRepository
/**
* Find all by owner.
*
* @param owner the owner
* @param owner the owner
* @param pageable the pageable
* @return the page
*/
@Query("SELECT request FROM BorrowRequest request INNER JOIN BorrowItem item ON request.item = item.id WHERE item.owner = :owner")
Iterable<BorrowRequest> findAllByOwner(@Param("owner") Long owner);
/**
* Find all by owner.
*
* @param owner the owner
* @param pageable the pageable
* @return the page
*/
@ -34,8 +44,8 @@ public interface BorrowRequestRepository
/**
* Find all by owner and status.
*
* @param owner the owner
* @param status the status
* @param owner the owner
* @param status the status
* @param pageable the pageable
* @return the page
*/

View File

@ -42,7 +42,7 @@ public class PermissionManager implements UserDataProvider {
* Gets the.
*
* @param target the target
* @param name the name
* @param name the name
* @return the list
*/
public List<Permission> get(Long target, String name) {
@ -126,7 +126,7 @@ public class PermissionManager implements UserDataProvider {
* Checks for permission.
*
* @param target the target
* @param name the name
* @param name the name
* @return true, if successful
*/
public boolean hasPermission(Long target, String name) {
@ -143,10 +143,10 @@ public class PermissionManager implements UserDataProvider {
/**
* Creates the.
*
* @param target the target
* @param name the name
* @param addon the addon
* @param starts the starts
* @param target the target
* @param name the name
* @param addon the addon
* @param starts the starts
* @param expires the expires
* @return the permission
*/
@ -188,7 +188,7 @@ public class PermissionManager implements UserDataProvider {
/**
* Clone.
*
* @param name the name
* @param name the name
* @param clone the clone
* @return the list
*/
@ -212,7 +212,7 @@ public class PermissionManager implements UserDataProvider {
* Delete.
*
* @param target the target
* @param name the name
* @param name the name
*/
public void delete(Long target, String name) {
Assert.isTrue(
@ -249,10 +249,11 @@ public class PermissionManager implements UserDataProvider {
/**
* Apply item.
*
* @param target the target
* @param item the item
* @param target the target
* @param item the item
* @param answers the answers
* @param start the start
* @param starts the starts
* @param expires the expires
*/
public void applyItem(Long target, Integer item, JsonArray answers, Instant starts,
Instant expires) {
@ -264,10 +265,11 @@ public class PermissionManager implements UserDataProvider {
/**
* Gets the for item.
*
* @param target the target
* @param item the item
* @param target the target
* @param item the item
* @param answers the answers
* @param starts the start
* @param starts the starts
* @param expires the expires
* @return the for item
*/
public List<Permission> getForItem(Long target, Integer item, JsonArray answers, Instant starts,

View File

@ -33,7 +33,7 @@ public class QuotaManager implements UserDataProvider {
* Gets the.
*
* @param target the target
* @param name the name
* @param name the name
* @return the quota
*/
public Quota get(Long target, String name) {
@ -85,7 +85,7 @@ public class QuotaManager implements UserDataProvider {
* Checks for quota.
*
* @param target the target
* @param name the name
* @param name the name
* @return true, if successful
*/
public boolean hasQuota(Long target, String name) {
@ -96,10 +96,10 @@ public class QuotaManager implements UserDataProvider {
/**
* Creates the.
*
* @param target the target
* @param name the name
* @param value the value
* @param unit the unit
* @param target the target
* @param name the name
* @param value the value
* @param unit the unit
* @param disposable the disposable
* @return the quota
*/
@ -141,7 +141,7 @@ public class QuotaManager implements UserDataProvider {
/**
* Clone.
*
* @param name the name
* @param name the name
* @param clone the clone
* @param value the value
* @return the list
@ -164,7 +164,7 @@ public class QuotaManager implements UserDataProvider {
* Delete.
*
* @param target the target
* @param name the name
* @param name the name
*/
public void delete(Long target, String name) {
Assert.isTrue(quotaRepository.exists(qQuota.target.eq(target).and(qQuota.name.eq(name))),
@ -197,10 +197,11 @@ public class QuotaManager implements UserDataProvider {
}
/**
*
* @param target
* @param item
* @return
* Adds the for item.
*
* @param target the target
* @param item the item
* @param quotas the quotas
*/
public void addForItem(Long target, Integer item, List<Quota> quotas) {
for (QuotaMapping quotaMapping : quotaMappingManager.getAllByItem(item)) {
@ -241,7 +242,7 @@ public class QuotaManager implements UserDataProvider {
* Apply item.
*
* @param target the target
* @param item the item
* @param item the item
*/
public void applyItem(Long target, Integer item) {
for (QuotaMapping quotaMapping : quotaMappingManager.getAllByItem(item)) {

View File

@ -60,10 +60,13 @@ public class UserDataManager implements SmartInitializingSingleton {
private List<UserDataProvider> providers;
private Gson gson = new Gson();
/*
* @see org.springframework.beans.factory.SmartInitializingSingleton#afterSingletonsInstantiated()
*/
/*
* @see org.springframework.beans.factory.SmartInitializingSingleton#
* afterSingletonsInstantiated()
*/
@Override
public void afterSingletonsInstantiated() {
providers = Lists.newArrayList();
@ -78,6 +81,15 @@ public class UserDataManager implements SmartInitializingSingleton {
*/
@Scheduled(cron = "${we.bstly.userdata.cron:0 0 0 * * * }")
public void purge() {
purge(!purge);
}
/**
* Purge.
*
* @param dry the dry
*/
public void purge(boolean dry) {
long days = systemPropertyManager.getLong(SYSTEM_PROPERTY_USERDATA_DAYS,
SYSTEM_PROPERTY_USERDATA_DAYS_DEFAULT);
@ -90,7 +102,7 @@ public class UserDataManager implements SmartInitializingSingleton {
if (permissionManager.getNotExpiresByTargetIgnoreStart(user.getId())
.isEmpty()) {
if (UserStatus.PURGE.equals(user.getStatus())) {
purge(user, !purge);
purge(user, dry);
} else if (UserStatus.NORMAL.equals(user.getStatus())) {
Instant last = Instant.MIN;
for (Permission permission : permissionManager
@ -101,7 +113,7 @@ public class UserDataManager implements SmartInitializingSingleton {
}
if (Instant.now().minus(days, ChronoUnit.DAYS).isAfter(last)) {
purge(user, !purge);
purge(user, dry);
}
}
}
@ -109,7 +121,6 @@ public class UserDataManager implements SmartInitializingSingleton {
}
pageable = page.nextPageable();
} while (page.hasNext());
}
/**
@ -121,10 +132,16 @@ public class UserDataManager implements SmartInitializingSingleton {
public void purge(User user, boolean dry) {
Long userId = user.getId();
if (dry) {
logger.debug("Would purge all data of user '" + user.getUsername() + "' [id="
+ user.getId() + "]!");
logger.debug("Would purge all data of user '"
+ user.getUsername()
+ "' [id="
+ user.getId()
+ "]!");
} else {
logger.warn("Purge all data of user '" + user.getUsername() + "' [id=" + user.getId()
logger.warn("Purge all data of user '"
+ user.getUsername()
+ "' [id="
+ user.getId()
+ "]!");
}
@ -132,22 +149,34 @@ public class UserDataManager implements SmartInitializingSingleton {
if (dry) {
List<UserData> result = provider.getUserData(userId);
if (!result.isEmpty()) {
logger.debug("\tWould have purged '" + provider.getId() + "' data of user '"
+ user.getUsername() + "' [id=" + user.getId() + "]!");
logger.debug("\tWould have purged '"
+ provider.getId()
+ "' data of user '"
+ user.getUsername()
+ "' [id="
+ user.getId()
+ "]!");
if (logger.isTraceEnabled()) {
for (UserData userData : result) {
logger.trace("\t\t" + gson.toJson(userData));
logger.trace("\t\t"
+ gson.toJson(userData));
}
}
}
} else {
List<UserData> result = provider.getUserData(userId);
if (!result.isEmpty()) {
logger.warn("\tPurge '" + provider.getId() + "' data of user '"
+ user.getUsername() + "' [id=" + user.getId() + "]!");
logger.warn("\tPurge '"
+ provider.getId()
+ "' data of user '"
+ user.getUsername()
+ "' [id="
+ user.getId()
+ "]!");
if (logger.isTraceEnabled()) {
for (UserData userData : result) {
logger.trace("\t\t" + gson.toJson(userData));
logger.trace("\t\t"
+ gson.toJson(userData));
}
}
provider.purgeUserData(userId);
@ -156,7 +185,10 @@ public class UserDataManager implements SmartInitializingSingleton {
}
if (!dry) {
logger.warn("Purged all data of user '" + user.getUsername() + "' [id=" + user.getId()
logger.warn("Purged all data of user '"
+ user.getUsername()
+ "' [id="
+ user.getId()
+ "]!");
}
}

View File

@ -0,0 +1,86 @@
/**
*
*/
package de.bstly.we.controller;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import de.bstly.we.businesslogic.UserDataManager;
import de.bstly.we.businesslogic.UserManager;
import de.bstly.we.controller.support.EntityResponseStatusException;
import de.bstly.we.model.User;
import de.bstly.we.model.UserData;
/**
* The Class UserDataManagementController.
*/
@RestController
@RequestMapping("/users/manage/data")
public class UserDataManagementController extends BaseController {
@Autowired
private UserManager userManager;
@Autowired
private UserDataManager userDataManager;
/**
* Gets the for user.
*
* @param username the username
* @return
* @return the for user
*/
@PreAuthorize("hasRole('ROLE_ADMIN')")
@GetMapping("/{username}")
public Map<String, List<UserData>> getForUser(@PathVariable("username") String username) {
User user = userManager.getByUsername(username);
if (user == null) {
throw new EntityResponseStatusException(HttpStatus.NO_CONTENT);
}
return userDataManager.get(user.getId());
}
/**
* Purge.
*
* @param dry the dry
*/
@PreAuthorize("hasRole('ROLE_ADMIN')")
@PostMapping("/purge")
public void purge(@RequestParam("dry") boolean dry) {
userDataManager.purge(dry);
}
/**
* Purge by username.
*
* @param username the username
* @param dry the dry
*/
@PreAuthorize("hasRole('ROLE_ADMIN')")
@PostMapping("/purge/{username}")
public void purgeByUsername(@PathVariable("username") String username,
@RequestParam("dry") boolean dry) {
User user = userManager.getByUsername(username);
if (user == null) {
throw new EntityResponseStatusException(HttpStatus.NO_CONTENT);
}
userDataManager.purge(user, dry);
}
}

View File

@ -55,7 +55,7 @@ public class TokenSessionManager {
* Gets the permission mappings for token.
*
* @param userId the user id
* @param token the token
* @param token the token
* @return the permission mappings for token
*/
public List<PermissionMapping> getPermissionMappingsForToken(Long userId, String token) {
@ -79,7 +79,7 @@ public class TokenSessionManager {
* Gets the permissions for token.
*
* @param userId the user id
* @param token the token
* @param token the token
* @return the permissions for token
*/
public List<Permission> getPermissionsForToken(Long userId, String token) {
@ -113,7 +113,7 @@ public class TokenSessionManager {
* Gets the quota mappings for token.
*
* @param userId the user id
* @param token the token
* @param token the token
* @return the quota mappings for token
*/
public List<QuotaMapping> getQuotaMappingsForToken(Long userId, String token) {
@ -133,6 +133,13 @@ public class TokenSessionManager {
return quotaMappings;
}
/**
* Adds the quotas for token.
*
* @param userId the user id
* @param token the token
* @param quotas the quotas
*/
public void addQuotasForToken(Long userId, String token, List<Quota> quotas) {
try {
JsonObject result = pretixManager.getCheckInItemBySecret(token);
@ -215,7 +222,7 @@ public class TokenSessionManager {
/**
* Adds the token to session.
*
* @param secret the secret
* @param secret the secret
* @param session the session
*/
public void addTokenToSession(String secret, HttpSession session) {
@ -242,7 +249,7 @@ public class TokenSessionManager {
/**
* Removes the token from session.
*
* @param secret the secret
* @param secret the secret
* @param session the session
*/
public void removeTokenFromSession(String secret, HttpSession session) {
@ -278,7 +285,7 @@ public class TokenSessionManager {
/**
* Creates the new auth.
*
* @param auth the auth
* @param auth the auth
* @param details the details
* @return the authentication
*/

View File

@ -6,6 +6,6 @@ package de.bstly.we.model;
/**
* The Interface UserData.
*/
public interface UserData {
public interface UserData extends AbstractModel {
}

View File

@ -69,7 +69,8 @@ public class OidcTokenManager implements SmartInitializingSingleton {
private QOidcToken qOidcToken = QOidcToken.oidcToken;
/*
* @see org.springframework.beans.factory.SmartInitializingSingleton#afterSingletonsInstantiated()
* @see org.springframework.beans.factory.SmartInitializingSingleton#
* afterSingletonsInstantiated()
*/
/*
* @see org.springframework.beans.factory.SmartInitializingSingleton#
@ -118,7 +119,7 @@ public class OidcTokenManager implements SmartInitializingSingleton {
*
* @param client the client
* @param userId the user id
* @param nonce the nonce
* @param nonce the nonce
* @param scopes the scopes
* @param issuer the issuer
* @return the oidc token
@ -186,14 +187,17 @@ public class OidcTokenManager implements SmartInitializingSingleton {
UserProfileFields.PROFILE_FIELD_EMAIL);
UserProfileField emailPrimaryProfileField = userProfileFieldManager.get(user.getId(),
UserProfileFields.PROFILE_FIELD_EMAIL_PRIMARY);
String email = userManager.getBstlyEmail(user.getUsername());
if (emailProfileField != null && emailPrimaryProfileField != null
&& StringUtils.hasText(emailProfileField.getValue())
&& Boolean.getBoolean(emailPrimaryProfileField.getValue())) {
claimsSetBuilder.claim("email", emailProfileField.getValue());
email = emailProfileField.getValue();
} else {
claimsSetBuilder.claim("email_verified", true);
claimsSetBuilder.claim("email", userManager.getBstlyEmail(user.getUsername()));
}
claimsSetBuilder.claim("email", email.toLowerCase());
UserProfileField localeProfileField = userProfileFieldManager.get(user.getId(),
UserProfileFields.PROFILE_FIELD_LOCALE);

View File

@ -16,8 +16,10 @@ import org.springframework.util.Assert;
import com.google.common.collect.Lists;
import com.querydsl.core.BooleanBuilder;
import de.bstly.we.businesslogic.UserDataProvider;
import de.bstly.we.businesslogic.UserManager;
import de.bstly.we.model.User;
import de.bstly.we.model.UserData;
import de.bstly.we.partey.model.ParteyUserTag;
import de.bstly.we.partey.model.ParteyUserTag.ParteyUserTagId;
import de.bstly.we.partey.model.QParteyUserTag;
@ -27,7 +29,7 @@ import de.bstly.we.partey.repository.ParteyUserTagRepository;
* The Class ParteyUserTagManager.
*/
@Component
public class ParteyUserTagManager {
public class ParteyUserTagManager implements UserDataProvider {
@Autowired
private ParteyUserTagRepository parteyUserTagRepository;
@ -97,8 +99,8 @@ public class ParteyUserTagManager {
* @return the all for username
*/
public List<ParteyUserTag> getAllForUsername(String username) {
return Lists.newArrayList(
parteyUserTagRepository.findAll(qParteyUserTag.username.equalsIgnoreCase(username)));
return Lists.newArrayList(parteyUserTagRepository
.findAll(qParteyUserTag.username.equalsIgnoreCase(username)));
}
/**
@ -159,8 +161,37 @@ public class ParteyUserTagManager {
* @param username the username
*/
public void deleteAllForTarget(String username) {
parteyUserTagRepository
.deleteAll(parteyUserTagRepository.findAll(qParteyUserTag.username.equalsIgnoreCase(username)));
parteyUserTagRepository.deleteAll(parteyUserTagRepository
.findAll(qParteyUserTag.username.equalsIgnoreCase(username)));
}
/*
* @see de.bstly.we.businesslogic.UserDataProvider#getId()
*/
@Override
public String getId() {
return "partey-tags";
}
/*
* @see de.bstly.we.businesslogic.UserDataProvider#getUserData(java.lang.Long)
*/
@Override
public List<UserData> getUserData(Long userId) {
List<UserData> result = Lists.newArrayList(getAllByUserId(userId));
return result;
}
/*
* @see de.bstly.we.businesslogic.UserDataProvider#purgeUserData(java.lang.Long)
*/
@Override
public void purgeUserData(Long userId) {
User user = userManager.get(userId);
Assert.notNull(user, "invalid userId: '"
+ userId
+ "'!");
deleteAllForTarget(user.getUsername());
}
}

View File

@ -12,6 +12,7 @@ import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;
import de.bstly.we.model.UserData;
import de.bstly.we.partey.model.ParteyUserTag.ParteyUserTagId;
/**
@ -20,7 +21,7 @@ import de.bstly.we.partey.model.ParteyUserTag.ParteyUserTagId;
@Entity
@IdClass(ParteyUserTagId.class)
@Table(name = "partey_user_tags")
public class ParteyUserTag {
public class ParteyUserTag implements UserData {
@Id
private String username;

View File

@ -64,16 +64,16 @@ public class TimeslotManager implements UserDataProvider {
/**
* Gets the.
*
* @param owner the owner
* @param owner the owner
* @param invertOwner the invert owner
* @param after the after
* @param type the type
* @param visibility the visibility
* @param search the search
* @param page the page
* @param size the size
* @param sortBy the sort by
* @param descending the descending
* @param after the after
* @param type the type
* @param visibility the visibility
* @param search the search
* @param page the page
* @param size the size
* @param sortBy the sort by
* @param descending the descending
* @return the page
*/
public Page<Timeslot> get(Long owner, boolean invertOwner, Instant after, TimeslotType type,
@ -149,7 +149,6 @@ public class TimeslotManager implements UserDataProvider {
timeslotRepository.deleteById(id);
}
/*
* @see de.bstly.we.businesslogic.UserDataProvider#getId()
*/
@ -158,20 +157,15 @@ public class TimeslotManager implements UserDataProvider {
return "partey-timeslots";
}
/*
* @see de.bstly.we.businesslogic.UserDataProvider#getUserData(java.lang.Long)
*/
@Override
public List<UserData> getUserData(Long userId) {
List<UserData> result = Lists.newArrayList();
for (Timeslot timeslot : getAllByOwner(userId)) {
result.add(timeslot);
}
List<UserData> result = Lists.newArrayList(getAllByOwner(userId));
return result;
}
/*
* @see de.bstly.we.businesslogic.UserDataProvider#purgeUserData(java.lang.Long)
*/

View File

@ -12,7 +12,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>11</java.version>
<revision>1.3.0-SNAPSHOT</revision>
<revision>1.3.1-SNAPSHOT</revision>
</properties>
<parent>

View File

@ -19,7 +19,6 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import de.bstly.we.businesslogic.support.AbstractModelEventListener;
import de.bstly.we.model.AbstractModel;
import de.bstly.we.model.UserData;
/**
@ -28,7 +27,7 @@ import de.bstly.we.model.UserData;
@Entity
@Table(name = "shortened_urls")
@EntityListeners(AbstractModelEventListener.class)
public class ShortenedUrl implements UserData, AbstractModel {
public class ShortenedUrl implements UserData {
@Id
@Column(name = "code")