-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pivotal ID # 185110100: Case Insensitive Submission Ownership (#722)
* Pivotal ID # 185110100: Case Insensitive Submission Ownership - Ensure user email is always lowercase on registration - Remove unnecessary data classes
- Loading branch information
1 parent
5f3a6f7
commit 7d9afb2
Showing
10 changed files
with
50 additions
and
33 deletions.
There are no files selected for viewing
6 changes: 0 additions & 6 deletions
6
commons/commons-bio/src/main/kotlin/ebi/ac/uk/api/security/CheckUserRequest.kt
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
commons/commons-bio/src/main/kotlin/ebi/ac/uk/api/security/GetOrRegisterUserRequest.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 6 additions & 6 deletions
12
...ission-webapp/src/main/kotlin/ac/uk/ebi/biostd/submission/domain/helpers/OnBehalfUtils.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
package ac.uk.ebi.biostd.submission.domain.helpers | ||
|
||
import ac.uk.ebi.biostd.submission.web.model.OnBehalfRequest | ||
import ebi.ac.uk.api.security.GetOrRegisterUserRequest | ||
import ebi.ac.uk.base.orFalse | ||
import ebi.ac.uk.security.integration.components.ISecurityQueryService | ||
import ebi.ac.uk.security.integration.model.api.SecurityUser | ||
|
||
class OnBehalfUtils( | ||
private val securityQueryService: ISecurityQueryService, | ||
) { | ||
fun getOnBehalfUser(onBehalfRequest: OnBehalfRequest): SecurityUser { | ||
val request = onBehalfRequest.asRegisterRequest() | ||
return if (request.register) registerInactive(request) else securityQueryService.getUser(request.userEmail) | ||
fun getOnBehalfUser(request: OnBehalfRequest): SecurityUser { | ||
val register = request.register.orFalse() | ||
return if (register) registerInactive(request) else securityQueryService.getUser(request.userEmail) | ||
} | ||
|
||
private fun registerInactive(registerRequest: GetOrRegisterUserRequest): SecurityUser { | ||
private fun registerInactive(registerRequest: OnBehalfRequest): SecurityUser { | ||
requireNotNull(registerRequest.userName) { "A valid user name must be provided for registration" } | ||
return securityQueryService.getOrCreateInactive(registerRequest.userEmail, registerRequest.userName!!) | ||
return securityQueryService.getOrCreateInactive(registerRequest.userEmail, registerRequest.userName) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters