Exclude current user principal from sharees

pull/1392/head
Alex Baker 3 years ago
parent 952fa69b05
commit 7ce4f03985

@ -130,6 +130,7 @@ class SharingSabredavTest : CaldavTest() {
<d:resourcetype>
<d:collection />
<cal:calendar />
<cs:shared-owner />
</d:resourcetype>
<d:displayname>Shared</d:displayname>
<cal:supported-calendar-component-set>
@ -141,6 +142,14 @@ class SharingSabredavTest : CaldavTest() {
<d:shared-owner />
</d:share-access>
<d:invite>
<d:sharee>
<d:href>/principals/user1</d:href>
<d:prop />
<d:share-access>
<d:shared-owner />
</d:share-access>
<d:invite-accepted />
</d:sharee>
<d:sharee>
<d:href>mailto:user@example.com</d:href>
<d:prop>

@ -357,16 +357,17 @@ class CaldavSynchronizer @Inject constructor(
}
val Response.isOwncloudOwner: Boolean
get() = this[OCOwnerPrincipal::class.java]?.owner
?.let {
this[CurrentUserPrincipal::class.java]?.href?.endsWith("$it/") == true
}
?: false
get() = this[OCOwnerPrincipal::class.java]?.owner?.let { isCurrentUser(it) } ?: false
fun Response.isCurrentUser(href: String) =
this[CurrentUserPrincipal::class.java]?.href?.endsWith("$href/") == true
val Response.principals: List<Principal>
get() {
val principals = ArrayList<Principal>()
this[Invite::class.java]?.sharees
this[Invite::class.java]
?.sharees
?.filterNot { isCurrentUser(it.href) }
?.map {
Principal().apply {
principal = it.href

Loading…
Cancel
Save