added userdata, email to lowercase
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
*/
|
*/
|
||||||
package de.bstly.we.borrow.businesslogic;
|
package de.bstly.we.borrow.businesslogic;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
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.BorrowItemPeriodSlotRepository;
|
||||||
import de.bstly.we.borrow.repository.BorrowItemRepository;
|
import de.bstly.we.borrow.repository.BorrowItemRepository;
|
||||||
import de.bstly.we.borrow.repository.BorrowRequestRepository;
|
import de.bstly.we.borrow.repository.BorrowRequestRepository;
|
||||||
|
import de.bstly.we.businesslogic.UserDataProvider;
|
||||||
import de.bstly.we.businesslogic.UserManager;
|
import de.bstly.we.businesslogic.UserManager;
|
||||||
import de.bstly.we.email.businesslogic.EmailManager;
|
import de.bstly.we.email.businesslogic.EmailManager;
|
||||||
import de.bstly.we.model.User;
|
import de.bstly.we.model.User;
|
||||||
|
import de.bstly.we.model.UserData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class BorrowItemManager.
|
* The Class BorrowItemManager.
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class BorrowItemManager {
|
public class BorrowItemManager implements UserDataProvider {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private BorrowItemRepository borrowItemRepository;
|
private BorrowItemRepository borrowItemRepository;
|
||||||
@@ -252,4 +255,40 @@ public class BorrowItemManager {
|
|||||||
|
|
||||||
// TODO: send email
|
// 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());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ package de.bstly.we.borrow.businesslogic;
|
|||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
@@ -14,6 +16,7 @@ import org.springframework.data.domain.Sort;
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
import com.beust.jcommander.internal.Lists;
|
||||||
import com.nimbusds.jose.JOSEException;
|
import com.nimbusds.jose.JOSEException;
|
||||||
import com.nimbusds.jose.JOSEObjectType;
|
import com.nimbusds.jose.JOSEObjectType;
|
||||||
import com.nimbusds.jose.JWSHeader;
|
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.BorrowRequestStatus;
|
||||||
import de.bstly.we.borrow.model.QBorrowRequest;
|
import de.bstly.we.borrow.model.QBorrowRequest;
|
||||||
import de.bstly.we.borrow.repository.BorrowRequestRepository;
|
import de.bstly.we.borrow.repository.BorrowRequestRepository;
|
||||||
|
import de.bstly.we.businesslogic.UserDataProvider;
|
||||||
import de.bstly.we.businesslogic.UserManager;
|
import de.bstly.we.businesslogic.UserManager;
|
||||||
import de.bstly.we.jwt.businesslogic.JwtKeyManager;
|
import de.bstly.we.jwt.businesslogic.JwtKeyManager;
|
||||||
import de.bstly.we.jwt.model.JwtKey;
|
import de.bstly.we.jwt.model.JwtKey;
|
||||||
import de.bstly.we.model.User;
|
import de.bstly.we.model.User;
|
||||||
|
import de.bstly.we.model.UserData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class BorrowRequestManager.
|
* The Class BorrowRequestManager.
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class BorrowRequestManager {
|
public class BorrowRequestManager implements UserDataProvider {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private BorrowRequestRepository borrowRequestRepository;
|
private BorrowRequestRepository borrowRequestRepository;
|
||||||
@@ -63,10 +68,10 @@ public class BorrowRequestManager {
|
|||||||
/**
|
/**
|
||||||
* Gets the for user.
|
* Gets the for user.
|
||||||
*
|
*
|
||||||
* @param userId the user id
|
* @param userId the user id
|
||||||
* @param page the page
|
* @param page the page
|
||||||
* @param size the size
|
* @param size the size
|
||||||
* @param sortBy the sort by
|
* @param sortBy the sort by
|
||||||
* @param descending the descending
|
* @param descending the descending
|
||||||
* @return the for user
|
* @return the for user
|
||||||
*/
|
*/
|
||||||
@@ -79,11 +84,11 @@ public class BorrowRequestManager {
|
|||||||
/**
|
/**
|
||||||
* Gets the for user and stauts.
|
* Gets the for user and stauts.
|
||||||
*
|
*
|
||||||
* @param userId the user id
|
* @param userId the user id
|
||||||
* @param status the status
|
* @param status the status
|
||||||
* @param page the page
|
* @param page the page
|
||||||
* @param size the size
|
* @param size the size
|
||||||
* @param sortBy the sort by
|
* @param sortBy the sort by
|
||||||
* @param descending the descending
|
* @param descending the descending
|
||||||
* @return the for user and stauts
|
* @return the for user and stauts
|
||||||
*/
|
*/
|
||||||
@@ -98,10 +103,10 @@ public class BorrowRequestManager {
|
|||||||
/**
|
/**
|
||||||
* Gets the for owner.
|
* Gets the for owner.
|
||||||
*
|
*
|
||||||
* @param userId the user id
|
* @param userId the user id
|
||||||
* @param page the page
|
* @param page the page
|
||||||
* @param size the size
|
* @param size the size
|
||||||
* @param sortBy the sort by
|
* @param sortBy the sort by
|
||||||
* @param descending the descending
|
* @param descending the descending
|
||||||
* @return the for owner
|
* @return the for owner
|
||||||
*/
|
*/
|
||||||
@@ -114,11 +119,11 @@ public class BorrowRequestManager {
|
|||||||
/**
|
/**
|
||||||
* Gets the for owner and status.
|
* Gets the for owner and status.
|
||||||
*
|
*
|
||||||
* @param userId the user id
|
* @param userId the user id
|
||||||
* @param status the status
|
* @param status the status
|
||||||
* @param page the page
|
* @param page the page
|
||||||
* @param size the size
|
* @param size the size
|
||||||
* @param sortBy the sort by
|
* @param sortBy the sort by
|
||||||
* @param descending the descending
|
* @param descending the descending
|
||||||
* @return the for owner and status
|
* @return the for owner and status
|
||||||
*/
|
*/
|
||||||
@@ -160,7 +165,7 @@ public class BorrowRequestManager {
|
|||||||
* Creates the code.
|
* Creates the code.
|
||||||
*
|
*
|
||||||
* @param borrowRequest the borrow request
|
* @param borrowRequest the borrow request
|
||||||
* @param issuer the issuer
|
* @param issuer the issuer
|
||||||
* @return the signed JWT
|
* @return the signed JWT
|
||||||
* @throws JOSEException the JOSE exception
|
* @throws JOSEException the JOSE exception
|
||||||
*/
|
*/
|
||||||
@@ -217,7 +222,7 @@ public class BorrowRequestManager {
|
|||||||
*
|
*
|
||||||
* @param jwt the jwt
|
* @param jwt the jwt
|
||||||
* @return true, if successful
|
* @return true, if successful
|
||||||
* @throws JOSEException the JOSE exception
|
* @throws JOSEException the JOSE exception
|
||||||
* @throws ParseException the parse exception
|
* @throws ParseException the parse exception
|
||||||
*/
|
*/
|
||||||
public boolean verify(SignedJWT jwt) throws JOSEException, ParseException {
|
public boolean verify(SignedJWT jwt) throws JOSEException, ParseException {
|
||||||
@@ -239,4 +244,51 @@ public class BorrowRequestManager {
|
|||||||
|
|
||||||
return jwt.verify(jwtKeyManager.createVerfifier(jwtKey));
|
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());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,13 +19,15 @@ import javax.persistence.Transient;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
|
||||||
|
import de.bstly.we.model.UserData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class BorrowItem.
|
* The Class BorrowItem.
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "borrow_items")
|
@Table(name = "borrow_items")
|
||||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||||
public class BorrowItem {
|
public class BorrowItem implements UserData {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
|||||||
@@ -16,12 +16,14 @@ import javax.persistence.Lob;
|
|||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
import javax.persistence.Transient;
|
import javax.persistence.Transient;
|
||||||
|
|
||||||
|
import de.bstly.we.model.UserData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class BorrowRequest.
|
* The Class BorrowRequest.
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "borrow_requests")
|
@Table(name = "borrow_requests")
|
||||||
public class BorrowRequest {
|
public class BorrowRequest implements UserData {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
|||||||
@@ -24,7 +24,17 @@ public interface BorrowRequestRepository
|
|||||||
/**
|
/**
|
||||||
* Find all by owner.
|
* 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
|
* @param pageable the pageable
|
||||||
* @return the page
|
* @return the page
|
||||||
*/
|
*/
|
||||||
@@ -34,8 +44,8 @@ public interface BorrowRequestRepository
|
|||||||
/**
|
/**
|
||||||
* Find all by owner and status.
|
* Find all by owner and status.
|
||||||
*
|
*
|
||||||
* @param owner the owner
|
* @param owner the owner
|
||||||
* @param status the status
|
* @param status the status
|
||||||
* @param pageable the pageable
|
* @param pageable the pageable
|
||||||
* @return the page
|
* @return the page
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class PermissionManager implements UserDataProvider {
|
|||||||
* Gets the.
|
* Gets the.
|
||||||
*
|
*
|
||||||
* @param target the target
|
* @param target the target
|
||||||
* @param name the name
|
* @param name the name
|
||||||
* @return the list
|
* @return the list
|
||||||
*/
|
*/
|
||||||
public List<Permission> get(Long target, String name) {
|
public List<Permission> get(Long target, String name) {
|
||||||
@@ -126,7 +126,7 @@ public class PermissionManager implements UserDataProvider {
|
|||||||
* Checks for permission.
|
* Checks for permission.
|
||||||
*
|
*
|
||||||
* @param target the target
|
* @param target the target
|
||||||
* @param name the name
|
* @param name the name
|
||||||
* @return true, if successful
|
* @return true, if successful
|
||||||
*/
|
*/
|
||||||
public boolean hasPermission(Long target, String name) {
|
public boolean hasPermission(Long target, String name) {
|
||||||
@@ -143,10 +143,10 @@ public class PermissionManager implements UserDataProvider {
|
|||||||
/**
|
/**
|
||||||
* Creates the.
|
* Creates the.
|
||||||
*
|
*
|
||||||
* @param target the target
|
* @param target the target
|
||||||
* @param name the name
|
* @param name the name
|
||||||
* @param addon the addon
|
* @param addon the addon
|
||||||
* @param starts the starts
|
* @param starts the starts
|
||||||
* @param expires the expires
|
* @param expires the expires
|
||||||
* @return the permission
|
* @return the permission
|
||||||
*/
|
*/
|
||||||
@@ -188,7 +188,7 @@ public class PermissionManager implements UserDataProvider {
|
|||||||
/**
|
/**
|
||||||
* Clone.
|
* Clone.
|
||||||
*
|
*
|
||||||
* @param name the name
|
* @param name the name
|
||||||
* @param clone the clone
|
* @param clone the clone
|
||||||
* @return the list
|
* @return the list
|
||||||
*/
|
*/
|
||||||
@@ -212,7 +212,7 @@ public class PermissionManager implements UserDataProvider {
|
|||||||
* Delete.
|
* Delete.
|
||||||
*
|
*
|
||||||
* @param target the target
|
* @param target the target
|
||||||
* @param name the name
|
* @param name the name
|
||||||
*/
|
*/
|
||||||
public void delete(Long target, String name) {
|
public void delete(Long target, String name) {
|
||||||
Assert.isTrue(
|
Assert.isTrue(
|
||||||
@@ -249,10 +249,11 @@ public class PermissionManager implements UserDataProvider {
|
|||||||
/**
|
/**
|
||||||
* Apply item.
|
* Apply item.
|
||||||
*
|
*
|
||||||
* @param target the target
|
* @param target the target
|
||||||
* @param item the item
|
* @param item the item
|
||||||
* @param answers the answers
|
* @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,
|
public void applyItem(Long target, Integer item, JsonArray answers, Instant starts,
|
||||||
Instant expires) {
|
Instant expires) {
|
||||||
@@ -264,10 +265,11 @@ public class PermissionManager implements UserDataProvider {
|
|||||||
/**
|
/**
|
||||||
* Gets the for item.
|
* Gets the for item.
|
||||||
*
|
*
|
||||||
* @param target the target
|
* @param target the target
|
||||||
* @param item the item
|
* @param item the item
|
||||||
* @param answers the answers
|
* @param answers the answers
|
||||||
* @param starts the start
|
* @param starts the starts
|
||||||
|
* @param expires the expires
|
||||||
* @return the for item
|
* @return the for item
|
||||||
*/
|
*/
|
||||||
public List<Permission> getForItem(Long target, Integer item, JsonArray answers, Instant starts,
|
public List<Permission> getForItem(Long target, Integer item, JsonArray answers, Instant starts,
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public class QuotaManager implements UserDataProvider {
|
|||||||
* Gets the.
|
* Gets the.
|
||||||
*
|
*
|
||||||
* @param target the target
|
* @param target the target
|
||||||
* @param name the name
|
* @param name the name
|
||||||
* @return the quota
|
* @return the quota
|
||||||
*/
|
*/
|
||||||
public Quota get(Long target, String name) {
|
public Quota get(Long target, String name) {
|
||||||
@@ -85,7 +85,7 @@ public class QuotaManager implements UserDataProvider {
|
|||||||
* Checks for quota.
|
* Checks for quota.
|
||||||
*
|
*
|
||||||
* @param target the target
|
* @param target the target
|
||||||
* @param name the name
|
* @param name the name
|
||||||
* @return true, if successful
|
* @return true, if successful
|
||||||
*/
|
*/
|
||||||
public boolean hasQuota(Long target, String name) {
|
public boolean hasQuota(Long target, String name) {
|
||||||
@@ -96,10 +96,10 @@ public class QuotaManager implements UserDataProvider {
|
|||||||
/**
|
/**
|
||||||
* Creates the.
|
* Creates the.
|
||||||
*
|
*
|
||||||
* @param target the target
|
* @param target the target
|
||||||
* @param name the name
|
* @param name the name
|
||||||
* @param value the value
|
* @param value the value
|
||||||
* @param unit the unit
|
* @param unit the unit
|
||||||
* @param disposable the disposable
|
* @param disposable the disposable
|
||||||
* @return the quota
|
* @return the quota
|
||||||
*/
|
*/
|
||||||
@@ -141,7 +141,7 @@ public class QuotaManager implements UserDataProvider {
|
|||||||
/**
|
/**
|
||||||
* Clone.
|
* Clone.
|
||||||
*
|
*
|
||||||
* @param name the name
|
* @param name the name
|
||||||
* @param clone the clone
|
* @param clone the clone
|
||||||
* @param value the value
|
* @param value the value
|
||||||
* @return the list
|
* @return the list
|
||||||
@@ -164,7 +164,7 @@ public class QuotaManager implements UserDataProvider {
|
|||||||
* Delete.
|
* Delete.
|
||||||
*
|
*
|
||||||
* @param target the target
|
* @param target the target
|
||||||
* @param name the name
|
* @param name the name
|
||||||
*/
|
*/
|
||||||
public void delete(Long target, String name) {
|
public void delete(Long target, String name) {
|
||||||
Assert.isTrue(quotaRepository.exists(qQuota.target.eq(target).and(qQuota.name.eq(name))),
|
Assert.isTrue(quotaRepository.exists(qQuota.target.eq(target).and(qQuota.name.eq(name))),
|
||||||
@@ -197,10 +197,11 @@ public class QuotaManager implements UserDataProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Adds the for item.
|
||||||
* @param target
|
*
|
||||||
* @param item
|
* @param target the target
|
||||||
* @return
|
* @param item the item
|
||||||
|
* @param quotas the quotas
|
||||||
*/
|
*/
|
||||||
public void addForItem(Long target, Integer item, List<Quota> quotas) {
|
public void addForItem(Long target, Integer item, List<Quota> quotas) {
|
||||||
for (QuotaMapping quotaMapping : quotaMappingManager.getAllByItem(item)) {
|
for (QuotaMapping quotaMapping : quotaMappingManager.getAllByItem(item)) {
|
||||||
@@ -241,7 +242,7 @@ public class QuotaManager implements UserDataProvider {
|
|||||||
* Apply item.
|
* Apply item.
|
||||||
*
|
*
|
||||||
* @param target the target
|
* @param target the target
|
||||||
* @param item the item
|
* @param item the item
|
||||||
*/
|
*/
|
||||||
public void applyItem(Long target, Integer item) {
|
public void applyItem(Long target, Integer item) {
|
||||||
for (QuotaMapping quotaMapping : quotaMappingManager.getAllByItem(item)) {
|
for (QuotaMapping quotaMapping : quotaMappingManager.getAllByItem(item)) {
|
||||||
|
|||||||
@@ -60,10 +60,13 @@ public class UserDataManager implements SmartInitializingSingleton {
|
|||||||
private List<UserDataProvider> providers;
|
private List<UserDataProvider> providers;
|
||||||
private Gson gson = new Gson();
|
private Gson gson = new Gson();
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @see org.springframework.beans.factory.SmartInitializingSingleton#afterSingletonsInstantiated()
|
* @see org.springframework.beans.factory.SmartInitializingSingleton#afterSingletonsInstantiated()
|
||||||
*/
|
*/
|
||||||
|
/*
|
||||||
|
* @see org.springframework.beans.factory.SmartInitializingSingleton#
|
||||||
|
* afterSingletonsInstantiated()
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void afterSingletonsInstantiated() {
|
public void afterSingletonsInstantiated() {
|
||||||
providers = Lists.newArrayList();
|
providers = Lists.newArrayList();
|
||||||
@@ -78,6 +81,15 @@ public class UserDataManager implements SmartInitializingSingleton {
|
|||||||
*/
|
*/
|
||||||
@Scheduled(cron = "${we.bstly.userdata.cron:0 0 0 * * * }")
|
@Scheduled(cron = "${we.bstly.userdata.cron:0 0 0 * * * }")
|
||||||
public void purge() {
|
public void purge() {
|
||||||
|
purge(!purge);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Purge.
|
||||||
|
*
|
||||||
|
* @param dry the dry
|
||||||
|
*/
|
||||||
|
public void purge(boolean dry) {
|
||||||
long days = systemPropertyManager.getLong(SYSTEM_PROPERTY_USERDATA_DAYS,
|
long days = systemPropertyManager.getLong(SYSTEM_PROPERTY_USERDATA_DAYS,
|
||||||
SYSTEM_PROPERTY_USERDATA_DAYS_DEFAULT);
|
SYSTEM_PROPERTY_USERDATA_DAYS_DEFAULT);
|
||||||
|
|
||||||
@@ -90,7 +102,7 @@ public class UserDataManager implements SmartInitializingSingleton {
|
|||||||
if (permissionManager.getNotExpiresByTargetIgnoreStart(user.getId())
|
if (permissionManager.getNotExpiresByTargetIgnoreStart(user.getId())
|
||||||
.isEmpty()) {
|
.isEmpty()) {
|
||||||
if (UserStatus.PURGE.equals(user.getStatus())) {
|
if (UserStatus.PURGE.equals(user.getStatus())) {
|
||||||
purge(user, !purge);
|
purge(user, dry);
|
||||||
} else if (UserStatus.NORMAL.equals(user.getStatus())) {
|
} else if (UserStatus.NORMAL.equals(user.getStatus())) {
|
||||||
Instant last = Instant.MIN;
|
Instant last = Instant.MIN;
|
||||||
for (Permission permission : permissionManager
|
for (Permission permission : permissionManager
|
||||||
@@ -101,7 +113,7 @@ public class UserDataManager implements SmartInitializingSingleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Instant.now().minus(days, ChronoUnit.DAYS).isAfter(last)) {
|
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();
|
pageable = page.nextPageable();
|
||||||
} while (page.hasNext());
|
} while (page.hasNext());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -121,10 +132,16 @@ public class UserDataManager implements SmartInitializingSingleton {
|
|||||||
public void purge(User user, boolean dry) {
|
public void purge(User user, boolean dry) {
|
||||||
Long userId = user.getId();
|
Long userId = user.getId();
|
||||||
if (dry) {
|
if (dry) {
|
||||||
logger.debug("Would purge all data of user '" + user.getUsername() + "' [id="
|
logger.debug("Would purge all data of user '"
|
||||||
+ user.getId() + "]!");
|
+ user.getUsername()
|
||||||
|
+ "' [id="
|
||||||
|
+ user.getId()
|
||||||
|
+ "]!");
|
||||||
} else {
|
} 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) {
|
if (dry) {
|
||||||
List<UserData> result = provider.getUserData(userId);
|
List<UserData> result = provider.getUserData(userId);
|
||||||
if (!result.isEmpty()) {
|
if (!result.isEmpty()) {
|
||||||
logger.debug("\tWould have purged '" + provider.getId() + "' data of user '"
|
logger.debug("\tWould have purged '"
|
||||||
+ user.getUsername() + "' [id=" + user.getId() + "]!");
|
+ provider.getId()
|
||||||
|
+ "' data of user '"
|
||||||
|
+ user.getUsername()
|
||||||
|
+ "' [id="
|
||||||
|
+ user.getId()
|
||||||
|
+ "]!");
|
||||||
if (logger.isTraceEnabled()) {
|
if (logger.isTraceEnabled()) {
|
||||||
for (UserData userData : result) {
|
for (UserData userData : result) {
|
||||||
logger.trace("\t\t" + gson.toJson(userData));
|
logger.trace("\t\t"
|
||||||
|
+ gson.toJson(userData));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
List<UserData> result = provider.getUserData(userId);
|
List<UserData> result = provider.getUserData(userId);
|
||||||
if (!result.isEmpty()) {
|
if (!result.isEmpty()) {
|
||||||
logger.warn("\tPurge '" + provider.getId() + "' data of user '"
|
logger.warn("\tPurge '"
|
||||||
+ user.getUsername() + "' [id=" + user.getId() + "]!");
|
+ provider.getId()
|
||||||
|
+ "' data of user '"
|
||||||
|
+ user.getUsername()
|
||||||
|
+ "' [id="
|
||||||
|
+ user.getId()
|
||||||
|
+ "]!");
|
||||||
if (logger.isTraceEnabled()) {
|
if (logger.isTraceEnabled()) {
|
||||||
for (UserData userData : result) {
|
for (UserData userData : result) {
|
||||||
logger.trace("\t\t" + gson.toJson(userData));
|
logger.trace("\t\t"
|
||||||
|
+ gson.toJson(userData));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
provider.purgeUserData(userId);
|
provider.purgeUserData(userId);
|
||||||
@@ -156,7 +185,10 @@ public class UserDataManager implements SmartInitializingSingleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!dry) {
|
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()
|
||||||
+ "]!");
|
+ "]!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -55,7 +55,7 @@ public class TokenSessionManager {
|
|||||||
* Gets the permission mappings for token.
|
* Gets the permission mappings for token.
|
||||||
*
|
*
|
||||||
* @param userId the user id
|
* @param userId the user id
|
||||||
* @param token the token
|
* @param token the token
|
||||||
* @return the permission mappings for token
|
* @return the permission mappings for token
|
||||||
*/
|
*/
|
||||||
public List<PermissionMapping> getPermissionMappingsForToken(Long userId, String token) {
|
public List<PermissionMapping> getPermissionMappingsForToken(Long userId, String token) {
|
||||||
@@ -79,7 +79,7 @@ public class TokenSessionManager {
|
|||||||
* Gets the permissions for token.
|
* Gets the permissions for token.
|
||||||
*
|
*
|
||||||
* @param userId the user id
|
* @param userId the user id
|
||||||
* @param token the token
|
* @param token the token
|
||||||
* @return the permissions for token
|
* @return the permissions for token
|
||||||
*/
|
*/
|
||||||
public List<Permission> getPermissionsForToken(Long userId, String token) {
|
public List<Permission> getPermissionsForToken(Long userId, String token) {
|
||||||
@@ -113,7 +113,7 @@ public class TokenSessionManager {
|
|||||||
* Gets the quota mappings for token.
|
* Gets the quota mappings for token.
|
||||||
*
|
*
|
||||||
* @param userId the user id
|
* @param userId the user id
|
||||||
* @param token the token
|
* @param token the token
|
||||||
* @return the quota mappings for token
|
* @return the quota mappings for token
|
||||||
*/
|
*/
|
||||||
public List<QuotaMapping> getQuotaMappingsForToken(Long userId, String token) {
|
public List<QuotaMapping> getQuotaMappingsForToken(Long userId, String token) {
|
||||||
@@ -133,6 +133,13 @@ public class TokenSessionManager {
|
|||||||
return quotaMappings;
|
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) {
|
public void addQuotasForToken(Long userId, String token, List<Quota> quotas) {
|
||||||
try {
|
try {
|
||||||
JsonObject result = pretixManager.getCheckInItemBySecret(token);
|
JsonObject result = pretixManager.getCheckInItemBySecret(token);
|
||||||
@@ -215,7 +222,7 @@ public class TokenSessionManager {
|
|||||||
/**
|
/**
|
||||||
* Adds the token to session.
|
* Adds the token to session.
|
||||||
*
|
*
|
||||||
* @param secret the secret
|
* @param secret the secret
|
||||||
* @param session the session
|
* @param session the session
|
||||||
*/
|
*/
|
||||||
public void addTokenToSession(String secret, HttpSession session) {
|
public void addTokenToSession(String secret, HttpSession session) {
|
||||||
@@ -242,7 +249,7 @@ public class TokenSessionManager {
|
|||||||
/**
|
/**
|
||||||
* Removes the token from session.
|
* Removes the token from session.
|
||||||
*
|
*
|
||||||
* @param secret the secret
|
* @param secret the secret
|
||||||
* @param session the session
|
* @param session the session
|
||||||
*/
|
*/
|
||||||
public void removeTokenFromSession(String secret, HttpSession session) {
|
public void removeTokenFromSession(String secret, HttpSession session) {
|
||||||
@@ -278,7 +285,7 @@ public class TokenSessionManager {
|
|||||||
/**
|
/**
|
||||||
* Creates the new auth.
|
* Creates the new auth.
|
||||||
*
|
*
|
||||||
* @param auth the auth
|
* @param auth the auth
|
||||||
* @param details the details
|
* @param details the details
|
||||||
* @return the authentication
|
* @return the authentication
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -6,6 +6,6 @@ package de.bstly.we.model;
|
|||||||
/**
|
/**
|
||||||
* The Interface UserData.
|
* The Interface UserData.
|
||||||
*/
|
*/
|
||||||
public interface UserData {
|
public interface UserData extends AbstractModel {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,7 +69,8 @@ public class OidcTokenManager implements SmartInitializingSingleton {
|
|||||||
private QOidcToken qOidcToken = QOidcToken.oidcToken;
|
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#
|
* @see org.springframework.beans.factory.SmartInitializingSingleton#
|
||||||
@@ -118,7 +119,7 @@ public class OidcTokenManager implements SmartInitializingSingleton {
|
|||||||
*
|
*
|
||||||
* @param client the client
|
* @param client the client
|
||||||
* @param userId the user id
|
* @param userId the user id
|
||||||
* @param nonce the nonce
|
* @param nonce the nonce
|
||||||
* @param scopes the scopes
|
* @param scopes the scopes
|
||||||
* @param issuer the issuer
|
* @param issuer the issuer
|
||||||
* @return the oidc token
|
* @return the oidc token
|
||||||
@@ -186,14 +187,17 @@ public class OidcTokenManager implements SmartInitializingSingleton {
|
|||||||
UserProfileFields.PROFILE_FIELD_EMAIL);
|
UserProfileFields.PROFILE_FIELD_EMAIL);
|
||||||
UserProfileField emailPrimaryProfileField = userProfileFieldManager.get(user.getId(),
|
UserProfileField emailPrimaryProfileField = userProfileFieldManager.get(user.getId(),
|
||||||
UserProfileFields.PROFILE_FIELD_EMAIL_PRIMARY);
|
UserProfileFields.PROFILE_FIELD_EMAIL_PRIMARY);
|
||||||
|
|
||||||
|
String email = userManager.getBstlyEmail(user.getUsername());
|
||||||
if (emailProfileField != null && emailPrimaryProfileField != null
|
if (emailProfileField != null && emailPrimaryProfileField != null
|
||||||
&& StringUtils.hasText(emailProfileField.getValue())
|
&& StringUtils.hasText(emailProfileField.getValue())
|
||||||
&& Boolean.getBoolean(emailPrimaryProfileField.getValue())) {
|
&& Boolean.getBoolean(emailPrimaryProfileField.getValue())) {
|
||||||
claimsSetBuilder.claim("email", emailProfileField.getValue());
|
email = emailProfileField.getValue();
|
||||||
} else {
|
} else {
|
||||||
claimsSetBuilder.claim("email_verified", true);
|
claimsSetBuilder.claim("email_verified", true);
|
||||||
claimsSetBuilder.claim("email", userManager.getBstlyEmail(user.getUsername()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
claimsSetBuilder.claim("email", email.toLowerCase());
|
||||||
|
|
||||||
UserProfileField localeProfileField = userProfileFieldManager.get(user.getId(),
|
UserProfileField localeProfileField = userProfileFieldManager.get(user.getId(),
|
||||||
UserProfileFields.PROFILE_FIELD_LOCALE);
|
UserProfileFields.PROFILE_FIELD_LOCALE);
|
||||||
|
|||||||
@@ -16,8 +16,10 @@ import org.springframework.util.Assert;
|
|||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.querydsl.core.BooleanBuilder;
|
import com.querydsl.core.BooleanBuilder;
|
||||||
|
|
||||||
|
import de.bstly.we.businesslogic.UserDataProvider;
|
||||||
import de.bstly.we.businesslogic.UserManager;
|
import de.bstly.we.businesslogic.UserManager;
|
||||||
import de.bstly.we.model.User;
|
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;
|
||||||
import de.bstly.we.partey.model.ParteyUserTag.ParteyUserTagId;
|
import de.bstly.we.partey.model.ParteyUserTag.ParteyUserTagId;
|
||||||
import de.bstly.we.partey.model.QParteyUserTag;
|
import de.bstly.we.partey.model.QParteyUserTag;
|
||||||
@@ -27,7 +29,7 @@ import de.bstly.we.partey.repository.ParteyUserTagRepository;
|
|||||||
* The Class ParteyUserTagManager.
|
* The Class ParteyUserTagManager.
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class ParteyUserTagManager {
|
public class ParteyUserTagManager implements UserDataProvider {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ParteyUserTagRepository parteyUserTagRepository;
|
private ParteyUserTagRepository parteyUserTagRepository;
|
||||||
@@ -97,8 +99,8 @@ public class ParteyUserTagManager {
|
|||||||
* @return the all for username
|
* @return the all for username
|
||||||
*/
|
*/
|
||||||
public List<ParteyUserTag> getAllForUsername(String username) {
|
public List<ParteyUserTag> getAllForUsername(String username) {
|
||||||
return Lists.newArrayList(
|
return Lists.newArrayList(parteyUserTagRepository
|
||||||
parteyUserTagRepository.findAll(qParteyUserTag.username.equalsIgnoreCase(username)));
|
.findAll(qParteyUserTag.username.equalsIgnoreCase(username)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -159,8 +161,37 @@ public class ParteyUserTagManager {
|
|||||||
* @param username the username
|
* @param username the username
|
||||||
*/
|
*/
|
||||||
public void deleteAllForTarget(String username) {
|
public void deleteAllForTarget(String username) {
|
||||||
parteyUserTagRepository
|
parteyUserTagRepository.deleteAll(parteyUserTagRepository
|
||||||
.deleteAll(parteyUserTagRepository.findAll(qParteyUserTag.username.equalsIgnoreCase(username)));
|
.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());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import javax.persistence.Id;
|
|||||||
import javax.persistence.IdClass;
|
import javax.persistence.IdClass;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
import de.bstly.we.model.UserData;
|
||||||
import de.bstly.we.partey.model.ParteyUserTag.ParteyUserTagId;
|
import de.bstly.we.partey.model.ParteyUserTag.ParteyUserTagId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -20,7 +21,7 @@ import de.bstly.we.partey.model.ParteyUserTag.ParteyUserTagId;
|
|||||||
@Entity
|
@Entity
|
||||||
@IdClass(ParteyUserTagId.class)
|
@IdClass(ParteyUserTagId.class)
|
||||||
@Table(name = "partey_user_tags")
|
@Table(name = "partey_user_tags")
|
||||||
public class ParteyUserTag {
|
public class ParteyUserTag implements UserData {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
private String username;
|
private String username;
|
||||||
|
|||||||
+10
-16
@@ -64,16 +64,16 @@ public class TimeslotManager implements UserDataProvider {
|
|||||||
/**
|
/**
|
||||||
* Gets the.
|
* Gets the.
|
||||||
*
|
*
|
||||||
* @param owner the owner
|
* @param owner the owner
|
||||||
* @param invertOwner the invert owner
|
* @param invertOwner the invert owner
|
||||||
* @param after the after
|
* @param after the after
|
||||||
* @param type the type
|
* @param type the type
|
||||||
* @param visibility the visibility
|
* @param visibility the visibility
|
||||||
* @param search the search
|
* @param search the search
|
||||||
* @param page the page
|
* @param page the page
|
||||||
* @param size the size
|
* @param size the size
|
||||||
* @param sortBy the sort by
|
* @param sortBy the sort by
|
||||||
* @param descending the descending
|
* @param descending the descending
|
||||||
* @return the page
|
* @return the page
|
||||||
*/
|
*/
|
||||||
public Page<Timeslot> get(Long owner, boolean invertOwner, Instant after, TimeslotType type,
|
public Page<Timeslot> get(Long owner, boolean invertOwner, Instant after, TimeslotType type,
|
||||||
@@ -149,7 +149,6 @@ public class TimeslotManager implements UserDataProvider {
|
|||||||
timeslotRepository.deleteById(id);
|
timeslotRepository.deleteById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @see de.bstly.we.businesslogic.UserDataProvider#getId()
|
* @see de.bstly.we.businesslogic.UserDataProvider#getId()
|
||||||
*/
|
*/
|
||||||
@@ -158,20 +157,15 @@ public class TimeslotManager implements UserDataProvider {
|
|||||||
return "partey-timeslots";
|
return "partey-timeslots";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @see de.bstly.we.businesslogic.UserDataProvider#getUserData(java.lang.Long)
|
* @see de.bstly.we.businesslogic.UserDataProvider#getUserData(java.lang.Long)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<UserData> getUserData(Long userId) {
|
public List<UserData> getUserData(Long userId) {
|
||||||
List<UserData> result = Lists.newArrayList();
|
List<UserData> result = Lists.newArrayList(getAllByOwner(userId));
|
||||||
for (Timeslot timeslot : getAllByOwner(userId)) {
|
|
||||||
result.add(timeslot);
|
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @see de.bstly.we.businesslogic.UserDataProvider#purgeUserData(java.lang.Long)
|
* @see de.bstly.we.businesslogic.UserDataProvider#purgeUserData(java.lang.Long)
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<java.version>11</java.version>
|
<java.version>11</java.version>
|
||||||
<revision>1.3.0-SNAPSHOT</revision>
|
<revision>1.3.1-SNAPSHOT</revision>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
|
|||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
import de.bstly.we.businesslogic.support.AbstractModelEventListener;
|
import de.bstly.we.businesslogic.support.AbstractModelEventListener;
|
||||||
import de.bstly.we.model.AbstractModel;
|
|
||||||
import de.bstly.we.model.UserData;
|
import de.bstly.we.model.UserData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -28,7 +27,7 @@ import de.bstly.we.model.UserData;
|
|||||||
@Entity
|
@Entity
|
||||||
@Table(name = "shortened_urls")
|
@Table(name = "shortened_urls")
|
||||||
@EntityListeners(AbstractModelEventListener.class)
|
@EntityListeners(AbstractModelEventListener.class)
|
||||||
public class ShortenedUrl implements UserData, AbstractModel {
|
public class ShortenedUrl implements UserData {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "code")
|
@Column(name = "code")
|
||||||
|
|||||||
Reference in New Issue
Block a user