Skip to content

Commit 5c35778

Browse files
authored
Ignore account locked status for Scaffold API (#927)
1 parent 266ee30 commit 5c35778

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

app/src/main/java/it/chalmers/gamma/app/accountscaffold/AccountScaffoldFacade.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ public List<AccountScaffoldSuperGroupDTO> getActiveSuperGroups() {
6262
group -> {
6363
List<AccountScaffoldUserPostDTO> activeGroupMember =
6464
group.groupMembers().stream()
65-
.filter(groupMember -> !groupMember.user().extended().locked())
6665
.filter(groupMember -> gdprTrained.contains(groupMember.user().id()))
6766
.map(AccountScaffoldUserPostDTO::new)
6867
.toList();
@@ -94,7 +93,7 @@ public List<AccountScaffoldSuperGroupDTO> getActiveSuperGroups() {
9493

9594
/**
9695
* Returns the users that are active right now. Takes in a list of super group types to help
97-
* determine what kinds of groups that are deemed active. User must also be not locked, and have
96+
* determine what kinds of groups that are deemed active. User must have
9897
* participated in gdpr training.
9998
*/
10099
public List<AccountScaffoldUserDTO> getActiveUsers() {
@@ -118,7 +117,6 @@ public List<AccountScaffoldUserDTO> getActiveUsers() {
118117
.flatMap(group -> group.groupMembers().stream())
119118
.map(GroupMember::user)
120119
.distinct()
121-
.filter(user -> !user.extended().locked())
122120
.filter(groupMember -> gdprTrained.contains(groupMember.id()))
123121
.map(AccountScaffoldUserDTO::new)
124122
.toList();

app/src/main/java/it/chalmers/gamma/app/authentication/UserAccessGuard.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,11 @@ public boolean haveAccessToUser(UserId userId, boolean userLocked) {
7474

7575
/*
7676
* If the user is locked then nothing should be returned
77-
* unless if and only if the signed-in user is an admin.
77+
* unless if and only if the signed-in user is an admin,
78+
* or if we are using an API with extended access.
7879
*/
7980
if (userLocked) {
80-
return isAdmin();
81+
return isAdmin() || isApiKeyWithExtendedAccess();
8182
}
8283

8384
// If one user is trying to access another user, then approve

0 commit comments

Comments
 (0)