[Users | Trunk]: on manager accept invitation add both ri and community manager role in each case
This commit is contained in:
parent
f748b6e2a9
commit
76f86a9ab3
|
@ -15,6 +15,7 @@ import org.apache.log4j.Logger;
|
|||
import org.mitre.openid.connect.model.OIDCAuthenticationToken;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.security.access.method.P;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
|
@ -318,9 +319,25 @@ public class RegistryService {
|
|||
if (couId != null) {
|
||||
Integer role = calls.getRoleId(coPersonId, couId);
|
||||
calls.assignMemberRole(coPersonId, couId, role);
|
||||
verificationUtils.deleteMemberVerifications(verification.getEmail(), verification.getType(), verification.getEntity());
|
||||
if(verification.getType().equals("community") || verification.getType().equals("ri")) {
|
||||
Integer riCouId = calls.getCouId("ri", verification.getEntity(), false);
|
||||
if(riCouId != null) {
|
||||
calls.assignMemberRole(coPersonId, riCouId, calls.getRoleId(coPersonId, riCouId));
|
||||
verificationUtils.deleteMemberVerifications(verification.getEmail(), "community", verification.getEntity());
|
||||
verificationUtils.deleteMemberVerifications(verification.getEmail(), "ri", verification.getEntity());
|
||||
} else {
|
||||
verificationUtils.deleteMemberVerifications(verification.getEmail(), "community", verification.getEntity());
|
||||
}
|
||||
} else {
|
||||
verificationUtils.deleteMemberVerifications(verification.getEmail(), verification.getType(), verification.getEntity());
|
||||
}
|
||||
if (calls.getUserAdminGroup(coPersonId, couId) == null) {
|
||||
verificationUtils.deleteManagerVerifications(verification.getEmail(), verification.getType(), verification.getEntity());
|
||||
if(verification.getType().equals("community") || verification.getType().equals("ri")) {
|
||||
verificationUtils.deleteManagerVerifications(verification.getEmail(), "community", verification.getEntity());
|
||||
verificationUtils.deleteManagerVerifications(verification.getEmail(), "ri", verification.getEntity());
|
||||
} else {
|
||||
verificationUtils.deleteManagerVerifications(verification.getEmail(), verification.getType(), verification.getEntity());
|
||||
}
|
||||
calls.assignAdminRole(coPersonId, couId);
|
||||
authoritiesUpdater.update(verification.getEmail(), old -> {
|
||||
HashSet<SimpleGrantedAuthority> authorities = new HashSet<>((Collection<? extends SimpleGrantedAuthority>) old);
|
||||
|
@ -336,7 +353,7 @@ public class RegistryService {
|
|||
return Response.status(HttpStatus.NOT_FOUND.value()).entity(jsonUtils.createResponse("Role has not been found").toString()).type(MediaType.APPLICATION_JSON).build();
|
||||
}
|
||||
} else {
|
||||
return Response.status(HttpStatus.FORBIDDEN.value()).entity(jsonUtils.createResponse("Verification code is wrong").toString()).type(MediaType.APPLICATION_JSON).build();
|
||||
return Response.status(HttpStatus.BAD_REQUEST.value()).entity(jsonUtils.createResponse("Verification code is wrong").toString()).type(MediaType.APPLICATION_JSON).build();
|
||||
}
|
||||
} else {
|
||||
return Response.status(HttpStatus.FORBIDDEN.value()).entity(jsonUtils.createResponse("Forbidden verification").toString()).type(MediaType.APPLICATION_JSON).build();
|
||||
|
|
Loading…
Reference in New Issue