Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions demo/apps/settings.ini
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ INSTALLED_APPS = [
[MENUS]
MAINMENU = {
'subs':[
{'name': 'apijson', 'link':'/', 'title':u'APIJSON Demo'},
{'name': 'tables', 'link':'/tables', 'title':u'APIJSON tables'},
{'name': 'apijson', 'link':'/', 'title':u'requests demo'},
{'name': 'tables', 'link':'/tables', 'title':u'tables'},
]
}

[LAYOUT]
logo_lg = "Uliweb"
logo_lg = "uliweb-apijson"
logo_mini = "U"

[SESSION]
Expand Down
42 changes: 36 additions & 6 deletions uliweb_apijson/apijson/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

uliweb-apijson is a subset and slightly different variation of [apijson](https://github.com/TommyLemon/APIJSON/blob/master/Document.md)

# uliweb model configuration
# apijson model configuration

## example

Expand All @@ -11,21 +11,51 @@ uliweb-apijson is a subset and slightly different variation of [apijson](https:/
user = {
"user_id_field" : "id",
"secret_fields" : ["password"],
"rbac_get" : {
"roles" : ["ADMIN","OWNER"]
}
"GET" : { "roles" : ["ADMIN","OWNER"] },
"HEAD" : { "roles" : ["ADMIN","OWNER"] },
"POST" : { "roles" : ["ADMIN","OWNER"] },
"PUT" : { "roles" : ["ADMIN","OWNER"] },
"DELETE" : { "roles" : ["ADMIN","OWNER"] },
}
```

## document

settings.APIJSON_MODEL_CONFIG.[MODEL_NAME]
settings.APIJSON_MODELS.[MODEL_NAME]

| Field | Doc |
| ------------- | ---------------------------------------------------------- |
| user_id_field | Field name of user id, related to query user own data. |
| secret_fields | Secret fields won't be exposed. |
| rbac_get | Configure of roles or permissions for apijson 'get' method |
| GET/HEAD/POST/PUT/DELETE | Configure of roles or permissions for apijson methods |

# apijson request configuration

## example

```
[APIJSON_REQUESTS]
moment = {
"moment": {
"POST" :{
"ADD":{"@role": "OWNER"},
"DISALLOW" : ["id"],
"NECESSARY" : ["content"],
},
"PUT" :{
"ADD":{"@role": "OWNER"},
"NECESSARY" : ["id","content"],
},
}
}
```
## document

settings.APIJSON_REQUESTS.[TAG_NAME]

request types currently support: POST, PUT
request configuration currently support: ADD,DISALLOW,NECESSARY (still not fully support [all the configuration items](https://github.com/TommyLemon/APIJSON/wiki#%E5%AE%9E%E7%8E%B0%E5%8E%9F%E7%90%86))


# Supported API Examples

Expand Down