update invite, keep public key
This commit is contained in:
@@ -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,10 @@ 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 starts the starts
|
||||
* @param starts the starts
|
||||
* @param expires the expires
|
||||
*/
|
||||
public void applyItem(Long target, Integer item, JsonArray answers, Instant starts,
|
||||
@@ -265,10 +265,10 @@ 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 starts
|
||||
* @param starts the starts
|
||||
* @param expires the expires
|
||||
* @return the for item
|
||||
*/
|
||||
|
||||
@@ -78,14 +78,16 @@ public class PermissionMappingManager {
|
||||
/**
|
||||
* Creates the.
|
||||
*
|
||||
* @param item the item
|
||||
* @param names the names
|
||||
* @param lifetime the lifetime
|
||||
* @param lifetimeUnit the lifetime unit
|
||||
* @param lifetimeRound the lifetime round
|
||||
* @param addon the addon
|
||||
* @param product the product
|
||||
* @param startsQuestion the starts question
|
||||
* @param item the item
|
||||
* @param names the names
|
||||
* @param lifetime the lifetime
|
||||
* @param lifetimeUnit the lifetime unit
|
||||
* @param lifetimeRound the lifetime round
|
||||
* @param addon the addon
|
||||
* @param product the product
|
||||
* @param starts the starts
|
||||
* @param expires the expires
|
||||
* @param startsQuestion the starts question
|
||||
* @param expiresQuestion the expires question
|
||||
* @return the permission mapping
|
||||
*/
|
||||
@@ -140,9 +142,9 @@ public class PermissionMappingManager {
|
||||
/**
|
||||
* Gets the.
|
||||
*
|
||||
* @param page the page
|
||||
* @param size the size
|
||||
* @param sortBy the sort by
|
||||
* @param page the page
|
||||
* @param size the size
|
||||
* @param sortBy the sort by
|
||||
* @param descending the descending
|
||||
* @return the page
|
||||
*/
|
||||
|
||||
@@ -42,7 +42,7 @@ public class SystemPropertyManager {
|
||||
/**
|
||||
* Gets the.
|
||||
*
|
||||
* @param key the key
|
||||
* @param key the key
|
||||
* @param defaultValue the default value
|
||||
* @return the string
|
||||
*/
|
||||
@@ -64,7 +64,7 @@ public class SystemPropertyManager {
|
||||
/**
|
||||
* Gets the boolean.
|
||||
*
|
||||
* @param key the key
|
||||
* @param key the key
|
||||
* @param defaultValue the default value
|
||||
* @return the boolean
|
||||
*/
|
||||
@@ -85,7 +85,7 @@ public class SystemPropertyManager {
|
||||
/**
|
||||
* Gets the integer.
|
||||
*
|
||||
* @param key the key
|
||||
* @param key the key
|
||||
* @param defaultValue the default value
|
||||
* @return the integer
|
||||
*/
|
||||
@@ -106,7 +106,7 @@ public class SystemPropertyManager {
|
||||
/**
|
||||
* Gets the long.
|
||||
*
|
||||
* @param key the key
|
||||
* @param key the key
|
||||
* @param defaultValue the default value
|
||||
* @return the long
|
||||
*/
|
||||
@@ -117,7 +117,7 @@ public class SystemPropertyManager {
|
||||
/**
|
||||
* Adds the.
|
||||
*
|
||||
* @param key the key
|
||||
* @param key the key
|
||||
* @param value the value
|
||||
*/
|
||||
public void add(String key, String value) {
|
||||
@@ -129,7 +129,7 @@ public class SystemPropertyManager {
|
||||
/**
|
||||
* Update.
|
||||
*
|
||||
* @param key the key
|
||||
* @param key the key
|
||||
* @param value the value
|
||||
*/
|
||||
public void update(String key, String value) {
|
||||
@@ -140,6 +140,12 @@ public class SystemPropertyManager {
|
||||
systemPropertyRepository.save(systemProperty);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the.
|
||||
*
|
||||
* @param key the key
|
||||
* @param value the value
|
||||
*/
|
||||
public void set(String key, String value) {
|
||||
if (systemPropertyRepository.existsById(key)) {
|
||||
update(key, value);
|
||||
|
||||
@@ -106,7 +106,7 @@ public class UserManager implements UserDataProvider {
|
||||
/**
|
||||
* Sets the password.
|
||||
*
|
||||
* @param id the id
|
||||
* @param id the id
|
||||
* @param password the password
|
||||
* @return the user
|
||||
*/
|
||||
@@ -124,7 +124,7 @@ public class UserManager implements UserDataProvider {
|
||||
*
|
||||
* @param username the username
|
||||
* @param password the password
|
||||
* @param status the status
|
||||
* @param status the status
|
||||
* @return the user
|
||||
*/
|
||||
public User create(String username, String password, UserStatus status) {
|
||||
@@ -148,9 +148,9 @@ public class UserManager implements UserDataProvider {
|
||||
/**
|
||||
* Gets the.
|
||||
*
|
||||
* @param page the page
|
||||
* @param size the size
|
||||
* @param sortBy the sort by
|
||||
* @param page the page
|
||||
* @param size the size
|
||||
* @param sortBy the sort by
|
||||
* @param descending the descending
|
||||
* @return the page
|
||||
*/
|
||||
@@ -218,7 +218,7 @@ public class UserManager implements UserDataProvider {
|
||||
/**
|
||||
* Write public key.
|
||||
*
|
||||
* @param username the username
|
||||
* @param username the username
|
||||
* @param publicKey the public key
|
||||
*/
|
||||
public void writePublicKey(String username, String publicKey) {
|
||||
@@ -263,10 +263,11 @@ public class UserManager implements UserDataProvider {
|
||||
/**
|
||||
* Password reset.
|
||||
*
|
||||
* @param user the user
|
||||
* @param user the user
|
||||
* @param outputStream the output stream
|
||||
*/
|
||||
public void passwordReset(User user, ServletOutputStream outputStream) {
|
||||
// TODO: change to public key profile field
|
||||
String resetToken = RandomStringUtils.random(64, true, true);
|
||||
String command = "echo \""
|
||||
+ resetToken
|
||||
|
||||
@@ -100,7 +100,11 @@ public class UserProfileFieldManager implements UserDataProvider {
|
||||
Assert.isTrue(
|
||||
userProfileFieldRepository.exists(
|
||||
qUserProfileField.target.eq(target).and(qUserProfileField.name.eq(name))),
|
||||
"ProfileField '" + name + "' for target + '" + target + "' not exists!");
|
||||
"ProfileField '"
|
||||
+ name
|
||||
+ "' for target + '"
|
||||
+ target
|
||||
+ "' not exists!");
|
||||
UserProfileField delete = userProfileFieldRepository
|
||||
.findOne(qUserProfileField.target.eq(target).and(qUserProfileField.name.eq(name)))
|
||||
.get();
|
||||
@@ -143,7 +147,9 @@ public class UserProfileFieldManager implements UserDataProvider {
|
||||
@Override
|
||||
public void purgeUserData(Long userId) {
|
||||
for (UserProfileField userProfileField : getAllByTarget(userId)) {
|
||||
userProfileFieldRepository.delete(userProfileField);
|
||||
if (!userProfileField.getName().equals(UserProfileFields.PROFILE_FIELD_PUBLIC_KEY)) {
|
||||
userProfileFieldRepository.delete(userProfileField);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ package de.bstly.we.businesslogic;
|
||||
public interface UserProfileFields {
|
||||
|
||||
public static final String PROFILE_FIELD_EMAIL = "email";
|
||||
public static final String PROFILE_FIELD_PUBLIC_KEY = "publicKey";
|
||||
public static final String PROFILE_FIELD_EMAIL_PRIMARY = "primaryEmail";
|
||||
public static final String PROFILE_FIELD_LOCALE = "locale";
|
||||
}
|
||||
|
||||
@@ -103,10 +103,10 @@ public class PermissionManagementController extends BaseController {
|
||||
}
|
||||
|
||||
/**
|
||||
* Update permission.
|
||||
* Update permissions.
|
||||
*
|
||||
* @param permission the permission
|
||||
* @return the permission
|
||||
* @param permissions the permissions
|
||||
* @return the list
|
||||
*/
|
||||
@PreAuthorize("hasRole('ROLE_ADMIN')")
|
||||
@PatchMapping("list")
|
||||
@@ -125,7 +125,7 @@ public class PermissionManagementController extends BaseController {
|
||||
/**
|
||||
* Clone.
|
||||
*
|
||||
* @param name the name
|
||||
* @param name the name
|
||||
* @param clone the clone
|
||||
* @return the list
|
||||
*/
|
||||
|
||||
@@ -206,6 +206,8 @@ public class PermissionMapping {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the starts.
|
||||
*
|
||||
* @return the starts
|
||||
*/
|
||||
public Instant getStarts() {
|
||||
@@ -213,13 +215,17 @@ public class PermissionMapping {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param starts the starts to set
|
||||
* Sets the starts.
|
||||
*
|
||||
* @param starts the new starts
|
||||
*/
|
||||
public void setStarts(Instant starts) {
|
||||
this.starts = starts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the expires.
|
||||
*
|
||||
* @return the expires
|
||||
*/
|
||||
public Instant getExpires() {
|
||||
@@ -227,7 +233,9 @@ public class PermissionMapping {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param expires the expires to set
|
||||
* Sets the expires.
|
||||
*
|
||||
* @param expires the new expires
|
||||
*/
|
||||
public void setExpires(Instant expires) {
|
||||
this.expires = expires;
|
||||
@@ -275,6 +283,9 @@ public class PermissionMapping {
|
||||
@Converter
|
||||
public static class ChronoUnitConverter implements AttributeConverter<ChronoUnit, String> {
|
||||
|
||||
/*
|
||||
* @see javax.persistence.AttributeConverter#convertToDatabaseColumn(java.lang.Object)
|
||||
*/
|
||||
/*
|
||||
* @see javax.persistence.AttributeConverter#convertToDatabaseColumn(java.lang.
|
||||
* Object)
|
||||
@@ -284,6 +295,9 @@ public class PermissionMapping {
|
||||
return chronoUnit.name();
|
||||
}
|
||||
|
||||
/*
|
||||
* @see javax.persistence.AttributeConverter#convertToEntityAttribute(java.lang.Object)
|
||||
*/
|
||||
/*
|
||||
* @see javax.persistence.AttributeConverter#convertToEntityAttribute(java.lang.
|
||||
* Object)
|
||||
|
||||
Reference in New Issue
Block a user