Tours re s tiction works - tests needs to be done
This commit is contained in:
parent
9c1a148e20
commit
334129cb70
@ -22,7 +22,9 @@ import com.plannaplan.responses.mappers.CommisionResponseMappers;
|
|||||||
import com.plannaplan.responses.models.CommisionResponse;
|
import com.plannaplan.responses.models.CommisionResponse;
|
||||||
import com.plannaplan.services.AssignmentService;
|
import com.plannaplan.services.AssignmentService;
|
||||||
import com.plannaplan.services.CommisionService;
|
import com.plannaplan.services.CommisionService;
|
||||||
|
import com.plannaplan.services.ConfiguratorService;
|
||||||
import com.plannaplan.services.GroupService;
|
import com.plannaplan.services.GroupService;
|
||||||
|
import com.plannaplan.types.AppState;
|
||||||
import com.plannaplan.types.UserRoles;
|
import com.plannaplan.types.UserRoles;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -56,6 +58,9 @@ public class CommisionController extends TokenBasedController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private AssignmentService assignmentService;
|
private AssignmentService assignmentService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ConfiguratorService configuratorService;
|
||||||
|
|
||||||
public CommisionController() {
|
public CommisionController() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,7 +71,7 @@ public class CommisionController extends TokenBasedController {
|
|||||||
@PathVariable(name = "id", required = false) Long userId) {
|
@PathVariable(name = "id", required = false) Long userId) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
final AppState appState = this.configuratorService.getCurrentConfig().getCurrentState();
|
||||||
final User asker = this.getCurrentUser()
|
final User asker = this.getCurrentUser()
|
||||||
.orElseThrow(() -> new UserNotFoundException("Invalid token"));
|
.orElseThrow(() -> new UserNotFoundException("Invalid token"));
|
||||||
|
|
||||||
@ -76,7 +81,9 @@ public class CommisionController extends TokenBasedController {
|
|||||||
: asker;
|
: asker;
|
||||||
|
|
||||||
Assert.isTrue((asker.getRole() == UserRoles.DEANERY && user.getRole() == UserRoles.STUDENT
|
Assert.isTrue((asker.getRole() == UserRoles.DEANERY && user.getRole() == UserRoles.STUDENT
|
||||||
|| (asker.getId().equals(user.getId()) && user.getRole() == UserRoles.STUDENT)),
|
&& appState == AppState.NO_TOUR
|
||||||
|
|| (asker.getId().equals(user.getId()) && user.getRole() == UserRoles.STUDENT
|
||||||
|
&& appState != AppState.NO_TOUR)),
|
||||||
"Incorrect attempt to change plan");
|
"Incorrect attempt to change plan");
|
||||||
|
|
||||||
Optional<Long> notExistingGroup = this.groupServcicxe.findNotExistingGroup(groups);
|
Optional<Long> notExistingGroup = this.groupServcicxe.findNotExistingGroup(groups);
|
||||||
|
Loading…
Reference in New Issue
Block a user