2
0
mirror of https://github.com/VinylDNS/vinyldns synced 2025-08-22 02:02:14 +00:00

Merge branch 'master' into aravindhr/add-auth-for-status

This commit is contained in:
Nicholas Spadaccino 2022-11-08 12:25:19 -05:00 committed by GitHub
commit 55c531944b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 2 deletions

View File

@ -94,7 +94,13 @@ class MembershipValidationsSpec
val nonSuperAuth = AuthPrincipal(user, Seq())
canSeeGroup(okGroup.id, nonSuperAuth) should be(right)
}
}
"User toString" should {
"not display access and secret keys" in {
val userString = s"""User: [id="ok"; userName="ok"; firstName="Some(ok)"; lastName="Some(ok)"; email="Some(test@test.com)"; created="${okUser.created}"; isSuper="false"; isSupport="false"; isTest="false"; lockStatus="Unlocked"; ]"""
okUser.toString shouldBe userString
}
}
"isGroupChangePresent" should {

View File

@ -51,6 +51,23 @@ final case class User(
def withEncryptedSecretKey(cryptoAlgebra: CryptoAlgebra): User =
copy(secretKey = cryptoAlgebra.encrypt(secretKey))
override def toString: String = {
val sb = new StringBuilder
sb.append("User: [")
sb.append("id=\"").append(id).append("\"; ")
sb.append("userName=\"").append(userName).append("\"; ")
sb.append("firstName=\"").append(firstName.toString).append("\"; ")
sb.append("lastName=\"").append(lastName.toString).append("\"; ")
sb.append("email=\"").append(email.toString).append("\"; ")
sb.append("created=\"").append(created).append("\"; ")
sb.append("isSuper=\"").append(isSuper).append("\"; ")
sb.append("isSupport=\"").append(isSupport).append("\"; ")
sb.append("isTest=\"").append(isTest).append("\"; ")
sb.append("lockStatus=\"").append(lockStatus.toString).append("\"; ")
sb.append("]")
sb.toString
}
}
object User {

View File

@ -160,7 +160,7 @@ trait TestApplicationData { this: Mockito =>
| "oldGroup": {},
| "id": "b6018a9b-c893-40e9-aa25-4ccfee460c18",
| "created": "2022-07-22T08:19:22Z",
| "userName": "$frodoUser",
| "userName": "${frodoUser.userName}",
| "groupChangeMessage": ""
| }
""".stripMargin)
@ -180,7 +180,7 @@ trait TestApplicationData { this: Mockito =>
| "oldGroup": {},
| "id": "b6018a9b-c893-40e9-aa25-4ccfee460c18",
| "created": "2022-07-22T08:19:22Z",
| "userName": "$frodoUser",
| "userName": "${frodoUser.userName}",
| "groupChangeMessage": ""
| }],
| "maxItems": 100