Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…into danmactough-maps

Conflicts:
	parser.js
	test/common.js
  • Loading branch information
Carlos Rodriguez committed May 5, 2014
2 parents 9e8d1ae + dd0373e commit 327811e
Show file tree
Hide file tree
Showing 7 changed files with 457 additions and 14 deletions.
62 changes: 60 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ relations.repos('Who is the owner of %s?', 'buffet', function (err, users) {
```

Object verb request
---------------------------
-------------------

To request an array of verbs a subject can perform on an object:

Expand All @@ -231,6 +231,48 @@ relations.repos('What actions can %s do with %s?', 'Carlos', 'buffet', function
What actions can <subject> do [ of / to / from / in / with ] <object> [?]
```

Object-Role map request
-----------------------

To get a map of object->role pairs for a subject:

```js
relations.repos('Describe what %s can do', 'Carlos', function (err, map) {
// map = { '': [ 'watcher' ],
'buffet': [ 'owner' ] }
});
```

### Syntax

```
[ Describe / detail / explain / get ] what <subject> can do [.]
```

Subject-Role map request
-----------------------

To get a map of subject->role pairs, optionally pertaining to an object:

```js
relations.repos('Get who can act', function (err, map) {
// map = { 'carlos': [ 'watcher' ],
'brian': [ 'watcher' ] }
});
```

```js
relations.repos('Explain who can act on %s', 'buffet', function (err, map) {
// map = { 'carlos': [ 'owner' ] }
});
```

### Syntax

```
[ Describe / detail / explain / get ] who can act [ on <object> ] [.]
```

Revocation
----------

Expand Down Expand Up @@ -368,13 +410,29 @@ the result. `cmd` will be an object containing the properties:

### `object-verb-request` (cmd, cb)

Respond to a object verb request and call `cb(err, /* array */ verbs)` with
Respond to an object verb request and call `cb(err, /* array */ verbs)` with
the result. `cmd` will be an object containing the properties:

- ctx - context object
- object
- subject

### `object-role-map-request` (cmd, cb)

Respond to an object-role map request and call `cb(err, /* object */ map)` with
the result. `cmd` will be an object containing the properties:

- ctx - context object
- subject

### `subject-role-map-request` (cmd, cb)

Respond to a subject-role map request and call `cb(err, /* object */ map)` with
the result. `cmd` will be an object containing the properties:

- ctx - context object
- object (optional)

### `reset` (cb)

Reset the store, dumping all storage and structure, calling `cb(err)` when done.
Expand Down
246 changes: 236 additions & 10 deletions parser.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 327811e

Please sign in to comment.