Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | restructured /json/cap output. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | json |
Files: | files | file ages | folders |
SHA1: |
7e3902d14f3e31bf8b989f6e3f0fbb7d |
User & Date: | stephan 2011-09-16 21:39:52.770 |
Context
2011-09-16
| ||
23:06 | worked around a weird cgi_parameter() bug. We are now not processing the name/password params with the precedence i would like, but it works now in server/cgi modes with GET and POST. ... (check-in: b0885e86 user: stephan tags: json) | |
21:39 | restructured /json/cap output. ... (check-in: 7e3902d1 user: stephan tags: json) | |
19:27 | implemented /json/logout. ... (check-in: e94605b5 user: stephan tags: json) | |
Changes
Changes to src/json.c.
︙ | ︙ | |||
680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 | ** current user (what he may/may not do). ** ** This is primarily intended for debuggering, but may have ** a use in client code. (?) */ cson_value * json_page_cap(void){ cson_value * payload = cson_value_new_object(); cson_object * obj = cson_value_get_object(payload); #define ADD(X) cson_object_set(obj, #X, cson_value_new_bool(g.perm.X)) ADD(Setup); ADD(Admin); ADD(Delete); ADD(Password); ADD(Query); ADD(Write); | > > > > > > > > > > > > > > > > > > > | 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 | ** current user (what he may/may not do). ** ** This is primarily intended for debuggering, but may have ** a use in client code. (?) */ cson_value * json_page_cap(void){ cson_value * payload = cson_value_new_object(); cson_value * sub = cson_value_new_object(); char * zCap; Stmt q; cson_object * obj = cson_value_get_object(payload); if( g.zLogin ){ cson_object_set( obj, "userName", cson_value_new_string(g.zLogin,strlen(g.zLogin)) ); } db_prepare(&q, "SELECT cap FROM user WHERE uid=%d", g.userUid); if( db_step(&q)==SQLITE_ROW ){ char const * zCap = (char const *)sqlite3_column_text(q.pStmt,0); if( zCap ){ cson_object_set( obj, "capabilities", cson_value_new_string(zCap,strlen(zCap)) ); } } db_finalize(&q); cson_object_set( obj, "permissionFlags", sub ); obj = cson_value_get_object(sub); #define ADD(X) cson_object_set(obj, #X, cson_value_new_bool(g.perm.X)) ADD(Setup); ADD(Admin); ADD(Delete); ADD(Password); ADD(Query); ADD(Write); |
︙ | ︙ |