Skip to content

Commit

Permalink
Added perm_reloadPermissionsFromFile
Browse files Browse the repository at this point in the history
  • Loading branch information
MadelineMurray authored and tmohay committed Feb 18, 2019
1 parent 3791486 commit 8fb9345
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 6 deletions.
22 changes: 16 additions & 6 deletions docs/Permissions/Permissioning.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,16 @@ A node with node whitelisting enabled communicates only with nodes in the nodes
Node whitelisting is at the node level. That is, each node in the network has a [`permissions_config.toml`](#permissions-configuration-file)
file in the [data directory](../Reference/Pantheon-CLI-Syntax.md#data-path) for the node.

To view or update the nodes whitelist when the node is running, use the JSON-RPC API methods:
To update the nodes whitelist when the node is running, use the JSON-RPC API methods:

* [perm_addNodesToWhitelist](../Reference/JSON-RPC-API-Methods.md#perm__addnodestowhitelist)
* [perm_removeNodesFromWhitelist](../Reference/JSON-RPC-API-Methods.md#perm_removeNodesFromWhiteList)
* [perm_getNodesWhitelist](../Reference/JSON-RPC-API-Methods.md#perm_getNodesWhiteList)

Alternatively, update the [`permissions_config.toml`](#permissions-configuration-file) file directly and use the
[`perm_reloadPermissionsFromFile`](../Reference/JSON-RPC-API-Methods.md#perm_reloadpermissionsfromfile) method
to update the whitelists.

To view the nodes whitelist, use the [perm_getNodesWhitelist](../Reference/JSON-RPC-API-Methods.md#perm_getNodesWhiteList) method.

!!! note
Each node has a `permissions_config.toml` file which means nodes can have different nodes whitelists.
Expand Down Expand Up @@ -103,11 +108,16 @@ can synchronise and add blocks containing transactions from accounts that are no
On-chain permissioning is under development. On-chain permissioning will use one on-chain
nodes whitelist.

To view or update the accounts whitelist when the node is running, use the JSON-RPC API methods:
To update the accounts whitelist when the node is running, use the JSON-RPC API methods:

* [`perm_addAccountsToWhitelist`](../Reference/JSON-RPC-API-Methods.md#perm_addAccountsToWhitelist)
* [`perm_removeAccountsFromWhitelist`](../Reference/JSON-RPC-API-Methods.md#perm_removeAccountsFromWhitelist)

Alternatively, update the [`permissions_config.toml`](#permissions-configuration-file) file directly and use the
[`perm_reloadPermissionsFromFile`](../Reference/JSON-RPC-API-Methods.md#perm_reloadpermissionsfromfile) method
to update the whitelists.

* [perm_addAccountsToWhitelist](../Reference/JSON-RPC-API-Methods.md#perm_addAccountsToWhitelist)
* [perm_removeAccountsFromWhitelist](../Reference/JSON-RPC-API-Methods.md#perm_removeAccountsFromWhitelist)
* [perm_getAccountsWhitelist](../Reference/JSON-RPC-API-Methods.md#perm_getAccountsWhitelist)
To view the accounts whitelist, use the [`perm_getAccountsWhitelist`](../Reference/JSON-RPC-API-Methods.md#perm_getAccountsWhitelist) method.

### Enabling Account Whitelisting

Expand Down
29 changes: 29 additions & 0 deletions docs/Reference/JSON-RPC-API-Methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -2386,6 +2386,35 @@ including invalid enode URLs.
{"jsonrpc":"2.0","method":"perm_removeNodesFromWhitelist","params":[["enode://7e4ef30e9ec683f26ad76ffca5b5148fa7a6575f4cfad4eb0f52f9c3d8335f4a9b6f9e66fcc73ef95ed7a2a52784d4f372e7750ac8ae0b544309a5b391a23dd7@127.0.0.1:30303","enode://2feb33b3c6c4a8f77d84a5ce44954e83e5f163e7a65f7f7a7fec499ceb0ddd76a46ef635408c513d64c076470eac86b7f2c8ae4fcd112cb28ce82c0d64ec2c94@127.0.0.1:30304"]], "id":1}
```

```json tab="JSON result"
{
"jsonrpc": "2.0",
"id": 1,
"result": "Success"
}
```

### perm_reloadPermissionsFromFile

Reloads the accounts and nodes whitelists from the [permissions configuration file](../Permissions/Permissioning.md#permissions-configuration-file).

**Parameters**

None

**Returns**

`result` - `Success` or `error` if the permissions configuration file is not valid.

!!! example
```bash tab="curl HTTP request"
$ curl -X POST --data '{"jsonrpc":"2.0","method":"perm_reloadPermissionsFromFile","params":[], "id":1}' <JSON-RPC-http-endpoint:port>
```

```bash tab="wscat WS request"
{"jsonrpc":"2.0","method":"perm_reloadPermissionsFromFile","params":[], "id":1}
```

```json tab="JSON result"
{
"jsonrpc": "2.0",
Expand Down

0 comments on commit 8fb9345

Please sign in to comment.