1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-11-05 03:55:58 +01:00

Certification toString improvements

- Detect delegations based on depth
- Add scope regexes for delegations
This commit is contained in:
Heiko Schaefer 2023-06-29 00:32:17 +02:00 committed by Paul Schaub
parent d413506c89
commit 7032fe4a97
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311

View file

@ -49,9 +49,11 @@ data class Certification(
this(issuer, target, targetUserId, creationTime, null, true, 120, Depth.limited(0), RegexSet.wildcard())
override fun toString(): String {
return if (userId != null)
"$issuer certifies [$userId] ${target.fingerprint}"
else
"$issuer delegates to ${target.fingerprint}"
return if (trustDepth.limit == 0)
"${issuer.fingerprint} certifies binding: $userId <-> ${target.fingerprint} [$trustAmount]"
else {
val scope = if (regexes.regexStrings.isEmpty()) "" else ", scope: $regexes"
"${issuer.fingerprint} delegates to ${target.fingerprint} [$trustAmount, depth $trustDepth$scope]"
}
}
}