mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 05:47:05 +09:00
DROID-2279 Multiplayer | Enhancement | API and UX for changing member access rights (#950)
This commit is contained in:
parent
89b9e63109
commit
1362b52aa7
8 changed files with 208 additions and 4 deletions
|
@ -884,4 +884,23 @@ class BlockMiddleware(
|
|||
identity = identity
|
||||
)
|
||||
}
|
||||
|
||||
override suspend fun removeSpaceMembers(space: SpaceId, identities: List<Id>) {
|
||||
middleware.removeSpaceMembers(
|
||||
space = space,
|
||||
identities = identities
|
||||
)
|
||||
}
|
||||
|
||||
override suspend fun changeSpaceMemberPermissions(
|
||||
space: SpaceId,
|
||||
identity: Id,
|
||||
permission: ParticipantPermissions
|
||||
) {
|
||||
middleware.changeSpaceMemberPermissions(
|
||||
space = space,
|
||||
identity = identity,
|
||||
permission = permission
|
||||
)
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@ package com.anytypeio.anytype.middleware.interactor
|
|||
|
||||
import anytype.Rpc
|
||||
import anytype.model.Block
|
||||
import anytype.model.ParticipantPermissionChange
|
||||
import anytype.model.Range
|
||||
import com.anytypeio.anytype.core_models.AccountSetup
|
||||
import com.anytypeio.anytype.core_models.AccountStatus
|
||||
|
@ -2413,6 +2414,36 @@ class Middleware @Inject constructor(
|
|||
if (BuildConfig.DEBUG) logResponse(response)
|
||||
}
|
||||
|
||||
@Throws(Exception::class)
|
||||
fun removeSpaceMembers(
|
||||
space: SpaceId,
|
||||
identities: List<Id>
|
||||
) {
|
||||
val request = Rpc.Space.ParticipantRemove.Request(
|
||||
spaceId = space.id,
|
||||
identities = identities
|
||||
)
|
||||
if (BuildConfig.DEBUG) logRequest(request)
|
||||
val response = service.spaceParticipantRemove(request)
|
||||
if (BuildConfig.DEBUG) logResponse(response)
|
||||
}
|
||||
|
||||
@Throws(Exception::class)
|
||||
fun changeSpaceMemberPermissions(space: SpaceId, identity: Id, permission: ParticipantPermissions) {
|
||||
val request = Rpc.Space.ParticipantPermissionsChange.Request(
|
||||
spaceId = space.id,
|
||||
changes = listOf(
|
||||
ParticipantPermissionChange(
|
||||
identity = identity,
|
||||
perms = permission.toMw()
|
||||
)
|
||||
)
|
||||
)
|
||||
if (BuildConfig.DEBUG) logRequest(request)
|
||||
val response = service.spaceParticipantPermissionsChange(request)
|
||||
if (BuildConfig.DEBUG) logResponse(response)
|
||||
}
|
||||
|
||||
private fun logRequest(any: Any) {
|
||||
logger.logRequest(any).also {
|
||||
if (BuildConfig.DEBUG && threadInfo.isOnMainThread()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue