SEBSERV-417 show teacher for supporter selection
This commit is contained in:
parent
6de875b29c
commit
3e426ce2cc
4 changed files with 8 additions and 11 deletions
|
@ -533,7 +533,7 @@ public class ResourceService {
|
|||
final List<EntityName> selection = this.restService.getBuilder(GetUserAccountNames.class)
|
||||
.withQueryParam(Entity.FILTER_ATTR_INSTITUTION, String.valueOf(userInfo.institutionId))
|
||||
.withQueryParam(Entity.FILTER_ATTR_ACTIVE, Constants.TRUE_STRING)
|
||||
.withQueryParam(UserInfo.FILTER_ATTR_ROLE, UserRole.EXAM_SUPPORTER.name())
|
||||
.withQueryParam(UserInfo.FILTER_ATTR_ROLE, UserRole.EXAM_SUPPORTER.name() + "," + UserRole.TEACHER.name())
|
||||
.call()
|
||||
.getOr(Collections.emptyList());
|
||||
return selection
|
||||
|
|
|
@ -17,6 +17,8 @@ import ch.ethz.seb.sebserver.webservice.servicelayer.lms.FullLmsIntegrationServi
|
|||
/** Service used to maintain Teacher Ad-Hoc Accounts */
|
||||
public interface TeacherAccountService {
|
||||
|
||||
String AD_HOC_TEACHER_ID_PREFIX = "AD_HOC_TEACHER_";
|
||||
|
||||
/** Creates an Ad-Hoc Teacher account for a given existing Exam.
|
||||
*
|
||||
* @param exam The Exam instance
|
||||
|
|
|
@ -85,7 +85,7 @@ public class TeacherAccountServiceImpl implements TeacherAccountService {
|
|||
throw new RuntimeException("examId and/or userId cannot be null");
|
||||
}
|
||||
|
||||
return "TEACHER_" + Constants.UNDERLINE + lmsId + Constants.UNDERLINE + userId;
|
||||
return AD_HOC_TEACHER_ID_PREFIX + Constants.UNDERLINE + lmsId + Constants.UNDERLINE + userId;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -11,19 +11,13 @@ package ch.ethz.seb.sebserver.webservice.servicelayer.dao.impl;
|
|||
import static ch.ethz.seb.sebserver.webservice.datalayer.batis.mapper.UserRecordDynamicSqlSupport.*;
|
||||
import static org.mybatis.dynamic.sql.SqlBuilder.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import ch.ethz.seb.sebserver.gbl.Constants;
|
||||
import ch.ethz.seb.sebserver.gbl.api.authorization.PrivilegeType;
|
||||
import ch.ethz.seb.sebserver.gbl.model.user.*;
|
||||
import ch.ethz.seb.sebserver.webservice.datalayer.batis.mapper.*;
|
||||
|
@ -179,8 +173,9 @@ public class UserDAOImpl implements UserDAO {
|
|||
public Result<Collection<UserInfo>> allMatching(final FilterMap filterMap, final Predicate<UserInfo> predicate) {
|
||||
return Result.tryCatch(() -> {
|
||||
final String userRole = filterMap.getUserRole();
|
||||
final Set<String> userRoles = new HashSet<>(Arrays.asList(StringUtils.split(userRole, Constants.LIST_SEPARATOR)));
|
||||
final Predicate<UserInfo> _predicate = (StringUtils.isNotBlank(userRole))
|
||||
? predicate.and(ui -> ui.roles.contains(userRole))
|
||||
? predicate.and(ui -> userRoles.stream().anyMatch(ui.roles::contains))
|
||||
: predicate;
|
||||
|
||||
final QueryExpressionDSL<MyBatis3SelectModelAdapter<List<UserRecord>>>.QueryExpressionWhereBuilder sqlWhereClause =
|
||||
|
|
Loading…
Reference in a new issue