Merge remote-tracking branch 'origin/master' into JavaDocComments
# Conflicts: # src/main/java/mops/gruppen2/service/ControllerService.java
This commit is contained in:
@ -280,8 +280,6 @@ public class WebController {
|
||||
validationService.checkGroup(group.getTitle());
|
||||
model.addAttribute("group", group);
|
||||
|
||||
//controllerService.addUser(keyCloakService.createAccountFromPrincipal(token), group.getId());
|
||||
|
||||
if (group.getVisibility() == Visibility.PUBLIC) {
|
||||
return "redirect:/gruppen2/details/" + group.getId();
|
||||
}
|
||||
@ -299,7 +297,7 @@ public class WebController {
|
||||
|
||||
User user = new User(acc.getName(), acc.getGivenname(), acc.getFamilyname(), acc.getEmail());
|
||||
|
||||
if (!validationService.checkIfUserInGroup(userService.getGroupById(UUID.fromString(groupId)), user)) {
|
||||
if (!validationService.checkIfUserInGroupWithoutNoAccessAcception(userService.getGroupById(UUID.fromString(groupId)), user)) {
|
||||
controllerService.addUser(keyCloakService.createAccountFromPrincipal(token), UUID.fromString(groupId));
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package mops.gruppen2.repository;
|
||||
|
||||
import mops.gruppen2.domain.dto.InviteLinkDTO;
|
||||
import org.springframework.data.jdbc.repository.query.Modifying;
|
||||
import org.springframework.data.jdbc.repository.query.Query;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
@ -12,6 +13,7 @@ public interface InviteRepository extends CrudRepository<InviteLinkDTO, Long> {
|
||||
@Query("SELECT group_id FROM invite WHERE invite_link = :link")
|
||||
String findGroupIdByLink(@Param("link") String link);
|
||||
|
||||
@Modifying
|
||||
@Query("DELETE FROM invite WHERE group_id = :group")
|
||||
void deleteLinkOfGroup(@Param("group") String group);
|
||||
|
||||
|
||||
@ -47,8 +47,7 @@ class SecurityConfig extends KeycloakWebSecurityConfigurerAdapter {
|
||||
}
|
||||
|
||||
@Bean
|
||||
@Scope(scopeName = WebApplicationContext.SCOPE_REQUEST,
|
||||
proxyMode = ScopedProxyMode.TARGET_CLASS)
|
||||
@Scope(scopeName = WebApplicationContext.SCOPE_REQUEST, proxyMode = ScopedProxyMode.TARGET_CLASS)
|
||||
public AccessToken getAccessToken() {
|
||||
HttpServletRequest request =
|
||||
((ServletRequestAttributes) RequestContextHolder
|
||||
|
||||
@ -132,7 +132,8 @@ public class ControllerService {
|
||||
}
|
||||
}
|
||||
|
||||
private List<User> readCsvFile(MultipartFile file) throws EventException {
|
||||
private List<User> readCsvFile(MultipartFile file) throws EventException{
|
||||
if(file == null) return new ArrayList<>();
|
||||
if (!file.isEmpty()) {
|
||||
try {
|
||||
List<User> userList = CsvService.read(file.getInputStream());
|
||||
|
||||
@ -62,6 +62,11 @@ public class ValidationService {
|
||||
}
|
||||
}
|
||||
|
||||
//Warum ist das überhaupt nötig smh
|
||||
public boolean checkIfUserInGroupWithoutNoAccessAcception(Group group, User user) {
|
||||
return group.getMembers().contains(user);
|
||||
}
|
||||
|
||||
public Group checkParent(UUID parentId) {
|
||||
Group parent = new Group();
|
||||
if (!controllerService.idIsEmpty(parentId)) {
|
||||
|
||||
Reference in New Issue
Block a user