Skip to content

Commit

Permalink
fix(PnX-SI/gn_mobile_occtax#258): user's first name may be null (and …
Browse files Browse the repository at this point in the history
…it shouldn't be)...
  • Loading branch information
sgrimault committed Jun 18, 2024
1 parent ae3dd3f commit 356b79d
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion datasync/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
id 'org.jetbrains.kotlin.android'
}

version = "0.6.0"
version = "0.6.1"

android {
namespace 'fr.geonature.datasync'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import com.google.gson.annotations.SerializedName
/**
* Authenticated user.
*
* @author [S. Grimault](mailto:sebastien.grimault@gmail.com)
* @author S. Grimault
*/
class AuthUser(
id: Long,
lastname: String,
firstname: String,
firstname: String?,

@SerializedName("id_application")
val applicationId: Int,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.google.gson.annotations.SerializedName
/**
* GeoNature User definition.
*
* @author [S. Grimault](mailto:sebastien.grimault@gmail.com)
* @author S. Grimault
*/
open class User(
@SerializedName("id_role")
Expand All @@ -15,7 +15,7 @@ open class User(
val lastname: String,

@SerializedName("prenom_role")
val firstname: String
val firstname: String?
) {

override fun equals(other: Any?): Boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ class AuthManagerImpl(
(if (response.isSuccessful) response
.body()
?.let {
if (it.user.login.isBlank() || it.user.lastname.isBlank() || it.user.firstname.isBlank()) {
Logger.warn { "invalid user: ${if (it.user.login.isBlank()) "missing 'login' attribute" else if (it.user.lastname.isBlank()) "missing 'lastname' attribute" else "missing 'firstname' attribute"}" }
if (it.user.login.isBlank() || it.user.lastname.isBlank()) {
Logger.warn { "invalid user: ${if (it.user.login.isBlank()) "missing 'login' attribute" else "missing 'lastname' attribute"}" }
Either.Left(AuthFailure.InvalidUserFailure)
} else Either.Right(it)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class AuthLoginJsonReader {

reader.endObject()

if (id == null || lastname.isNullOrBlank() || firstname.isNullOrBlank() || applicationId == null || organismId == null || login.isNullOrBlank()) {
if (id == null || lastname.isNullOrBlank() || applicationId == null || organismId == null || login.isNullOrBlank()) {
return null
}

Expand Down
4 changes: 2 additions & 2 deletions datasync/version.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#Sun May 12 14:00:50 CEST 2024
VERSION_CODE=1220
#Tue Jun 18 19:19:14 CEST 2024
VERSION_CODE=1225

0 comments on commit 356b79d

Please sign in to comment.