mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-12-25 12:27:58 +01:00
Cherry-picked baa9d10fd2b1e8e07253f4f3576cfb5fff875c44
This commit is contained in:
parent
44774ac727
commit
f973065f06
2 changed files with 7 additions and 14 deletions
|
@ -49,16 +49,9 @@ data class Certification(
|
||||||
this(issuer, target, targetUserId, creationTime, null, true, 120, Depth.limited(0), RegexSet.wildcard())
|
this(issuer, target, targetUserId, creationTime, null, true, 120, Depth.limited(0), RegexSet.wildcard())
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
val relation = if (userId != null) {
|
return if (userId != null)
|
||||||
"certifies"
|
"$issuer certifies [$userId] ${target.fingerprint}"
|
||||||
} else {
|
else
|
||||||
"delegates to"
|
"$issuer delegates to ${target.fingerprint}"
|
||||||
}
|
|
||||||
val relationTarget = if (userId != null) {
|
|
||||||
"[$userId] ${target.fingerprint}"
|
|
||||||
} else {
|
|
||||||
"$target"
|
|
||||||
}
|
|
||||||
return "$issuer $relation $relationTarget"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -39,7 +39,7 @@ data class CertificationSet(
|
||||||
* @param certification certification
|
* @param certification certification
|
||||||
*/
|
*/
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun fromCertification(certification: Certification) : CertificationSet {
|
fun fromCertification(certification: Certification): CertificationSet {
|
||||||
val set = empty(certification.issuer, certification.target)
|
val set = empty(certification.issuer, certification.target)
|
||||||
set.add(certification)
|
set.add(certification)
|
||||||
return set
|
return set
|
||||||
|
@ -72,7 +72,7 @@ data class CertificationSet(
|
||||||
*
|
*
|
||||||
* @param certification [Certification] with the same issuer fingerprint and target fingerprint as this object.
|
* @param certification [Certification] with the same issuer fingerprint and target fingerprint as this object.
|
||||||
*/
|
*/
|
||||||
fun add(certification : Certification) {
|
fun add(certification: Certification) {
|
||||||
require(issuer.fingerprint == certification.issuer.fingerprint) { "Issuer fingerprint mismatch." }
|
require(issuer.fingerprint == certification.issuer.fingerprint) { "Issuer fingerprint mismatch." }
|
||||||
require(target.fingerprint == certification.target.fingerprint) { "Target fingerprint mismatch." }
|
require(target.fingerprint == certification.target.fingerprint) { "Target fingerprint mismatch." }
|
||||||
|
|
||||||
|
@ -85,6 +85,6 @@ data class CertificationSet(
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
return "$certifications"
|
return certifications.map { it.value }.flatten().joinToString("\n")
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue