Fossil SCM

minor cleanup to the last commit, added a TODO note.

stephan 2011-11-04 17:13 json-multitag-test
Commit 14ed7070674729a3724141d8591f029169323a8f
1 file changed +10 -6
+10 -6
--- src/json_user.c
+++ src/json_user.c
@@ -186,10 +186,14 @@
186186
}
187187
}
188188
/*
189189
Todo: reserve the uid=-1 to mean that the user should be created
190190
by this request.
191
+
192
+ Todo: when changing an existing user's name we need to invalidate
193
+ or recalculate the login hash because the user's name is part of
194
+ the hash.
191195
*/
192196
193197
/* Maintenance note: all error-returns from here on out should go
194198
via goto error in order to clean up.
195199
*/
@@ -295,19 +299,19 @@
295299
PROP("password");
296300
PROP("info");
297301
PROP("capabilities");
298302
#undef PROP
299303
300
-#define PROP(LK) b = json_find_option_bool(LK,NULL,NULL,-1); \
301
- if(b>=0){ cson_object_set(u, LK, cson_value_new_bool(b)); } (void)0
302
- PROP("forceLogout");
304
+#define PROP(LK,DFLT) b = json_find_option_bool(LK,NULL,NULL,DFLT); \
305
+ if(DFLT!=b){ cson_object_set(u, LK, cson_value_new_bool(b)); } (void)0
306
+ PROP("forceLogout",-1);
303307
#undef PROP
304308
305
-#define PROP(LK) i = json_find_option_int(LK,NULL,NULL,-1); \
306
- if(i>=0){ cson_object_set(u, LK, cson_value_new_integer(i)); } (void)0
307
- PROP("uid");
309
+#define PROP(LK,DFLT) i = json_find_option_int(LK,NULL,NULL,DFLT); \
310
+ if(DFLT != i){ cson_object_set(u, LK, cson_value_new_integer(i)); } (void)0
311
+ PROP("uid",-99);
308312
#undef PROP
309313
json_user_update_from_json( u );
310314
cson_free_object(u);
311315
}
312316
return NULL;
313317
}
314318
--- src/json_user.c
+++ src/json_user.c
@@ -186,10 +186,14 @@
186 }
187 }
188 /*
189 Todo: reserve the uid=-1 to mean that the user should be created
190 by this request.
 
 
 
 
191 */
192
193 /* Maintenance note: all error-returns from here on out should go
194 via goto error in order to clean up.
195 */
@@ -295,19 +299,19 @@
295 PROP("password");
296 PROP("info");
297 PROP("capabilities");
298 #undef PROP
299
300 #define PROP(LK) b = json_find_option_bool(LK,NULL,NULL,-1); \
301 if(b>=0){ cson_object_set(u, LK, cson_value_new_bool(b)); } (void)0
302 PROP("forceLogout");
303 #undef PROP
304
305 #define PROP(LK) i = json_find_option_int(LK,NULL,NULL,-1); \
306 if(i>=0){ cson_object_set(u, LK, cson_value_new_integer(i)); } (void)0
307 PROP("uid");
308 #undef PROP
309 json_user_update_from_json( u );
310 cson_free_object(u);
311 }
312 return NULL;
313 }
314
--- src/json_user.c
+++ src/json_user.c
@@ -186,10 +186,14 @@
186 }
187 }
188 /*
189 Todo: reserve the uid=-1 to mean that the user should be created
190 by this request.
191
192 Todo: when changing an existing user's name we need to invalidate
193 or recalculate the login hash because the user's name is part of
194 the hash.
195 */
196
197 /* Maintenance note: all error-returns from here on out should go
198 via goto error in order to clean up.
199 */
@@ -295,19 +299,19 @@
299 PROP("password");
300 PROP("info");
301 PROP("capabilities");
302 #undef PROP
303
304 #define PROP(LK,DFLT) b = json_find_option_bool(LK,NULL,NULL,DFLT); \
305 if(DFLT!=b){ cson_object_set(u, LK, cson_value_new_bool(b)); } (void)0
306 PROP("forceLogout",-1);
307 #undef PROP
308
309 #define PROP(LK,DFLT) i = json_find_option_int(LK,NULL,NULL,DFLT); \
310 if(DFLT != i){ cson_object_set(u, LK, cson_value_new_integer(i)); } (void)0
311 PROP("uid",-99);
312 #undef PROP
313 json_user_update_from_json( u );
314 cson_free_object(u);
315 }
316 return NULL;
317 }
318

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button