[ENT-850]: RPC function to kill a flow (#215)

* Tentative API and implementation.

* Tests completed. API update needed.

* Updated api-current.txt. Some previous changes hadn't been reflected and now they are.

* Improved the tests.

* Some code review changes.

* Merge branch 'master' into features/ENT-850

# Conflicts:
#	.ci/api-current.txt

* Code review changes.

* Code review changes.
This commit is contained in:
Michele Sollecito
2017-12-20 19:16:54 +00:00
committed by GitHub
parent d9574338bc
commit 0711ad34e3
11 changed files with 153 additions and 12 deletions

View File

@ -1,9 +1,6 @@
package net.corda.client.rpc
import net.corda.core.flows.FlowLogic
import net.corda.core.messaging.CordaRPCOps
import net.corda.core.messaging.RPCOps
import net.corda.node.services.Permissions
import net.corda.node.services.messaging.rpcContext
import net.corda.nodeapi.internal.config.User
import net.corda.testing.node.internal.RPCDriverDSL
@ -122,6 +119,17 @@ class RPCPermissionsTests : AbstractRPCTest() {
}
}
@Test
fun `killing flows requires permission`() {
rpcDriver {
val proxy = testProxyFor(userOf("joe", emptySet()))
assertNotAllowed {
proxy.validatePermission("killFlow")
}
}
}
private fun assertNotAllowed(action: () -> Unit) {
assertFailsWith(PermissionException::class, "User should not be allowed to perform this action.", action)