add contains, not_contains

This commit is contained in:
Stefan Schießl 2018-08-09 11:19:19 +02:00 committed by GitHub
parent 0919eae319
commit 78100ed43f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -103,6 +103,7 @@ List of possible restrictions are:
| `any` | [`list`, `of`, `allowed`, `values`] | stateless | | `any` | [`list`, `of`, `allowed`, `values`] | stateless |
| `none` | [`none`, `of`, `these`, `values`] | stateless | | `none` | [`none`, `of`, `these`, `values`] | stateless |
| `lt, le, gt, ge, eq` | `comparative` | stateless | | `lt, le, gt, ge, eq` | `comparative` | stateless |
| `contains, not_contains` | [`list`, `of`, `values`] | stateless |
| `limit` | [`max_cumsum`, `interval_in_sec`] | [`current_cumsum`, `interval_began`] | | `limit` | [`max_cumsum`, `interval_in_sec`] | [`current_cumsum`, `interval_began`] |
| `limit_monthly` | [`max_cumsum`, `interval_in_months`] | [`current_cumsum`, `interval_began`] | | `limit_monthly` | [`max_cumsum`, `interval_in_months`] | [`current_cumsum`, `interval_began`] |
| `attribute_assert` | list of restrictions | stateless | | `attribute_assert` | list of restrictions | stateless |
@ -140,6 +141,11 @@ The different asserts read as:
- `ge`: `Argument value` must be greater than or equal to `comparative` - `ge`: `Argument value` must be greater than or equal to `comparative`
- `eq`: `Argument value` must equal to `comparative` - `eq`: `Argument value` must equal to `comparative`
#### `contains, not_contains`
Stateless assert, for `list` type arguments.
- `contains`: The `argument value` must contain all items specified by `data`, but can contain more
- `not_contains`: The `argument value` must NOT contain any of the items specified by `data`, but can contain others
#### `limit` #### `limit`
Stateful assert, only `int` type arguments. When the authority is created, `interval_began` is set to `valid_from` from its custom active authority and `max_cumsum` to `0`. Incoming operations are first tried to match all stateless asserts, Stateful assert, only `int` type arguments. When the authority is created, `interval_began` is set to `valid_from` from its custom active authority and `max_cumsum` to `0`. Incoming operations are first tried to match all stateless asserts,
and if all passes continue with stateful asserts. If `now > interval_began + interval_in_sec`, then set `max_cumsum = 0` and set `interval_began = now`. and if all passes continue with stateful asserts. If `now > interval_began + interval_in_sec`, then set `max_cumsum = 0` and set `interval_began = now`.