fixing a mess

This commit is contained in:
mdipierro
2014-08-09 01:02:58 -05:00
parent 24c0c3d129
commit e9ed69e7a9
29 changed files with 1382 additions and 267 deletions
+14 -15
View File
@@ -6,9 +6,12 @@
## - index is the default action of any application
## - user is required for authentication and authorization
## - download is for downloading files uploaded in the db (does streaming)
## - call exposes all registered services (none by default)
## - api is an example of Hypermedia API support and access control
#########################################################################
@auth.requires_login()
def manage():
return dict(grid = SQLFORM.grid(db.auth_user))
def index():
"""
@@ -39,6 +42,7 @@ def user():
"""
return dict(form=auth())
@cache.action()
def download():
"""
@@ -58,19 +62,14 @@ def call():
return service()
@auth.requires_signature()
def data():
@auth.requires_login()
def api():
"""
http://..../[app]/default/data/tables
http://..../[app]/default/data/create/[table]
http://..../[app]/default/data/read/[table]/[id]
http://..../[app]/default/data/update/[table]/[id]
http://..../[app]/default/data/delete/[table]/[id]
http://..../[app]/default/data/select/[table]
http://..../[app]/default/data/search/[table]
but URLs must be signed, i.e. linked with
A('table',_href=URL('data/tables',user_signature=True))
or with the signed load operator
LOAD('default','data.load',args='tables',ajax=True,user_signature=True)
this is example of API with access control
WEB2PY provides Hypermedia API (Collection+JSON) Experimental
"""
return dict(form=crud())
from gluon.contrib.hypermedia import Collection
rules = {
'<tablename>': {'GET':{},'POST':{},'PUT':{},'DELETE':{}},
}
return Collection(db).process(request,response,rules)