Fossil SCM

Merge the refactored permission flags into trunk.

drh 2011-09-14 18:08 trunk merge
Commit b344d3c0cdf0bd179b70a3660b1d4f397e94cb57
+10 -10
--- src/attach.c
+++ src/attach.c
@@ -46,19 +46,19 @@
4646
"SELECT datetime(mtime,'localtime'), src, target, filename, comment, user"
4747
" FROM attachment",
4848
-1
4949
);
5050
if( zPage ){
51
- if( g.okRdWiki==0 ) login_needed();
51
+ if( g.perm.RdWiki==0 ) login_needed();
5252
style_header("Attachments To %h", zPage);
5353
blob_appendf(&sql, " WHERE target=%Q", zPage);
5454
}else if( zTkt ){
55
- if( g.okRdTkt==0 ) login_needed();
55
+ if( g.perm.RdTkt==0 ) login_needed();
5656
style_header("Attachments To Ticket %.10s", zTkt);
5757
blob_appendf(&sql, " WHERE target GLOB '%q*'", zTkt);
5858
}else{
59
- if( g.okRdTkt==0 && g.okRdWiki==0 ) login_needed();
59
+ if( g.perm.RdTkt==0 && g.perm.RdWiki==0 ) login_needed();
6060
style_header("All Attachments");
6161
}
6262
blob_appendf(&sql, " ORDER BY mtime DESC");
6363
db_prepare(&q, "%s", blob_str(&sql));
6464
while( db_step(&q)==SQLITE_ROW ){
@@ -139,14 +139,14 @@
139139
140140
if( zPage && zTkt ) zTkt = 0;
141141
if( zFile==0 ) fossil_redirect_home();
142142
login_check_credentials();
143143
if( zPage ){
144
- if( g.okRdWiki==0 ) login_needed();
144
+ if( g.perm.RdWiki==0 ) login_needed();
145145
zTarget = zPage;
146146
}else if( zTkt ){
147
- if( g.okRdTkt==0 ) login_needed();
147
+ if( g.perm.RdTkt==0 ) login_needed();
148148
zTarget = zTkt;
149149
}else{
150150
fossil_redirect_home();
151151
}
152152
if( attachid>0 ){
@@ -172,11 +172,11 @@
172172
style_header("Missing");
173173
@ Attachment has been deleted
174174
style_footer();
175175
return;
176176
}
177
- g.okRead = 1;
177
+ g.perm.Read = 1;
178178
cgi_replace_parameter("name",zUUID);
179179
if( fossil_strcmp(g.zPath,"attachview")==0 ){
180180
artifact_page();
181181
}else{
182182
cgi_replace_parameter("m", mimetype_from_name(zFile));
@@ -207,19 +207,19 @@
207207
if( P("cancel") ) cgi_redirect(zFrom);
208208
if( zPage && zTkt ) fossil_redirect_home();
209209
if( zPage==0 && zTkt==0 ) fossil_redirect_home();
210210
login_check_credentials();
211211
if( zPage ){
212
- if( g.okApndWiki==0 || g.okAttach==0 ) login_needed();
212
+ if( g.perm.ApndWiki==0 || g.perm.Attach==0 ) login_needed();
213213
if( !db_exists("SELECT 1 FROM tag WHERE tagname='wiki-%q'", zPage) ){
214214
fossil_redirect_home();
215215
}
216216
zTarget = zPage;
217217
zTargetType = mprintf("Wiki Page <a href=\"%s/wiki?name=%h\">%h</a>",
218218
g.zTop, zPage, zPage);
219219
}else{
220
- if( g.okApndTkt==0 || g.okAttach==0 ) login_needed();
220
+ if( g.perm.ApndTkt==0 || g.perm.Attach==0 ) login_needed();
221221
if( !db_exists("SELECT 1 FROM tag WHERE tagname='tkt-%q'", zTkt) ){
222222
zTkt = db_text(0, "SELECT substr(tagname,5) FROM tag"
223223
" WHERE tagname GLOB 'tkt-%q*'", zTkt);
224224
if( zTkt==0 ) fossil_redirect_home();
225225
}
@@ -313,14 +313,14 @@
313313
if( zPage && zTkt ) fossil_redirect_home();
314314
if( zPage==0 && zTkt==0 ) fossil_redirect_home();
315315
if( zFile==0 ) fossil_redirect_home();
316316
login_check_credentials();
317317
if( zPage ){
318
- if( g.okWrWiki==0 || g.okAttach==0 ) login_needed();
318
+ if( g.perm.WrWiki==0 || g.perm.Attach==0 ) login_needed();
319319
zTarget = zPage;
320320
}else{
321
- if( g.okWrTkt==0 || g.okAttach==0 ) login_needed();
321
+ if( g.perm.WrTkt==0 || g.perm.Attach==0 ) login_needed();
322322
zTarget = zTkt;
323323
}
324324
if( zFrom==0 ) zFrom = mprintf("%s/home", g.zTop);
325325
if( P("cancel") ){
326326
cgi_redirect(zFrom);
327327
--- src/attach.c
+++ src/attach.c
@@ -46,19 +46,19 @@
46 "SELECT datetime(mtime,'localtime'), src, target, filename, comment, user"
47 " FROM attachment",
48 -1
49 );
50 if( zPage ){
51 if( g.okRdWiki==0 ) login_needed();
52 style_header("Attachments To %h", zPage);
53 blob_appendf(&sql, " WHERE target=%Q", zPage);
54 }else if( zTkt ){
55 if( g.okRdTkt==0 ) login_needed();
56 style_header("Attachments To Ticket %.10s", zTkt);
57 blob_appendf(&sql, " WHERE target GLOB '%q*'", zTkt);
58 }else{
59 if( g.okRdTkt==0 && g.okRdWiki==0 ) login_needed();
60 style_header("All Attachments");
61 }
62 blob_appendf(&sql, " ORDER BY mtime DESC");
63 db_prepare(&q, "%s", blob_str(&sql));
64 while( db_step(&q)==SQLITE_ROW ){
@@ -139,14 +139,14 @@
139
140 if( zPage && zTkt ) zTkt = 0;
141 if( zFile==0 ) fossil_redirect_home();
142 login_check_credentials();
143 if( zPage ){
144 if( g.okRdWiki==0 ) login_needed();
145 zTarget = zPage;
146 }else if( zTkt ){
147 if( g.okRdTkt==0 ) login_needed();
148 zTarget = zTkt;
149 }else{
150 fossil_redirect_home();
151 }
152 if( attachid>0 ){
@@ -172,11 +172,11 @@
172 style_header("Missing");
173 @ Attachment has been deleted
174 style_footer();
175 return;
176 }
177 g.okRead = 1;
178 cgi_replace_parameter("name",zUUID);
179 if( fossil_strcmp(g.zPath,"attachview")==0 ){
180 artifact_page();
181 }else{
182 cgi_replace_parameter("m", mimetype_from_name(zFile));
@@ -207,19 +207,19 @@
207 if( P("cancel") ) cgi_redirect(zFrom);
208 if( zPage && zTkt ) fossil_redirect_home();
209 if( zPage==0 && zTkt==0 ) fossil_redirect_home();
210 login_check_credentials();
211 if( zPage ){
212 if( g.okApndWiki==0 || g.okAttach==0 ) login_needed();
213 if( !db_exists("SELECT 1 FROM tag WHERE tagname='wiki-%q'", zPage) ){
214 fossil_redirect_home();
215 }
216 zTarget = zPage;
217 zTargetType = mprintf("Wiki Page <a href=\"%s/wiki?name=%h\">%h</a>",
218 g.zTop, zPage, zPage);
219 }else{
220 if( g.okApndTkt==0 || g.okAttach==0 ) login_needed();
221 if( !db_exists("SELECT 1 FROM tag WHERE tagname='tkt-%q'", zTkt) ){
222 zTkt = db_text(0, "SELECT substr(tagname,5) FROM tag"
223 " WHERE tagname GLOB 'tkt-%q*'", zTkt);
224 if( zTkt==0 ) fossil_redirect_home();
225 }
@@ -313,14 +313,14 @@
313 if( zPage && zTkt ) fossil_redirect_home();
314 if( zPage==0 && zTkt==0 ) fossil_redirect_home();
315 if( zFile==0 ) fossil_redirect_home();
316 login_check_credentials();
317 if( zPage ){
318 if( g.okWrWiki==0 || g.okAttach==0 ) login_needed();
319 zTarget = zPage;
320 }else{
321 if( g.okWrTkt==0 || g.okAttach==0 ) login_needed();
322 zTarget = zTkt;
323 }
324 if( zFrom==0 ) zFrom = mprintf("%s/home", g.zTop);
325 if( P("cancel") ){
326 cgi_redirect(zFrom);
327
--- src/attach.c
+++ src/attach.c
@@ -46,19 +46,19 @@
46 "SELECT datetime(mtime,'localtime'), src, target, filename, comment, user"
47 " FROM attachment",
48 -1
49 );
50 if( zPage ){
51 if( g.perm.RdWiki==0 ) login_needed();
52 style_header("Attachments To %h", zPage);
53 blob_appendf(&sql, " WHERE target=%Q", zPage);
54 }else if( zTkt ){
55 if( g.perm.RdTkt==0 ) login_needed();
56 style_header("Attachments To Ticket %.10s", zTkt);
57 blob_appendf(&sql, " WHERE target GLOB '%q*'", zTkt);
58 }else{
59 if( g.perm.RdTkt==0 && g.perm.RdWiki==0 ) login_needed();
60 style_header("All Attachments");
61 }
62 blob_appendf(&sql, " ORDER BY mtime DESC");
63 db_prepare(&q, "%s", blob_str(&sql));
64 while( db_step(&q)==SQLITE_ROW ){
@@ -139,14 +139,14 @@
139
140 if( zPage && zTkt ) zTkt = 0;
141 if( zFile==0 ) fossil_redirect_home();
142 login_check_credentials();
143 if( zPage ){
144 if( g.perm.RdWiki==0 ) login_needed();
145 zTarget = zPage;
146 }else if( zTkt ){
147 if( g.perm.RdTkt==0 ) login_needed();
148 zTarget = zTkt;
149 }else{
150 fossil_redirect_home();
151 }
152 if( attachid>0 ){
@@ -172,11 +172,11 @@
172 style_header("Missing");
173 @ Attachment has been deleted
174 style_footer();
175 return;
176 }
177 g.perm.Read = 1;
178 cgi_replace_parameter("name",zUUID);
179 if( fossil_strcmp(g.zPath,"attachview")==0 ){
180 artifact_page();
181 }else{
182 cgi_replace_parameter("m", mimetype_from_name(zFile));
@@ -207,19 +207,19 @@
207 if( P("cancel") ) cgi_redirect(zFrom);
208 if( zPage && zTkt ) fossil_redirect_home();
209 if( zPage==0 && zTkt==0 ) fossil_redirect_home();
210 login_check_credentials();
211 if( zPage ){
212 if( g.perm.ApndWiki==0 || g.perm.Attach==0 ) login_needed();
213 if( !db_exists("SELECT 1 FROM tag WHERE tagname='wiki-%q'", zPage) ){
214 fossil_redirect_home();
215 }
216 zTarget = zPage;
217 zTargetType = mprintf("Wiki Page <a href=\"%s/wiki?name=%h\">%h</a>",
218 g.zTop, zPage, zPage);
219 }else{
220 if( g.perm.ApndTkt==0 || g.perm.Attach==0 ) login_needed();
221 if( !db_exists("SELECT 1 FROM tag WHERE tagname='tkt-%q'", zTkt) ){
222 zTkt = db_text(0, "SELECT substr(tagname,5) FROM tag"
223 " WHERE tagname GLOB 'tkt-%q*'", zTkt);
224 if( zTkt==0 ) fossil_redirect_home();
225 }
@@ -313,14 +313,14 @@
313 if( zPage && zTkt ) fossil_redirect_home();
314 if( zPage==0 && zTkt==0 ) fossil_redirect_home();
315 if( zFile==0 ) fossil_redirect_home();
316 login_check_credentials();
317 if( zPage ){
318 if( g.perm.WrWiki==0 || g.perm.Attach==0 ) login_needed();
319 zTarget = zPage;
320 }else{
321 if( g.perm.WrTkt==0 || g.perm.Attach==0 ) login_needed();
322 zTarget = zTkt;
323 }
324 if( zFrom==0 ) zFrom = mprintf("%s/home", g.zTop);
325 if( P("cancel") ){
326 cgi_redirect(zFrom);
327
+4 -4
--- src/branch.c
+++ src/branch.c
@@ -286,11 +286,11 @@
286286
int showClosed = P("closed")!=0;
287287
int showAll = P("all")!=0;
288288
int colorTest = P("colortest")!=0;
289289
290290
login_check_credentials();
291
- if( !g.okRead ){ login_needed(); return; }
291
+ if( !g.perm.Read ){ login_needed(); return; }
292292
if( colorTest ){
293293
showClosed = 0;
294294
showAll = 1;
295295
}
296296
@@ -348,11 +348,11 @@
348348
}
349349
if( colorTest ){
350350
const char *zColor = hash_color(zBr);
351351
@ <li><span style="background-color: %s(zColor)">
352352
@ %h(zBr) &rarr; %s(zColor)</span></li>
353
- }else if( g.okHistory ){
353
+ }else if( g.perm.History ){
354354
@ <li><a href="%s(g.zTop)/timeline?r=%T(zBr)")>%h(zBr)</a></li>
355355
}else{
356356
@ <li><b>%h(zBr)</b></li>
357357
}
358358
}
@@ -374,11 +374,11 @@
374374
** the timeline of a "brlist" page. Add some additional hyperlinks
375375
** to the end of the line.
376376
*/
377377
static void brtimeline_extra(int rid){
378378
Stmt q;
379
- if( !g.okHistory ) return;
379
+ if( !g.perm.History ) return;
380380
db_prepare(&q,
381381
"SELECT substr(tagname,5) FROM tagxref, tag"
382382
" WHERE tagxref.rid=%d"
383383
" AND tagxref.tagid=tag.tagid"
384384
" AND tagxref.tagtype>0"
@@ -399,11 +399,11 @@
399399
*/
400400
void brtimeline_page(void){
401401
Stmt q;
402402
403403
login_check_credentials();
404
- if( !g.okRead ){ login_needed(); return; }
404
+ if( !g.perm.Read ){ login_needed(); return; }
405405
406406
style_header("Branches");
407407
style_submenu_element("List", "List", "brlist");
408408
login_anonymous_available();
409409
@ <h2>The initial check-in for each branch:</h2>
410410
--- src/branch.c
+++ src/branch.c
@@ -286,11 +286,11 @@
286 int showClosed = P("closed")!=0;
287 int showAll = P("all")!=0;
288 int colorTest = P("colortest")!=0;
289
290 login_check_credentials();
291 if( !g.okRead ){ login_needed(); return; }
292 if( colorTest ){
293 showClosed = 0;
294 showAll = 1;
295 }
296
@@ -348,11 +348,11 @@
348 }
349 if( colorTest ){
350 const char *zColor = hash_color(zBr);
351 @ <li><span style="background-color: %s(zColor)">
352 @ %h(zBr) &rarr; %s(zColor)</span></li>
353 }else if( g.okHistory ){
354 @ <li><a href="%s(g.zTop)/timeline?r=%T(zBr)")>%h(zBr)</a></li>
355 }else{
356 @ <li><b>%h(zBr)</b></li>
357 }
358 }
@@ -374,11 +374,11 @@
374 ** the timeline of a "brlist" page. Add some additional hyperlinks
375 ** to the end of the line.
376 */
377 static void brtimeline_extra(int rid){
378 Stmt q;
379 if( !g.okHistory ) return;
380 db_prepare(&q,
381 "SELECT substr(tagname,5) FROM tagxref, tag"
382 " WHERE tagxref.rid=%d"
383 " AND tagxref.tagid=tag.tagid"
384 " AND tagxref.tagtype>0"
@@ -399,11 +399,11 @@
399 */
400 void brtimeline_page(void){
401 Stmt q;
402
403 login_check_credentials();
404 if( !g.okRead ){ login_needed(); return; }
405
406 style_header("Branches");
407 style_submenu_element("List", "List", "brlist");
408 login_anonymous_available();
409 @ <h2>The initial check-in for each branch:</h2>
410
--- src/branch.c
+++ src/branch.c
@@ -286,11 +286,11 @@
286 int showClosed = P("closed")!=0;
287 int showAll = P("all")!=0;
288 int colorTest = P("colortest")!=0;
289
290 login_check_credentials();
291 if( !g.perm.Read ){ login_needed(); return; }
292 if( colorTest ){
293 showClosed = 0;
294 showAll = 1;
295 }
296
@@ -348,11 +348,11 @@
348 }
349 if( colorTest ){
350 const char *zColor = hash_color(zBr);
351 @ <li><span style="background-color: %s(zColor)">
352 @ %h(zBr) &rarr; %s(zColor)</span></li>
353 }else if( g.perm.History ){
354 @ <li><a href="%s(g.zTop)/timeline?r=%T(zBr)")>%h(zBr)</a></li>
355 }else{
356 @ <li><b>%h(zBr)</b></li>
357 }
358 }
@@ -374,11 +374,11 @@
374 ** the timeline of a "brlist" page. Add some additional hyperlinks
375 ** to the end of the line.
376 */
377 static void brtimeline_extra(int rid){
378 Stmt q;
379 if( !g.perm.History ) return;
380 db_prepare(&q,
381 "SELECT substr(tagname,5) FROM tagxref, tag"
382 " WHERE tagxref.rid=%d"
383 " AND tagxref.tagid=tag.tagid"
384 " AND tagxref.tagtype>0"
@@ -399,11 +399,11 @@
399 */
400 void brtimeline_page(void){
401 Stmt q;
402
403 login_check_credentials();
404 if( !g.perm.Read ){ login_needed(); return; }
405
406 style_header("Branches");
407 style_submenu_element("List", "List", "brlist");
408 login_anonymous_available();
409 @ <h2>The initial check-in for each branch:</h2>
410
+2 -2
--- src/browse.c
+++ src/browse.c
@@ -77,11 +77,11 @@
7777
int i, j;
7878
char *zSep = "";
7979
8080
for(i=0; zPath[i]; i=j){
8181
for(j=i; zPath[j] && zPath[j]!='/'; j++){}
82
- if( zPath[j] && g.okHistory ){
82
+ if( zPath[j] && g.perm.History ){
8383
if( zCI ){
8484
blob_appendf(pOut, "%s<a href=\"%s/dir?ci=%S&amp;name=%#T\">%#h</a>",
8585
zSep, g.zTop, zCI, j, zPath, j-i, &zPath[i]);
8686
}else{
8787
blob_appendf(pOut, "%s<a href=\"%s/dir?name=%#T\">%#h</a>",
@@ -118,11 +118,11 @@
118118
Blob dirname;
119119
Manifest *pM = 0;
120120
const char *zSubdirLink;
121121
122122
login_check_credentials();
123
- if( !g.okHistory ){ login_needed(); return; }
123
+ if( !g.perm.History ){ login_needed(); return; }
124124
while( nD>1 && zD[nD-2]=='/' ){ zD[(--nD)-1] = 0; }
125125
style_header("File List");
126126
sqlite3_create_function(g.db, "pathelement", 2, SQLITE_UTF8, 0,
127127
pathelementFunc, 0, 0);
128128
129129
--- src/browse.c
+++ src/browse.c
@@ -77,11 +77,11 @@
77 int i, j;
78 char *zSep = "";
79
80 for(i=0; zPath[i]; i=j){
81 for(j=i; zPath[j] && zPath[j]!='/'; j++){}
82 if( zPath[j] && g.okHistory ){
83 if( zCI ){
84 blob_appendf(pOut, "%s<a href=\"%s/dir?ci=%S&amp;name=%#T\">%#h</a>",
85 zSep, g.zTop, zCI, j, zPath, j-i, &zPath[i]);
86 }else{
87 blob_appendf(pOut, "%s<a href=\"%s/dir?name=%#T\">%#h</a>",
@@ -118,11 +118,11 @@
118 Blob dirname;
119 Manifest *pM = 0;
120 const char *zSubdirLink;
121
122 login_check_credentials();
123 if( !g.okHistory ){ login_needed(); return; }
124 while( nD>1 && zD[nD-2]=='/' ){ zD[(--nD)-1] = 0; }
125 style_header("File List");
126 sqlite3_create_function(g.db, "pathelement", 2, SQLITE_UTF8, 0,
127 pathelementFunc, 0, 0);
128
129
--- src/browse.c
+++ src/browse.c
@@ -77,11 +77,11 @@
77 int i, j;
78 char *zSep = "";
79
80 for(i=0; zPath[i]; i=j){
81 for(j=i; zPath[j] && zPath[j]!='/'; j++){}
82 if( zPath[j] && g.perm.History ){
83 if( zCI ){
84 blob_appendf(pOut, "%s<a href=\"%s/dir?ci=%S&amp;name=%#T\">%#h</a>",
85 zSep, g.zTop, zCI, j, zPath, j-i, &zPath[i]);
86 }else{
87 blob_appendf(pOut, "%s<a href=\"%s/dir?name=%#T\">%#h</a>",
@@ -118,11 +118,11 @@
118 Blob dirname;
119 Manifest *pM = 0;
120 const char *zSubdirLink;
121
122 login_check_credentials();
123 if( !g.perm.History ){ login_needed(); return; }
124 while( nD>1 && zD[nD-2]=='/' ){ zD[(--nD)-1] = 0; }
125 style_header("File List");
126 sqlite3_create_function(g.db, "pathelement", 2, SQLITE_UTF8, 0,
127 pathelementFunc, 0, 0);
128
129
+3 -3
--- src/configure.c
+++ src/configure.c
@@ -153,14 +153,14 @@
153153
n -= 2;
154154
}
155155
for(i=0; i<count(aConfig); i++){
156156
if( memcmp(zName, aConfig[i].zName, n)==0 && aConfig[i].zName[n]==0 ){
157157
int m = aConfig[i].groupMask;
158
- if( !g.okAdmin ){
158
+ if( !g.perm.Admin ){
159159
m &= ~CONFIGSET_USER;
160160
}
161
- if( !g.okRdAddr ){
161
+ if( !g.perm.RdAddr ){
162162
m &= ~CONFIGSET_ADDR;
163163
}
164164
return m;
165165
}
166166
}
@@ -553,11 +553,11 @@
553553
){
554554
const char *zName = blob_str(&aToken[1]);
555555
Blob content;
556556
blob_zero(&content);
557557
blob_extract(pIn, size, &content);
558
- g.okAdmin = g.okRdAddr = 1;
558
+ g.perm.Admin = g.perm.RdAddr = 1;
559559
configure_receive(zName, &content, groupMask);
560560
blob_reset(&content);
561561
blob_seek(pIn, 1, BLOB_SEEK_CUR);
562562
}
563563
}
564564
--- src/configure.c
+++ src/configure.c
@@ -153,14 +153,14 @@
153 n -= 2;
154 }
155 for(i=0; i<count(aConfig); i++){
156 if( memcmp(zName, aConfig[i].zName, n)==0 && aConfig[i].zName[n]==0 ){
157 int m = aConfig[i].groupMask;
158 if( !g.okAdmin ){
159 m &= ~CONFIGSET_USER;
160 }
161 if( !g.okRdAddr ){
162 m &= ~CONFIGSET_ADDR;
163 }
164 return m;
165 }
166 }
@@ -553,11 +553,11 @@
553 ){
554 const char *zName = blob_str(&aToken[1]);
555 Blob content;
556 blob_zero(&content);
557 blob_extract(pIn, size, &content);
558 g.okAdmin = g.okRdAddr = 1;
559 configure_receive(zName, &content, groupMask);
560 blob_reset(&content);
561 blob_seek(pIn, 1, BLOB_SEEK_CUR);
562 }
563 }
564
--- src/configure.c
+++ src/configure.c
@@ -153,14 +153,14 @@
153 n -= 2;
154 }
155 for(i=0; i<count(aConfig); i++){
156 if( memcmp(zName, aConfig[i].zName, n)==0 && aConfig[i].zName[n]==0 ){
157 int m = aConfig[i].groupMask;
158 if( !g.perm.Admin ){
159 m &= ~CONFIGSET_USER;
160 }
161 if( !g.perm.RdAddr ){
162 m &= ~CONFIGSET_ADDR;
163 }
164 return m;
165 }
166 }
@@ -553,11 +553,11 @@
553 ){
554 const char *zName = blob_str(&aToken[1]);
555 Blob content;
556 blob_zero(&content);
557 blob_extract(pIn, size, &content);
558 g.perm.Admin = g.perm.RdAddr = 1;
559 configure_receive(zName, &content, groupMask);
560 blob_reset(&content);
561 blob_seek(pIn, 1, BLOB_SEEK_CUR);
562 }
563 }
564
+1 -1
--- src/db.c
+++ src/db.c
@@ -1344,11 +1344,11 @@
13441344
** In either case, the string returned is stored in space obtained
13451345
** from malloc and should be freed by the calling function.
13461346
*/
13471347
char *db_reveal(const char *zKey){
13481348
char *zOut;
1349
- if( g.okRdAddr ){
1349
+ if( g.perm.RdAddr ){
13501350
zOut = db_text(0, "SELECT content FROM concealed WHERE hash=%Q", zKey);
13511351
}else{
13521352
zOut = 0;
13531353
}
13541354
if( zOut==0 ){
13551355
--- src/db.c
+++ src/db.c
@@ -1344,11 +1344,11 @@
1344 ** In either case, the string returned is stored in space obtained
1345 ** from malloc and should be freed by the calling function.
1346 */
1347 char *db_reveal(const char *zKey){
1348 char *zOut;
1349 if( g.okRdAddr ){
1350 zOut = db_text(0, "SELECT content FROM concealed WHERE hash=%Q", zKey);
1351 }else{
1352 zOut = 0;
1353 }
1354 if( zOut==0 ){
1355
--- src/db.c
+++ src/db.c
@@ -1344,11 +1344,11 @@
1344 ** In either case, the string returned is stored in space obtained
1345 ** from malloc and should be freed by the calling function.
1346 */
1347 char *db_reveal(const char *zKey){
1348 char *zOut;
1349 if( g.perm.RdAddr ){
1350 zOut = db_text(0, "SELECT content FROM concealed WHERE hash=%Q", zKey);
1351 }else{
1352 zOut = 0;
1353 }
1354 if( zOut==0 ){
1355
--- src/descendants.c
+++ src/descendants.c
@@ -350,11 +350,11 @@
350350
Stmt q;
351351
int showAll = P("all")!=0;
352352
int showClosed = P("closed")!=0;
353353
354354
login_check_credentials();
355
- if( !g.okRead ){ login_needed(); return; }
355
+ if( !g.perm.Read ){ login_needed(); return; }
356356
357357
if( !showAll ){
358358
style_submenu_element("All", "All", "leaves?all");
359359
}
360360
if( !showClosed ){
361361
--- src/descendants.c
+++ src/descendants.c
@@ -350,11 +350,11 @@
350 Stmt q;
351 int showAll = P("all")!=0;
352 int showClosed = P("closed")!=0;
353
354 login_check_credentials();
355 if( !g.okRead ){ login_needed(); return; }
356
357 if( !showAll ){
358 style_submenu_element("All", "All", "leaves?all");
359 }
360 if( !showClosed ){
361
--- src/descendants.c
+++ src/descendants.c
@@ -350,11 +350,11 @@
350 Stmt q;
351 int showAll = P("all")!=0;
352 int showClosed = P("closed")!=0;
353
354 login_check_credentials();
355 if( !g.perm.Read ){ login_needed(); return; }
356
357 if( !showAll ){
358 style_submenu_element("All", "All", "leaves?all");
359 }
360 if( !showClosed ){
361
+2 -2
--- src/diff.c
+++ src/diff.c
@@ -837,21 +837,21 @@
837837
int iLimit;
838838
int annFlags = 0;
839839
Annotator ann;
840840
841841
login_check_credentials();
842
- if( !g.okRead ){ login_needed(); return; }
842
+ if( !g.perm.Read ){ login_needed(); return; }
843843
mid = name_to_typed_rid(PD("checkin","0"),"ci");
844844
fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", P("filename"));
845845
if( mid==0 || fnid==0 ){ fossil_redirect_home(); }
846846
iLimit = atoi(PD("limit","-1"));
847847
if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid) ){
848848
fossil_redirect_home();
849849
}
850850
style_header("File Annotation");
851851
if( P("filevers") ) annFlags |= ANN_FILE_VERS;
852
- annotate_file(&ann, fnid, mid, g.okHistory, iLimit, annFlags);
852
+ annotate_file(&ann, fnid, mid, g.perm.History, iLimit, annFlags);
853853
if( P("log") ){
854854
int i;
855855
@ <h2>Versions analyzed:</h2>
856856
@ <ol>
857857
for(i=0; i<ann.nVers; i++){
858858
--- src/diff.c
+++ src/diff.c
@@ -837,21 +837,21 @@
837 int iLimit;
838 int annFlags = 0;
839 Annotator ann;
840
841 login_check_credentials();
842 if( !g.okRead ){ login_needed(); return; }
843 mid = name_to_typed_rid(PD("checkin","0"),"ci");
844 fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", P("filename"));
845 if( mid==0 || fnid==0 ){ fossil_redirect_home(); }
846 iLimit = atoi(PD("limit","-1"));
847 if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid) ){
848 fossil_redirect_home();
849 }
850 style_header("File Annotation");
851 if( P("filevers") ) annFlags |= ANN_FILE_VERS;
852 annotate_file(&ann, fnid, mid, g.okHistory, iLimit, annFlags);
853 if( P("log") ){
854 int i;
855 @ <h2>Versions analyzed:</h2>
856 @ <ol>
857 for(i=0; i<ann.nVers; i++){
858
--- src/diff.c
+++ src/diff.c
@@ -837,21 +837,21 @@
837 int iLimit;
838 int annFlags = 0;
839 Annotator ann;
840
841 login_check_credentials();
842 if( !g.perm.Read ){ login_needed(); return; }
843 mid = name_to_typed_rid(PD("checkin","0"),"ci");
844 fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", P("filename"));
845 if( mid==0 || fnid==0 ){ fossil_redirect_home(); }
846 iLimit = atoi(PD("limit","-1"));
847 if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid) ){
848 fossil_redirect_home();
849 }
850 style_header("File Annotation");
851 if( P("filevers") ) annFlags |= ANN_FILE_VERS;
852 annotate_file(&ann, fnid, mid, g.perm.History, iLimit, annFlags);
853 if( P("log") ){
854 int i;
855 @ <h2>Versions analyzed:</h2>
856 @ <ol>
857 for(i=0; i<ann.nVers; i++){
858
+1 -1
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -518,11 +518,11 @@
518518
*/
519519
void vpatch_page(void){
520520
const char *zFrom = P("from");
521521
const char *zTo = P("to");
522522
login_check_credentials();
523
- if( !g.okRead ){ login_needed(); return; }
523
+ if( !g.perm.Read ){ login_needed(); return; }
524524
if( zFrom==0 || zTo==0 ) fossil_redirect_home();
525525
526526
cgi_set_content_type("text/plain");
527527
diff_all_two_versions(zFrom, zTo, 0, DIFF_NEWFILE);
528528
}
529529
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -518,11 +518,11 @@
518 */
519 void vpatch_page(void){
520 const char *zFrom = P("from");
521 const char *zTo = P("to");
522 login_check_credentials();
523 if( !g.okRead ){ login_needed(); return; }
524 if( zFrom==0 || zTo==0 ) fossil_redirect_home();
525
526 cgi_set_content_type("text/plain");
527 diff_all_two_versions(zFrom, zTo, 0, DIFF_NEWFILE);
528 }
529
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -518,11 +518,11 @@
518 */
519 void vpatch_page(void){
520 const char *zFrom = P("from");
521 const char *zTo = P("to");
522 login_check_credentials();
523 if( !g.perm.Read ){ login_needed(); return; }
524 if( zFrom==0 || zTo==0 ) fossil_redirect_home();
525
526 cgi_set_content_type("text/plain");
527 diff_all_two_versions(zFrom, zTo, 0, DIFF_NEWFILE);
528 }
529
+1 -1
--- src/doc.c
+++ src/doc.c
@@ -363,11 +363,11 @@
363363
int i; /* Loop counter */
364364
Blob filebody; /* Content of the documentation file */
365365
char zBaseline[UUID_SIZE+1]; /* Baseline UUID */
366366
367367
login_check_credentials();
368
- if( !g.okRead ){ login_needed(); return; }
368
+ if( !g.perm.Read ){ login_needed(); return; }
369369
zName = PD("name", "tip/index.wiki");
370370
for(i=0; zName[i] && zName[i]!='/'; i++){}
371371
if( zName[i]==0 || i>UUID_SIZE ){
372372
goto doc_not_found;
373373
}
374374
--- src/doc.c
+++ src/doc.c
@@ -363,11 +363,11 @@
363 int i; /* Loop counter */
364 Blob filebody; /* Content of the documentation file */
365 char zBaseline[UUID_SIZE+1]; /* Baseline UUID */
366
367 login_check_credentials();
368 if( !g.okRead ){ login_needed(); return; }
369 zName = PD("name", "tip/index.wiki");
370 for(i=0; zName[i] && zName[i]!='/'; i++){}
371 if( zName[i]==0 || i>UUID_SIZE ){
372 goto doc_not_found;
373 }
374
--- src/doc.c
+++ src/doc.c
@@ -363,11 +363,11 @@
363 int i; /* Loop counter */
364 Blob filebody; /* Content of the documentation file */
365 char zBaseline[UUID_SIZE+1]; /* Baseline UUID */
366
367 login_check_credentials();
368 if( !g.perm.Read ){ login_needed(); return; }
369 zName = PD("name", "tip/index.wiki");
370 for(i=0; zName[i] && zName[i]!='/'; i++){}
371 if( zName[i]==0 || i>UUID_SIZE ){
372 goto doc_not_found;
373 }
374
+6 -6
--- src/event.c
+++ src/event.c
@@ -36,11 +36,11 @@
3636
char zShort[12];
3737
3838
zEventId = db_text(0, "SELECT substr(tagname, 7) FROM tag WHERE tagid=%d",
3939
tagid);
4040
sqlite3_snprintf(sizeof(zShort), zShort, "%.10s", zEventId);
41
- if( g.okHistory ){
41
+ if( g.perm.History ){
4242
@ [<a href="%s(g.zTop)/event?name=%s(zEventId)">%s(zShort)</a>]
4343
}else{
4444
@ [%s(zShort)]
4545
}
4646
free(zEventId);
@@ -74,11 +74,11 @@
7474
7575
7676
/* wiki-read privilege is needed in order to read events.
7777
*/
7878
login_check_credentials();
79
- if( !g.okRdWiki ){
79
+ if( !g.perm.RdWiki ){
8080
login_needed();
8181
return;
8282
}
8383
8484
zEventId = P("name");
@@ -123,18 +123,18 @@
123123
style_header(blob_str(&title));
124124
}else{
125125
style_header("Event %S", zEventId);
126126
tail = fullbody;
127127
}
128
- if( g.okWrWiki && g.okWrite && nextRid==0 ){
128
+ if( g.perm.WrWiki && g.perm.Write && nextRid==0 ){
129129
style_submenu_element("Edit", "Edit", "%s/eventedit?name=%s",
130130
g.zTop, zEventId);
131131
}
132132
zETime = db_text(0, "SELECT datetime(%.17g)", pEvent->rEventDate);
133133
style_submenu_element("Context", "Context", "%s/timeline?c=%T",
134134
g.zTop, zETime);
135
- if( g.okHistory ){
135
+ if( g.perm.History ){
136136
if( showDetail ){
137137
style_submenu_element("Plain", "Plain", "%s/event?name=%s&amp;aid=%s",
138138
g.zTop, zEventId, zUuid);
139139
if( nextRid ){
140140
char *zNext;
@@ -157,11 +157,11 @@
157157
"%s/event?name=%s&amp;aid=%s&amp;detail=1",
158158
g.zTop, zEventId, zUuid);
159159
}
160160
}
161161
162
- if( showDetail && g.okHistory ){
162
+ if( showDetail && g.perm.History ){
163163
int i;
164164
const char *zClr = 0;
165165
Blob comment;
166166
167167
zATime = db_text(0, "SELECT datetime(%.17g)", pEvent->rDate);
@@ -236,11 +236,11 @@
236236
free(zTag);
237237
238238
/* Need both check-in and wiki-write or wiki-create privileges in order
239239
** to edit/create an event.
240240
*/
241
- if( !g.okWrite || (rid && !g.okWrWiki) || (!rid && !g.okNewWiki) ){
241
+ if( !g.perm.Write || (rid && !g.perm.WrWiki) || (!rid && !g.perm.NewWiki) ){
242242
login_needed();
243243
return;
244244
}
245245
246246
/* Figure out the color */
247247
--- src/event.c
+++ src/event.c
@@ -36,11 +36,11 @@
36 char zShort[12];
37
38 zEventId = db_text(0, "SELECT substr(tagname, 7) FROM tag WHERE tagid=%d",
39 tagid);
40 sqlite3_snprintf(sizeof(zShort), zShort, "%.10s", zEventId);
41 if( g.okHistory ){
42 @ [<a href="%s(g.zTop)/event?name=%s(zEventId)">%s(zShort)</a>]
43 }else{
44 @ [%s(zShort)]
45 }
46 free(zEventId);
@@ -74,11 +74,11 @@
74
75
76 /* wiki-read privilege is needed in order to read events.
77 */
78 login_check_credentials();
79 if( !g.okRdWiki ){
80 login_needed();
81 return;
82 }
83
84 zEventId = P("name");
@@ -123,18 +123,18 @@
123 style_header(blob_str(&title));
124 }else{
125 style_header("Event %S", zEventId);
126 tail = fullbody;
127 }
128 if( g.okWrWiki && g.okWrite && nextRid==0 ){
129 style_submenu_element("Edit", "Edit", "%s/eventedit?name=%s",
130 g.zTop, zEventId);
131 }
132 zETime = db_text(0, "SELECT datetime(%.17g)", pEvent->rEventDate);
133 style_submenu_element("Context", "Context", "%s/timeline?c=%T",
134 g.zTop, zETime);
135 if( g.okHistory ){
136 if( showDetail ){
137 style_submenu_element("Plain", "Plain", "%s/event?name=%s&amp;aid=%s",
138 g.zTop, zEventId, zUuid);
139 if( nextRid ){
140 char *zNext;
@@ -157,11 +157,11 @@
157 "%s/event?name=%s&amp;aid=%s&amp;detail=1",
158 g.zTop, zEventId, zUuid);
159 }
160 }
161
162 if( showDetail && g.okHistory ){
163 int i;
164 const char *zClr = 0;
165 Blob comment;
166
167 zATime = db_text(0, "SELECT datetime(%.17g)", pEvent->rDate);
@@ -236,11 +236,11 @@
236 free(zTag);
237
238 /* Need both check-in and wiki-write or wiki-create privileges in order
239 ** to edit/create an event.
240 */
241 if( !g.okWrite || (rid && !g.okWrWiki) || (!rid && !g.okNewWiki) ){
242 login_needed();
243 return;
244 }
245
246 /* Figure out the color */
247
--- src/event.c
+++ src/event.c
@@ -36,11 +36,11 @@
36 char zShort[12];
37
38 zEventId = db_text(0, "SELECT substr(tagname, 7) FROM tag WHERE tagid=%d",
39 tagid);
40 sqlite3_snprintf(sizeof(zShort), zShort, "%.10s", zEventId);
41 if( g.perm.History ){
42 @ [<a href="%s(g.zTop)/event?name=%s(zEventId)">%s(zShort)</a>]
43 }else{
44 @ [%s(zShort)]
45 }
46 free(zEventId);
@@ -74,11 +74,11 @@
74
75
76 /* wiki-read privilege is needed in order to read events.
77 */
78 login_check_credentials();
79 if( !g.perm.RdWiki ){
80 login_needed();
81 return;
82 }
83
84 zEventId = P("name");
@@ -123,18 +123,18 @@
123 style_header(blob_str(&title));
124 }else{
125 style_header("Event %S", zEventId);
126 tail = fullbody;
127 }
128 if( g.perm.WrWiki && g.perm.Write && nextRid==0 ){
129 style_submenu_element("Edit", "Edit", "%s/eventedit?name=%s",
130 g.zTop, zEventId);
131 }
132 zETime = db_text(0, "SELECT datetime(%.17g)", pEvent->rEventDate);
133 style_submenu_element("Context", "Context", "%s/timeline?c=%T",
134 g.zTop, zETime);
135 if( g.perm.History ){
136 if( showDetail ){
137 style_submenu_element("Plain", "Plain", "%s/event?name=%s&amp;aid=%s",
138 g.zTop, zEventId, zUuid);
139 if( nextRid ){
140 char *zNext;
@@ -157,11 +157,11 @@
157 "%s/event?name=%s&amp;aid=%s&amp;detail=1",
158 g.zTop, zEventId, zUuid);
159 }
160 }
161
162 if( showDetail && g.perm.History ){
163 int i;
164 const char *zClr = 0;
165 Blob comment;
166
167 zATime = db_text(0, "SELECT datetime(%.17g)", pEvent->rDate);
@@ -236,11 +236,11 @@
236 free(zTag);
237
238 /* Need both check-in and wiki-write or wiki-create privileges in order
239 ** to edit/create an event.
240 */
241 if( !g.perm.Write || (rid && !g.perm.WrWiki) || (!rid && !g.perm.NewWiki) ){
242 login_needed();
243 return;
244 }
245
246 /* Figure out the color */
247
+3 -3
--- src/finfo.c
+++ src/finfo.c
@@ -222,11 +222,11 @@
222222
GraphContext *pGraph;
223223
int brBg = P("brbg")!=0;
224224
int uBg = P("ubg")!=0;
225225
226226
login_check_credentials();
227
- if( !g.okRead ){ login_needed(); return; }
227
+ if( !g.perm.Read ){ login_needed(); return; }
228228
style_header("File History");
229229
login_anonymous_available();
230230
231231
zPrevDate[0] = 0;
232232
zFilename = PD("name","");
@@ -309,11 +309,11 @@
309309
@ <td class="timelineTableCell">
310310
}
311311
sqlite3_snprintf(sizeof(zShort), zShort, "%.10s", zUuid);
312312
sqlite3_snprintf(sizeof(zShortCkin), zShortCkin, "%.10s", zCkin);
313313
if( zUuid ){
314
- if( g.okHistory ){
314
+ if( g.perm.History ){
315315
@ <a href="%s(g.zTop)/artifact/%s(zUuid)">[%S(zUuid)]</a>
316316
}else{
317317
@ [%S(zUuid)]
318318
}
319319
@ part of check-in
@@ -322,11 +322,11 @@
322322
}
323323
hyperlink_to_uuid(zShortCkin);
324324
@ %h(zCom) (user:
325325
hyperlink_to_user(zUser, zDate, "");
326326
@ branch: %h(zBr))
327
- if( g.okHistory && zUuid ){
327
+ if( g.perm.History && zUuid ){
328328
const char *z = zFilename;
329329
if( fpid ){
330330
@ <a href="%s(g.zTop)/fdiff?v1=%s(zPUuid)&amp;v2=%s(zUuid)">[diff]</a>
331331
}
332332
@ <a href="%s(g.zTop)/annotate?checkin=%S(zCkin)&amp;filename=%h(z)">
333333
--- src/finfo.c
+++ src/finfo.c
@@ -222,11 +222,11 @@
222 GraphContext *pGraph;
223 int brBg = P("brbg")!=0;
224 int uBg = P("ubg")!=0;
225
226 login_check_credentials();
227 if( !g.okRead ){ login_needed(); return; }
228 style_header("File History");
229 login_anonymous_available();
230
231 zPrevDate[0] = 0;
232 zFilename = PD("name","");
@@ -309,11 +309,11 @@
309 @ <td class="timelineTableCell">
310 }
311 sqlite3_snprintf(sizeof(zShort), zShort, "%.10s", zUuid);
312 sqlite3_snprintf(sizeof(zShortCkin), zShortCkin, "%.10s", zCkin);
313 if( zUuid ){
314 if( g.okHistory ){
315 @ <a href="%s(g.zTop)/artifact/%s(zUuid)">[%S(zUuid)]</a>
316 }else{
317 @ [%S(zUuid)]
318 }
319 @ part of check-in
@@ -322,11 +322,11 @@
322 }
323 hyperlink_to_uuid(zShortCkin);
324 @ %h(zCom) (user:
325 hyperlink_to_user(zUser, zDate, "");
326 @ branch: %h(zBr))
327 if( g.okHistory && zUuid ){
328 const char *z = zFilename;
329 if( fpid ){
330 @ <a href="%s(g.zTop)/fdiff?v1=%s(zPUuid)&amp;v2=%s(zUuid)">[diff]</a>
331 }
332 @ <a href="%s(g.zTop)/annotate?checkin=%S(zCkin)&amp;filename=%h(z)">
333
--- src/finfo.c
+++ src/finfo.c
@@ -222,11 +222,11 @@
222 GraphContext *pGraph;
223 int brBg = P("brbg")!=0;
224 int uBg = P("ubg")!=0;
225
226 login_check_credentials();
227 if( !g.perm.Read ){ login_needed(); return; }
228 style_header("File History");
229 login_anonymous_available();
230
231 zPrevDate[0] = 0;
232 zFilename = PD("name","");
@@ -309,11 +309,11 @@
309 @ <td class="timelineTableCell">
310 }
311 sqlite3_snprintf(sizeof(zShort), zShort, "%.10s", zUuid);
312 sqlite3_snprintf(sizeof(zShortCkin), zShortCkin, "%.10s", zCkin);
313 if( zUuid ){
314 if( g.perm.History ){
315 @ <a href="%s(g.zTop)/artifact/%s(zUuid)">[%S(zUuid)]</a>
316 }else{
317 @ [%S(zUuid)]
318 }
319 @ part of check-in
@@ -322,11 +322,11 @@
322 }
323 hyperlink_to_uuid(zShortCkin);
324 @ %h(zCom) (user:
325 hyperlink_to_user(zUser, zDate, "");
326 @ branch: %h(zBr))
327 if( g.perm.History && zUuid ){
328 const char *z = zFilename;
329 if( fpid ){
330 @ <a href="%s(g.zTop)/fdiff?v1=%s(zPUuid)&amp;v2=%s(zUuid)">[diff]</a>
331 }
332 @ <a href="%s(g.zTop)/annotate?checkin=%S(zCkin)&amp;filename=%h(z)">
333
+28 -28
--- src/info.c
+++ src/info.c
@@ -289,11 +289,11 @@
289289
const char *zNew, /* blob.uuid after change. NULL for deletes */
290290
const char *zOldName, /* Prior name. NULL if no name change. */
291291
int showDiff, /* Show edit diffs if true */
292292
int mperm /* executable or symlink permission for zNew */
293293
){
294
- if( !g.okHistory ){
294
+ if( !g.perm.History ){
295295
if( zNew==0 ){
296296
@ <p>Deleted %h(zName)</p>
297297
}else if( zOld==0 ){
298298
@ <p>Added %h(zName)</p>
299299
}else if( zOldName!=0 && fossil_strcmp(zName,zOldName)!=0 ){
@@ -366,11 +366,11 @@
366366
const char *zName; /* Name of the checkin to be displayed */
367367
const char *zUuid; /* UUID of zName */
368368
const char *zParent; /* UUID of the parent checkin (if any) */
369369
370370
login_check_credentials();
371
- if( !g.okRead ){ login_needed(); return; }
371
+ if( !g.perm.Read ){ login_needed(); return; }
372372
zName = P("name");
373373
rid = name_to_rid_www("name");
374374
if( rid==0 ){
375375
style_header("Check-in Information Error");
376376
@ No such object: %h(g.argv[2])
@@ -414,11 +414,11 @@
414414
zDate = db_column_text(&q,1);
415415
zOrigDate = db_column_text(&q, 4);
416416
@ <div class="section">Overview</div>
417417
@ <table class="label-value">
418418
@ <tr><th>SHA1&nbsp;Hash:</th><td>%s(zUuid)
419
- if( g.okSetup ){
419
+ if( g.perm.Setup ){
420420
@ (Record ID: %d(rid))
421421
}
422422
@ </td></tr>
423423
@ <tr><th>Date:</th><td>
424424
hyperlink_to_date(zDate, "</td></tr>");
@@ -439,11 +439,11 @@
439439
@ <tr><th>Edited&nbsp;Comment:</th><td>%w(zEComment)</td></tr>
440440
@ <tr><th>Original&nbsp;Comment:</th><td>%w(zComment)</td></tr>
441441
}else{
442442
@ <tr><th>Comment:</th><td>%w(zComment)</td></tr>
443443
}
444
- if( g.okAdmin ){
444
+ if( g.perm.Admin ){
445445
db_prepare(&q,
446446
"SELECT rcvfrom.ipaddr, user.login, datetime(rcvfrom.mtime)"
447447
" FROM blob JOIN rcvfrom USING(rcvid) LEFT JOIN user USING(uid)"
448448
" WHERE blob.rid=%d",
449449
rid
@@ -456,11 +456,11 @@
456456
@ <tr><th>Received&nbsp;From:</th>
457457
@ <td>%h(zUser) @ %h(zIpAddr) on %s(zDate)</td></tr>
458458
}
459459
db_finalize(&q);
460460
}
461
- if( g.okHistory ){
461
+ if( g.perm.History ){
462462
const char *zProjName = db_get("project-name", "unnamed");
463463
@ <tr><th>Timelines:</th><td>
464464
@ <a href="%s(g.zTop)/timeline?f=%S(zUuid)">family</a>
465465
if( zParent ){
466466
@ | <a href="%s(g.zTop)/timeline?p=%S(zUuid)">ancestors</a>
@@ -482,20 +482,20 @@
482482
db_finalize(&q);
483483
@ </td></tr>
484484
@ <tr><th>Other&nbsp;Links:</th>
485485
@ <td>
486486
@ <a href="%s(g.zTop)/dir?ci=%S(zUuid)">files</a>
487
- if( g.okZip ){
487
+ if( g.perm.Zip ){
488488
char *zUrl = mprintf("%s/tarball/%s-%S.tar.gz?uuid=%s",
489489
g.zTop, zProjName, zUuid, zUuid);
490490
@ | <a href="%s(zUrl)">Tarball</a>
491491
@ | <a href="%s(g.zTop)/zip/%s(zProjName)-%S(zUuid).zip?uuid=%s(zUuid)">
492492
@ ZIP archive</a>
493493
fossil_free(zUrl);
494494
}
495495
@ | <a href="%s(g.zTop)/artifact/%S(zUuid)">manifest</a>
496
- if( g.okWrite ){
496
+ if( g.perm.Write ){
497497
@ | <a href="%s(g.zTop)/ci_edit?r=%S(zUuid)">edit</a>
498498
}
499499
@ </td>
500500
@ </tr>
501501
}
@@ -558,11 +558,11 @@
558558
void winfo_page(void){
559559
Stmt q;
560560
int rid;
561561
562562
login_check_credentials();
563
- if( !g.okRdWiki ){ login_needed(); return; }
563
+ if( !g.perm.RdWiki ){ login_needed(); return; }
564564
rid = name_to_rid_www("name");
565565
if( rid==0 ){
566566
style_header("Wiki Page Information Error");
567567
@ No such object: %h(g.argv[2])
568568
style_footer();
@@ -591,16 +591,16 @@
591591
@ <div class="section">Overview</div>
592592
@ <p><table class="label-value">
593593
@ <tr><th>Version:</th><td>%s(zUuid)</td></tr>
594594
@ <tr><th>Date:</th><td>
595595
hyperlink_to_date(zDate, "</td></tr>");
596
- if( g.okSetup ){
596
+ if( g.perm.Setup ){
597597
@ <tr><th>Record ID:</th><td>%d(rid)</td></tr>
598598
}
599599
@ <tr><th>Original&nbsp;User:</th><td>
600600
hyperlink_to_user(zUser, zDate, "</td></tr>");
601
- if( g.okHistory ){
601
+ if( g.perm.History ){
602602
@ <tr><th>Commands:</th>
603603
@ <td>
604604
@ <a href="%s(g.zTop)/whistory?name=%t(zName)">history</a>
605605
@ | <a href="%s(g.zTop)/artifact/%S(zUuid)">raw-text</a>
606606
@ </td>
@@ -701,11 +701,11 @@
701701
int showDetail = 0;
702702
Manifest *pFrom, *pTo;
703703
ManifestFile *pFileFrom, *pFileTo;
704704
705705
login_check_credentials();
706
- if( !g.okRead ){ login_needed(); return; }
706
+ if( !g.perm.Read ){ login_needed(); return; }
707707
login_anonymous_available();
708708
709709
pFrom = vdiff_parse_manifest("from", &ridFrom);
710710
if( pFrom==0 ) return;
711711
pTo = vdiff_parse_manifest("to", &ridTo);
@@ -820,11 +820,11 @@
820820
}else if( mPerm==PERM_EXE ){
821821
@ <li>Executable file
822822
}else{
823823
@ <li>File
824824
}
825
- if( g.okHistory ){
825
+ if( g.perm.History ){
826826
@ <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>
827827
}else{
828828
@ %h(zName)
829829
}
830830
@ <ul>
@@ -833,20 +833,20 @@
833833
@ <li>
834834
hyperlink_to_date(zDate,"");
835835
@ - part of checkin
836836
hyperlink_to_uuid(zVers);
837837
if( zBr && zBr[0] ){
838
- if( g.okHistory ){
838
+ if( g.perm.History ){
839839
@ on branch <a href="%s(g.zTop)/timeline?r=%T(zBr)">%h(zBr)</a>
840840
}else{
841841
@ on branch %h(zBr)
842842
}
843843
}
844844
@ - %w(zCom) (user:
845845
hyperlink_to_user(zUser,zDate,"");
846846
@ )
847
- if( g.okHistory ){
847
+ if( g.perm.History ){
848848
@ <a href="%s(g.zTop)/annotate?checkin=%S(zVers)&filename=%T(zName)">
849849
@ [annotate]</a>
850850
}
851851
cnt++;
852852
if( pDownloadName && blob_size(pDownloadName)==0 ){
@@ -873,11 +873,11 @@
873873
if( cnt>0 ){
874874
@ Also wiki page
875875
}else{
876876
@ Wiki page
877877
}
878
- if( g.okHistory ){
878
+ if( g.perm.History ){
879879
@ [<a href="%s(g.zTop)/wiki?name=%t(zPagename)">%h(zPagename)</a>]
880880
}else{
881881
@ [%h(zPagename)]
882882
}
883883
@ by
@@ -949,17 +949,17 @@
949949
@ Also attachment "%h(zFilename)" to
950950
}else{
951951
@ Attachment "%h(zFilename)" to
952952
}
953953
if( strlen(zTarget)==UUID_SIZE && validate16(zTarget,UUID_SIZE) ){
954
- if( g.okHistory && g.okRdTkt ){
954
+ if( g.perm.History && g.perm.RdTkt ){
955955
@ ticket [<a href="%s(g.zTop)/tktview?name=%S(zTarget)">%S(zTarget)</a>]
956956
}else{
957957
@ ticket [%S(zTarget)]
958958
}
959959
}else{
960
- if( g.okHistory && g.okRdWiki ){
960
+ if( g.perm.History && g.perm.RdWiki ){
961961
@ wiki page [<a href="%s(g.zTop)/wiki?name=%t(zTarget)">%h(zTarget)</a>]
962962
}else{
963963
@ wiki page [%h(zTarget)]
964964
}
965965
}
@@ -975,11 +975,11 @@
975975
if( cnt==0 ){
976976
@ Control artifact.
977977
if( pDownloadName && blob_size(pDownloadName)==0 ){
978978
blob_appendf(pDownloadName, "%.10s.txt", zUuid);
979979
}
980
- }else if( linkToView && g.okHistory ){
980
+ }else if( linkToView && g.perm.History ){
981981
@ <a href="%s(g.zTop)/artifact/%S(zUuid)">[view]</a>
982982
}
983983
}
984984
985985
@@ -997,11 +997,11 @@
997997
Blob c1, c2, diff, *pOut;
998998
char *zV1;
999999
char *zV2;
10001000
10011001
login_check_credentials();
1002
- if( !g.okRead ){ login_needed(); return; }
1002
+ if( !g.perm.Read ){ login_needed(); return; }
10031003
v1 = name_to_rid_www("v1");
10041004
v2 = name_to_rid_www("v2");
10051005
if( v1==0 || v2==0 ) fossil_redirect_home();
10061006
zV1 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v1);
10071007
zV2 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v2);
@@ -1049,11 +1049,11 @@
10491049
Blob content;
10501050
10511051
rid = name_to_rid_www("name");
10521052
zMime = PD("m","application/x-fossil-artifact");
10531053
login_check_credentials();
1054
- if( !g.okRead ){ login_needed(); return; }
1054
+ if( !g.perm.Read ){ login_needed(); return; }
10551055
if( rid==0 ) fossil_redirect_home();
10561056
content_get(rid, &content);
10571057
cgi_set_content_type(zMime);
10581058
cgi_set_content(&content);
10591059
}
@@ -1122,13 +1122,13 @@
11221122
Blob downloadName;
11231123
char *zUuid;
11241124
11251125
rid = name_to_rid_www("name");
11261126
login_check_credentials();
1127
- if( !g.okRead ){ login_needed(); return; }
1127
+ if( !g.perm.Read ){ login_needed(); return; }
11281128
if( rid==0 ) fossil_redirect_home();
1129
- if( g.okAdmin ){
1129
+ if( g.perm.Admin ){
11301130
const char *zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid);
11311131
if( db_exists("SELECT 1 FROM shun WHERE uuid='%s'", zUuid) ){
11321132
style_submenu_element("Unshun","Unshun", "%s/shun?uuid=%s&amp;sub=1",
11331133
g.zTop, zUuid);
11341134
}else{
@@ -1269,13 +1269,13 @@
12691269
if( rid==0 ){
12701270
rid = name_to_rid_www("name");
12711271
}
12721272
12731273
login_check_credentials();
1274
- if( !g.okRead ){ login_needed(); return; }
1274
+ if( !g.perm.Read ){ login_needed(); return; }
12751275
if( rid==0 ) fossil_redirect_home();
1276
- if( g.okAdmin ){
1276
+ if( g.perm.Admin ){
12771277
const char *zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid);
12781278
if( db_exists("SELECT 1 FROM shun WHERE uuid='%s'", zUuid) ){
12791279
style_submenu_element("Unshun","Unshun", "%s/shun?uuid=%s&amp;sub=1",
12801280
g.zTop, zUuid);
12811281
}else{
@@ -1356,15 +1356,15 @@
13561356
const char *zUuid;
13571357
char zTktName[20];
13581358
Manifest *pTktChng;
13591359
13601360
login_check_credentials();
1361
- if( !g.okRdTkt ){ login_needed(); return; }
1361
+ if( !g.perm.RdTkt ){ login_needed(); return; }
13621362
rid = name_to_rid_www("name");
13631363
if( rid==0 ){ fossil_redirect_home(); }
13641364
zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid);
1365
- if( g.okAdmin ){
1365
+ if( g.perm.Admin ){
13661366
if( db_exists("SELECT 1 FROM shun WHERE uuid='%s'", zUuid) ){
13671367
style_submenu_element("Unshun","Unshun", "%s/shun?uuid=%s&amp;sub=1",
13681368
g.zTop, zUuid);
13691369
}else{
13701370
style_submenu_element("Shun","Shun", "%s/shun?shun=%s#addshun",
@@ -1377,11 +1377,11 @@
13771377
}
13781378
style_header("Ticket Change Details");
13791379
zDate = db_text(0, "SELECT datetime(%.12f)", pTktChng->rDate);
13801380
memcpy(zTktName, pTktChng->zTicketUuid, 10);
13811381
zTktName[10] = 0;
1382
- if( g.okHistory ){
1382
+ if( g.perm.History ){
13831383
@ <h2>Changes to ticket
13841384
@ <a href="%s(pTktChng->zTicketUuid)">%s(zTktName)</a></h2>
13851385
@
13861386
@ <p>By %h(pTktChng->zUser) on %s(zDate). See also:
13871387
@ <a href="%s(g.zTop)/artifact/%T(zUuid)">artifact content</a>, and
@@ -1617,11 +1617,11 @@
16171617
char *zUuid;
16181618
Blob comment;
16191619
Stmt q;
16201620
16211621
login_check_credentials();
1622
- if( !g.okWrite ){ login_needed(); return; }
1622
+ if( !g.perm.Write ){ login_needed(); return; }
16231623
rid = name_to_typed_rid(P("r"), "ci");
16241624
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
16251625
zComment = db_text(0, "SELECT coalesce(ecomment,comment)"
16261626
" FROM event WHERE objid=%d", rid);
16271627
if( zComment==0 ) fossil_redirect_home();
16281628
--- src/info.c
+++ src/info.c
@@ -289,11 +289,11 @@
289 const char *zNew, /* blob.uuid after change. NULL for deletes */
290 const char *zOldName, /* Prior name. NULL if no name change. */
291 int showDiff, /* Show edit diffs if true */
292 int mperm /* executable or symlink permission for zNew */
293 ){
294 if( !g.okHistory ){
295 if( zNew==0 ){
296 @ <p>Deleted %h(zName)</p>
297 }else if( zOld==0 ){
298 @ <p>Added %h(zName)</p>
299 }else if( zOldName!=0 && fossil_strcmp(zName,zOldName)!=0 ){
@@ -366,11 +366,11 @@
366 const char *zName; /* Name of the checkin to be displayed */
367 const char *zUuid; /* UUID of zName */
368 const char *zParent; /* UUID of the parent checkin (if any) */
369
370 login_check_credentials();
371 if( !g.okRead ){ login_needed(); return; }
372 zName = P("name");
373 rid = name_to_rid_www("name");
374 if( rid==0 ){
375 style_header("Check-in Information Error");
376 @ No such object: %h(g.argv[2])
@@ -414,11 +414,11 @@
414 zDate = db_column_text(&q,1);
415 zOrigDate = db_column_text(&q, 4);
416 @ <div class="section">Overview</div>
417 @ <table class="label-value">
418 @ <tr><th>SHA1&nbsp;Hash:</th><td>%s(zUuid)
419 if( g.okSetup ){
420 @ (Record ID: %d(rid))
421 }
422 @ </td></tr>
423 @ <tr><th>Date:</th><td>
424 hyperlink_to_date(zDate, "</td></tr>");
@@ -439,11 +439,11 @@
439 @ <tr><th>Edited&nbsp;Comment:</th><td>%w(zEComment)</td></tr>
440 @ <tr><th>Original&nbsp;Comment:</th><td>%w(zComment)</td></tr>
441 }else{
442 @ <tr><th>Comment:</th><td>%w(zComment)</td></tr>
443 }
444 if( g.okAdmin ){
445 db_prepare(&q,
446 "SELECT rcvfrom.ipaddr, user.login, datetime(rcvfrom.mtime)"
447 " FROM blob JOIN rcvfrom USING(rcvid) LEFT JOIN user USING(uid)"
448 " WHERE blob.rid=%d",
449 rid
@@ -456,11 +456,11 @@
456 @ <tr><th>Received&nbsp;From:</th>
457 @ <td>%h(zUser) @ %h(zIpAddr) on %s(zDate)</td></tr>
458 }
459 db_finalize(&q);
460 }
461 if( g.okHistory ){
462 const char *zProjName = db_get("project-name", "unnamed");
463 @ <tr><th>Timelines:</th><td>
464 @ <a href="%s(g.zTop)/timeline?f=%S(zUuid)">family</a>
465 if( zParent ){
466 @ | <a href="%s(g.zTop)/timeline?p=%S(zUuid)">ancestors</a>
@@ -482,20 +482,20 @@
482 db_finalize(&q);
483 @ </td></tr>
484 @ <tr><th>Other&nbsp;Links:</th>
485 @ <td>
486 @ <a href="%s(g.zTop)/dir?ci=%S(zUuid)">files</a>
487 if( g.okZip ){
488 char *zUrl = mprintf("%s/tarball/%s-%S.tar.gz?uuid=%s",
489 g.zTop, zProjName, zUuid, zUuid);
490 @ | <a href="%s(zUrl)">Tarball</a>
491 @ | <a href="%s(g.zTop)/zip/%s(zProjName)-%S(zUuid).zip?uuid=%s(zUuid)">
492 @ ZIP archive</a>
493 fossil_free(zUrl);
494 }
495 @ | <a href="%s(g.zTop)/artifact/%S(zUuid)">manifest</a>
496 if( g.okWrite ){
497 @ | <a href="%s(g.zTop)/ci_edit?r=%S(zUuid)">edit</a>
498 }
499 @ </td>
500 @ </tr>
501 }
@@ -558,11 +558,11 @@
558 void winfo_page(void){
559 Stmt q;
560 int rid;
561
562 login_check_credentials();
563 if( !g.okRdWiki ){ login_needed(); return; }
564 rid = name_to_rid_www("name");
565 if( rid==0 ){
566 style_header("Wiki Page Information Error");
567 @ No such object: %h(g.argv[2])
568 style_footer();
@@ -591,16 +591,16 @@
591 @ <div class="section">Overview</div>
592 @ <p><table class="label-value">
593 @ <tr><th>Version:</th><td>%s(zUuid)</td></tr>
594 @ <tr><th>Date:</th><td>
595 hyperlink_to_date(zDate, "</td></tr>");
596 if( g.okSetup ){
597 @ <tr><th>Record ID:</th><td>%d(rid)</td></tr>
598 }
599 @ <tr><th>Original&nbsp;User:</th><td>
600 hyperlink_to_user(zUser, zDate, "</td></tr>");
601 if( g.okHistory ){
602 @ <tr><th>Commands:</th>
603 @ <td>
604 @ <a href="%s(g.zTop)/whistory?name=%t(zName)">history</a>
605 @ | <a href="%s(g.zTop)/artifact/%S(zUuid)">raw-text</a>
606 @ </td>
@@ -701,11 +701,11 @@
701 int showDetail = 0;
702 Manifest *pFrom, *pTo;
703 ManifestFile *pFileFrom, *pFileTo;
704
705 login_check_credentials();
706 if( !g.okRead ){ login_needed(); return; }
707 login_anonymous_available();
708
709 pFrom = vdiff_parse_manifest("from", &ridFrom);
710 if( pFrom==0 ) return;
711 pTo = vdiff_parse_manifest("to", &ridTo);
@@ -820,11 +820,11 @@
820 }else if( mPerm==PERM_EXE ){
821 @ <li>Executable file
822 }else{
823 @ <li>File
824 }
825 if( g.okHistory ){
826 @ <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>
827 }else{
828 @ %h(zName)
829 }
830 @ <ul>
@@ -833,20 +833,20 @@
833 @ <li>
834 hyperlink_to_date(zDate,"");
835 @ - part of checkin
836 hyperlink_to_uuid(zVers);
837 if( zBr && zBr[0] ){
838 if( g.okHistory ){
839 @ on branch <a href="%s(g.zTop)/timeline?r=%T(zBr)">%h(zBr)</a>
840 }else{
841 @ on branch %h(zBr)
842 }
843 }
844 @ - %w(zCom) (user:
845 hyperlink_to_user(zUser,zDate,"");
846 @ )
847 if( g.okHistory ){
848 @ <a href="%s(g.zTop)/annotate?checkin=%S(zVers)&filename=%T(zName)">
849 @ [annotate]</a>
850 }
851 cnt++;
852 if( pDownloadName && blob_size(pDownloadName)==0 ){
@@ -873,11 +873,11 @@
873 if( cnt>0 ){
874 @ Also wiki page
875 }else{
876 @ Wiki page
877 }
878 if( g.okHistory ){
879 @ [<a href="%s(g.zTop)/wiki?name=%t(zPagename)">%h(zPagename)</a>]
880 }else{
881 @ [%h(zPagename)]
882 }
883 @ by
@@ -949,17 +949,17 @@
949 @ Also attachment "%h(zFilename)" to
950 }else{
951 @ Attachment "%h(zFilename)" to
952 }
953 if( strlen(zTarget)==UUID_SIZE && validate16(zTarget,UUID_SIZE) ){
954 if( g.okHistory && g.okRdTkt ){
955 @ ticket [<a href="%s(g.zTop)/tktview?name=%S(zTarget)">%S(zTarget)</a>]
956 }else{
957 @ ticket [%S(zTarget)]
958 }
959 }else{
960 if( g.okHistory && g.okRdWiki ){
961 @ wiki page [<a href="%s(g.zTop)/wiki?name=%t(zTarget)">%h(zTarget)</a>]
962 }else{
963 @ wiki page [%h(zTarget)]
964 }
965 }
@@ -975,11 +975,11 @@
975 if( cnt==0 ){
976 @ Control artifact.
977 if( pDownloadName && blob_size(pDownloadName)==0 ){
978 blob_appendf(pDownloadName, "%.10s.txt", zUuid);
979 }
980 }else if( linkToView && g.okHistory ){
981 @ <a href="%s(g.zTop)/artifact/%S(zUuid)">[view]</a>
982 }
983 }
984
985
@@ -997,11 +997,11 @@
997 Blob c1, c2, diff, *pOut;
998 char *zV1;
999 char *zV2;
1000
1001 login_check_credentials();
1002 if( !g.okRead ){ login_needed(); return; }
1003 v1 = name_to_rid_www("v1");
1004 v2 = name_to_rid_www("v2");
1005 if( v1==0 || v2==0 ) fossil_redirect_home();
1006 zV1 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v1);
1007 zV2 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v2);
@@ -1049,11 +1049,11 @@
1049 Blob content;
1050
1051 rid = name_to_rid_www("name");
1052 zMime = PD("m","application/x-fossil-artifact");
1053 login_check_credentials();
1054 if( !g.okRead ){ login_needed(); return; }
1055 if( rid==0 ) fossil_redirect_home();
1056 content_get(rid, &content);
1057 cgi_set_content_type(zMime);
1058 cgi_set_content(&content);
1059 }
@@ -1122,13 +1122,13 @@
1122 Blob downloadName;
1123 char *zUuid;
1124
1125 rid = name_to_rid_www("name");
1126 login_check_credentials();
1127 if( !g.okRead ){ login_needed(); return; }
1128 if( rid==0 ) fossil_redirect_home();
1129 if( g.okAdmin ){
1130 const char *zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid);
1131 if( db_exists("SELECT 1 FROM shun WHERE uuid='%s'", zUuid) ){
1132 style_submenu_element("Unshun","Unshun", "%s/shun?uuid=%s&amp;sub=1",
1133 g.zTop, zUuid);
1134 }else{
@@ -1269,13 +1269,13 @@
1269 if( rid==0 ){
1270 rid = name_to_rid_www("name");
1271 }
1272
1273 login_check_credentials();
1274 if( !g.okRead ){ login_needed(); return; }
1275 if( rid==0 ) fossil_redirect_home();
1276 if( g.okAdmin ){
1277 const char *zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid);
1278 if( db_exists("SELECT 1 FROM shun WHERE uuid='%s'", zUuid) ){
1279 style_submenu_element("Unshun","Unshun", "%s/shun?uuid=%s&amp;sub=1",
1280 g.zTop, zUuid);
1281 }else{
@@ -1356,15 +1356,15 @@
1356 const char *zUuid;
1357 char zTktName[20];
1358 Manifest *pTktChng;
1359
1360 login_check_credentials();
1361 if( !g.okRdTkt ){ login_needed(); return; }
1362 rid = name_to_rid_www("name");
1363 if( rid==0 ){ fossil_redirect_home(); }
1364 zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid);
1365 if( g.okAdmin ){
1366 if( db_exists("SELECT 1 FROM shun WHERE uuid='%s'", zUuid) ){
1367 style_submenu_element("Unshun","Unshun", "%s/shun?uuid=%s&amp;sub=1",
1368 g.zTop, zUuid);
1369 }else{
1370 style_submenu_element("Shun","Shun", "%s/shun?shun=%s#addshun",
@@ -1377,11 +1377,11 @@
1377 }
1378 style_header("Ticket Change Details");
1379 zDate = db_text(0, "SELECT datetime(%.12f)", pTktChng->rDate);
1380 memcpy(zTktName, pTktChng->zTicketUuid, 10);
1381 zTktName[10] = 0;
1382 if( g.okHistory ){
1383 @ <h2>Changes to ticket
1384 @ <a href="%s(pTktChng->zTicketUuid)">%s(zTktName)</a></h2>
1385 @
1386 @ <p>By %h(pTktChng->zUser) on %s(zDate). See also:
1387 @ <a href="%s(g.zTop)/artifact/%T(zUuid)">artifact content</a>, and
@@ -1617,11 +1617,11 @@
1617 char *zUuid;
1618 Blob comment;
1619 Stmt q;
1620
1621 login_check_credentials();
1622 if( !g.okWrite ){ login_needed(); return; }
1623 rid = name_to_typed_rid(P("r"), "ci");
1624 zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
1625 zComment = db_text(0, "SELECT coalesce(ecomment,comment)"
1626 " FROM event WHERE objid=%d", rid);
1627 if( zComment==0 ) fossil_redirect_home();
1628
--- src/info.c
+++ src/info.c
@@ -289,11 +289,11 @@
289 const char *zNew, /* blob.uuid after change. NULL for deletes */
290 const char *zOldName, /* Prior name. NULL if no name change. */
291 int showDiff, /* Show edit diffs if true */
292 int mperm /* executable or symlink permission for zNew */
293 ){
294 if( !g.perm.History ){
295 if( zNew==0 ){
296 @ <p>Deleted %h(zName)</p>
297 }else if( zOld==0 ){
298 @ <p>Added %h(zName)</p>
299 }else if( zOldName!=0 && fossil_strcmp(zName,zOldName)!=0 ){
@@ -366,11 +366,11 @@
366 const char *zName; /* Name of the checkin to be displayed */
367 const char *zUuid; /* UUID of zName */
368 const char *zParent; /* UUID of the parent checkin (if any) */
369
370 login_check_credentials();
371 if( !g.perm.Read ){ login_needed(); return; }
372 zName = P("name");
373 rid = name_to_rid_www("name");
374 if( rid==0 ){
375 style_header("Check-in Information Error");
376 @ No such object: %h(g.argv[2])
@@ -414,11 +414,11 @@
414 zDate = db_column_text(&q,1);
415 zOrigDate = db_column_text(&q, 4);
416 @ <div class="section">Overview</div>
417 @ <table class="label-value">
418 @ <tr><th>SHA1&nbsp;Hash:</th><td>%s(zUuid)
419 if( g.perm.Setup ){
420 @ (Record ID: %d(rid))
421 }
422 @ </td></tr>
423 @ <tr><th>Date:</th><td>
424 hyperlink_to_date(zDate, "</td></tr>");
@@ -439,11 +439,11 @@
439 @ <tr><th>Edited&nbsp;Comment:</th><td>%w(zEComment)</td></tr>
440 @ <tr><th>Original&nbsp;Comment:</th><td>%w(zComment)</td></tr>
441 }else{
442 @ <tr><th>Comment:</th><td>%w(zComment)</td></tr>
443 }
444 if( g.perm.Admin ){
445 db_prepare(&q,
446 "SELECT rcvfrom.ipaddr, user.login, datetime(rcvfrom.mtime)"
447 " FROM blob JOIN rcvfrom USING(rcvid) LEFT JOIN user USING(uid)"
448 " WHERE blob.rid=%d",
449 rid
@@ -456,11 +456,11 @@
456 @ <tr><th>Received&nbsp;From:</th>
457 @ <td>%h(zUser) @ %h(zIpAddr) on %s(zDate)</td></tr>
458 }
459 db_finalize(&q);
460 }
461 if( g.perm.History ){
462 const char *zProjName = db_get("project-name", "unnamed");
463 @ <tr><th>Timelines:</th><td>
464 @ <a href="%s(g.zTop)/timeline?f=%S(zUuid)">family</a>
465 if( zParent ){
466 @ | <a href="%s(g.zTop)/timeline?p=%S(zUuid)">ancestors</a>
@@ -482,20 +482,20 @@
482 db_finalize(&q);
483 @ </td></tr>
484 @ <tr><th>Other&nbsp;Links:</th>
485 @ <td>
486 @ <a href="%s(g.zTop)/dir?ci=%S(zUuid)">files</a>
487 if( g.perm.Zip ){
488 char *zUrl = mprintf("%s/tarball/%s-%S.tar.gz?uuid=%s",
489 g.zTop, zProjName, zUuid, zUuid);
490 @ | <a href="%s(zUrl)">Tarball</a>
491 @ | <a href="%s(g.zTop)/zip/%s(zProjName)-%S(zUuid).zip?uuid=%s(zUuid)">
492 @ ZIP archive</a>
493 fossil_free(zUrl);
494 }
495 @ | <a href="%s(g.zTop)/artifact/%S(zUuid)">manifest</a>
496 if( g.perm.Write ){
497 @ | <a href="%s(g.zTop)/ci_edit?r=%S(zUuid)">edit</a>
498 }
499 @ </td>
500 @ </tr>
501 }
@@ -558,11 +558,11 @@
558 void winfo_page(void){
559 Stmt q;
560 int rid;
561
562 login_check_credentials();
563 if( !g.perm.RdWiki ){ login_needed(); return; }
564 rid = name_to_rid_www("name");
565 if( rid==0 ){
566 style_header("Wiki Page Information Error");
567 @ No such object: %h(g.argv[2])
568 style_footer();
@@ -591,16 +591,16 @@
591 @ <div class="section">Overview</div>
592 @ <p><table class="label-value">
593 @ <tr><th>Version:</th><td>%s(zUuid)</td></tr>
594 @ <tr><th>Date:</th><td>
595 hyperlink_to_date(zDate, "</td></tr>");
596 if( g.perm.Setup ){
597 @ <tr><th>Record ID:</th><td>%d(rid)</td></tr>
598 }
599 @ <tr><th>Original&nbsp;User:</th><td>
600 hyperlink_to_user(zUser, zDate, "</td></tr>");
601 if( g.perm.History ){
602 @ <tr><th>Commands:</th>
603 @ <td>
604 @ <a href="%s(g.zTop)/whistory?name=%t(zName)">history</a>
605 @ | <a href="%s(g.zTop)/artifact/%S(zUuid)">raw-text</a>
606 @ </td>
@@ -701,11 +701,11 @@
701 int showDetail = 0;
702 Manifest *pFrom, *pTo;
703 ManifestFile *pFileFrom, *pFileTo;
704
705 login_check_credentials();
706 if( !g.perm.Read ){ login_needed(); return; }
707 login_anonymous_available();
708
709 pFrom = vdiff_parse_manifest("from", &ridFrom);
710 if( pFrom==0 ) return;
711 pTo = vdiff_parse_manifest("to", &ridTo);
@@ -820,11 +820,11 @@
820 }else if( mPerm==PERM_EXE ){
821 @ <li>Executable file
822 }else{
823 @ <li>File
824 }
825 if( g.perm.History ){
826 @ <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>
827 }else{
828 @ %h(zName)
829 }
830 @ <ul>
@@ -833,20 +833,20 @@
833 @ <li>
834 hyperlink_to_date(zDate,"");
835 @ - part of checkin
836 hyperlink_to_uuid(zVers);
837 if( zBr && zBr[0] ){
838 if( g.perm.History ){
839 @ on branch <a href="%s(g.zTop)/timeline?r=%T(zBr)">%h(zBr)</a>
840 }else{
841 @ on branch %h(zBr)
842 }
843 }
844 @ - %w(zCom) (user:
845 hyperlink_to_user(zUser,zDate,"");
846 @ )
847 if( g.perm.History ){
848 @ <a href="%s(g.zTop)/annotate?checkin=%S(zVers)&filename=%T(zName)">
849 @ [annotate]</a>
850 }
851 cnt++;
852 if( pDownloadName && blob_size(pDownloadName)==0 ){
@@ -873,11 +873,11 @@
873 if( cnt>0 ){
874 @ Also wiki page
875 }else{
876 @ Wiki page
877 }
878 if( g.perm.History ){
879 @ [<a href="%s(g.zTop)/wiki?name=%t(zPagename)">%h(zPagename)</a>]
880 }else{
881 @ [%h(zPagename)]
882 }
883 @ by
@@ -949,17 +949,17 @@
949 @ Also attachment "%h(zFilename)" to
950 }else{
951 @ Attachment "%h(zFilename)" to
952 }
953 if( strlen(zTarget)==UUID_SIZE && validate16(zTarget,UUID_SIZE) ){
954 if( g.perm.History && g.perm.RdTkt ){
955 @ ticket [<a href="%s(g.zTop)/tktview?name=%S(zTarget)">%S(zTarget)</a>]
956 }else{
957 @ ticket [%S(zTarget)]
958 }
959 }else{
960 if( g.perm.History && g.perm.RdWiki ){
961 @ wiki page [<a href="%s(g.zTop)/wiki?name=%t(zTarget)">%h(zTarget)</a>]
962 }else{
963 @ wiki page [%h(zTarget)]
964 }
965 }
@@ -975,11 +975,11 @@
975 if( cnt==0 ){
976 @ Control artifact.
977 if( pDownloadName && blob_size(pDownloadName)==0 ){
978 blob_appendf(pDownloadName, "%.10s.txt", zUuid);
979 }
980 }else if( linkToView && g.perm.History ){
981 @ <a href="%s(g.zTop)/artifact/%S(zUuid)">[view]</a>
982 }
983 }
984
985
@@ -997,11 +997,11 @@
997 Blob c1, c2, diff, *pOut;
998 char *zV1;
999 char *zV2;
1000
1001 login_check_credentials();
1002 if( !g.perm.Read ){ login_needed(); return; }
1003 v1 = name_to_rid_www("v1");
1004 v2 = name_to_rid_www("v2");
1005 if( v1==0 || v2==0 ) fossil_redirect_home();
1006 zV1 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v1);
1007 zV2 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v2);
@@ -1049,11 +1049,11 @@
1049 Blob content;
1050
1051 rid = name_to_rid_www("name");
1052 zMime = PD("m","application/x-fossil-artifact");
1053 login_check_credentials();
1054 if( !g.perm.Read ){ login_needed(); return; }
1055 if( rid==0 ) fossil_redirect_home();
1056 content_get(rid, &content);
1057 cgi_set_content_type(zMime);
1058 cgi_set_content(&content);
1059 }
@@ -1122,13 +1122,13 @@
1122 Blob downloadName;
1123 char *zUuid;
1124
1125 rid = name_to_rid_www("name");
1126 login_check_credentials();
1127 if( !g.perm.Read ){ login_needed(); return; }
1128 if( rid==0 ) fossil_redirect_home();
1129 if( g.perm.Admin ){
1130 const char *zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid);
1131 if( db_exists("SELECT 1 FROM shun WHERE uuid='%s'", zUuid) ){
1132 style_submenu_element("Unshun","Unshun", "%s/shun?uuid=%s&amp;sub=1",
1133 g.zTop, zUuid);
1134 }else{
@@ -1269,13 +1269,13 @@
1269 if( rid==0 ){
1270 rid = name_to_rid_www("name");
1271 }
1272
1273 login_check_credentials();
1274 if( !g.perm.Read ){ login_needed(); return; }
1275 if( rid==0 ) fossil_redirect_home();
1276 if( g.perm.Admin ){
1277 const char *zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid);
1278 if( db_exists("SELECT 1 FROM shun WHERE uuid='%s'", zUuid) ){
1279 style_submenu_element("Unshun","Unshun", "%s/shun?uuid=%s&amp;sub=1",
1280 g.zTop, zUuid);
1281 }else{
@@ -1356,15 +1356,15 @@
1356 const char *zUuid;
1357 char zTktName[20];
1358 Manifest *pTktChng;
1359
1360 login_check_credentials();
1361 if( !g.perm.RdTkt ){ login_needed(); return; }
1362 rid = name_to_rid_www("name");
1363 if( rid==0 ){ fossil_redirect_home(); }
1364 zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid);
1365 if( g.perm.Admin ){
1366 if( db_exists("SELECT 1 FROM shun WHERE uuid='%s'", zUuid) ){
1367 style_submenu_element("Unshun","Unshun", "%s/shun?uuid=%s&amp;sub=1",
1368 g.zTop, zUuid);
1369 }else{
1370 style_submenu_element("Shun","Shun", "%s/shun?shun=%s#addshun",
@@ -1377,11 +1377,11 @@
1377 }
1378 style_header("Ticket Change Details");
1379 zDate = db_text(0, "SELECT datetime(%.12f)", pTktChng->rDate);
1380 memcpy(zTktName, pTktChng->zTicketUuid, 10);
1381 zTktName[10] = 0;
1382 if( g.perm.History ){
1383 @ <h2>Changes to ticket
1384 @ <a href="%s(pTktChng->zTicketUuid)">%s(zTktName)</a></h2>
1385 @
1386 @ <p>By %h(pTktChng->zUser) on %s(zDate). See also:
1387 @ <a href="%s(g.zTop)/artifact/%T(zUuid)">artifact content</a>, and
@@ -1617,11 +1617,11 @@
1617 char *zUuid;
1618 Blob comment;
1619 Stmt q;
1620
1621 login_check_credentials();
1622 if( !g.perm.Write ){ login_needed(); return; }
1623 rid = name_to_typed_rid(P("r"), "ci");
1624 zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
1625 zComment = db_text(0, "SELECT coalesce(ecomment,comment)"
1626 " FROM event WHERE objid=%d", rid);
1627 if( zComment==0 ) fossil_redirect_home();
1628
+55 -76
--- src/login.c
+++ src/login.c
@@ -226,11 +226,11 @@
226226
/* To logout, change the cookie value to an empty string */
227227
const char *zCookieName = login_cookie_name();
228228
cgi_set_cookie(zCookieName, "", login_cookie_path(), -86400);
229229
redirect_to_g();
230230
}
231
- if( g.okPassword && zPasswd && (zNew1 = P("n1"))!=0 && (zNew2 = P("n2"))!=0 ){
231
+ if( g.perm.Password && zPasswd && (zNew1 = P("n1"))!=0 && (zNew2 = P("n2"))!=0 ){
232232
/* The user requests a password change */
233233
zSha1Pw = sha1_shared_secret(zPasswd, g.zLogin, 0);
234234
if( db_int(1, "SELECT 0 FROM user"
235235
" WHERE uid=%d AND (pw=%Q OR pw=%Q)",
236236
g.userUid, zPasswd, zSha1Pw) ){
@@ -431,11 +431,11 @@
431431
@ <p>To log off the system (and delete your login cookie)
432432
@ press the following button:<br />
433433
@ <input type="submit" name="out" value="Logout" /></p>
434434
}
435435
@ </form>
436
- if( g.okPassword ){
436
+ if( g.perm.Password ){
437437
@ <hr />
438438
@ <p>To change your password, enter your old password and your
439439
@ new password twice below then press the "Change Password"
440440
@ button.</p>
441441
@ <form action="login" method="post">
@@ -541,11 +541,11 @@
541541
542542
/*
543543
** This routine examines the login cookie to see if it exists and
544544
** and is valid. If the login cookie checks out, it then sets
545545
** global variables appropriately. Global variables set include
546
-** g.userUid and g.zLogin and of the g.okRead family of permission
546
+** g.userUid and g.zLogin and of the g.perm.Read family of permission
547547
** booleans.
548548
**
549549
*/
550550
void login_check_credentials(void){
551551
int uid = 0; /* User id */
@@ -725,40 +725,40 @@
725725
*/
726726
void login_set_capabilities(const char *zCap, unsigned flags){
727727
int i;
728728
for(i=0; zCap[i]; i++){
729729
switch( zCap[i] ){
730
- case 's': g.okSetup = 1; /* Fall thru into Admin */
731
- case 'a': g.okAdmin = g.okRdTkt = g.okWrTkt = g.okZip =
732
- g.okRdWiki = g.okWrWiki = g.okNewWiki =
733
- g.okApndWiki = g.okHistory = g.okClone =
734
- g.okNewTkt = g.okPassword = g.okRdAddr =
735
- g.okTktFmt = g.okAttach = g.okApndTkt = 1;
730
+ case 's': g.perm.Setup = 1; /* Fall thru into Admin */
731
+ case 'a': g.perm.Admin = g.perm.RdTkt = g.perm.WrTkt = g.perm.Zip =
732
+ g.perm.RdWiki = g.perm.WrWiki = g.perm.NewWiki =
733
+ g.perm.ApndWiki = g.perm.History = g.perm.Clone =
734
+ g.perm.NewTkt = g.perm.Password = g.perm.RdAddr =
735
+ g.perm.TktFmt = g.perm.Attach = g.perm.ApndTkt = 1;
736736
/* Fall thru into Read/Write */
737
- case 'i': g.okRead = g.okWrite = 1; break;
738
- case 'o': g.okRead = 1; break;
739
- case 'z': g.okZip = 1; break;
740
-
741
- case 'd': g.okDelete = 1; break;
742
- case 'h': g.okHistory = 1; break;
743
- case 'g': g.okClone = 1; break;
744
- case 'p': g.okPassword = 1; break;
745
-
746
- case 'j': g.okRdWiki = 1; break;
747
- case 'k': g.okWrWiki = g.okRdWiki = g.okApndWiki =1; break;
748
- case 'm': g.okApndWiki = 1; break;
749
- case 'f': g.okNewWiki = 1; break;
750
-
751
- case 'e': g.okRdAddr = 1; break;
752
- case 'r': g.okRdTkt = 1; break;
753
- case 'n': g.okNewTkt = 1; break;
754
- case 'w': g.okWrTkt = g.okRdTkt = g.okNewTkt =
755
- g.okApndTkt = 1; break;
756
- case 'c': g.okApndTkt = 1; break;
757
- case 't': g.okTktFmt = 1; break;
758
- case 'b': g.okAttach = 1; break;
759
- case 'x': g.okPrivate = 1; break;
737
+ case 'i': g.perm.Read = g.perm.Write = 1; break;
738
+ case 'o': g.perm.Read = 1; break;
739
+ case 'z': g.perm.Zip = 1; break;
740
+
741
+ case 'd': g.perm.Delete = 1; break;
742
+ case 'h': g.perm.History = 1; break;
743
+ case 'g': g.perm.Clone = 1; break;
744
+ case 'p': g.perm.Password = 1; break;
745
+
746
+ case 'j': g.perm.RdWiki = 1; break;
747
+ case 'k': g.perm.WrWiki = g.perm.RdWiki = g.perm.ApndWiki =1; break;
748
+ case 'm': g.perm.ApndWiki = 1; break;
749
+ case 'f': g.perm.NewWiki = 1; break;
750
+
751
+ case 'e': g.perm.RdAddr = 1; break;
752
+ case 'r': g.perm.RdTkt = 1; break;
753
+ case 'n': g.perm.NewTkt = 1; break;
754
+ case 'w': g.perm.WrTkt = g.perm.RdTkt = g.perm.NewTkt =
755
+ g.perm.ApndTkt = 1; break;
756
+ case 'c': g.perm.ApndTkt = 1; break;
757
+ case 't': g.perm.TktFmt = 1; break;
758
+ case 'b': g.perm.Attach = 1; break;
759
+ case 'x': g.perm.Private = 1; break;
760760
761761
/* The "u" privileges is a little different. It recursively
762762
** inherits all privileges of the user named "reader" */
763763
case 'u': {
764764
if( (flags & LOGIN_IGNORE_U)==0 ){
@@ -792,36 +792,36 @@
792792
int i;
793793
int rc = 1;
794794
if( nCap<0 ) nCap = strlen(zCap);
795795
for(i=0; i<nCap && rc && zCap[i]; i++){
796796
switch( zCap[i] ){
797
- case 'a': rc = g.okAdmin; break;
798
- case 'b': rc = g.okAttach; break;
799
- case 'c': rc = g.okApndTkt; break;
800
- case 'd': rc = g.okDelete; break;
801
- case 'e': rc = g.okRdAddr; break;
802
- case 'f': rc = g.okNewWiki; break;
803
- case 'g': rc = g.okClone; break;
804
- case 'h': rc = g.okHistory; break;
805
- case 'i': rc = g.okWrite; break;
806
- case 'j': rc = g.okRdWiki; break;
807
- case 'k': rc = g.okWrWiki; break;
797
+ case 'a': rc = g.perm.Admin; break;
798
+ case 'b': rc = g.perm.Attach; break;
799
+ case 'c': rc = g.perm.ApndTkt; break;
800
+ case 'd': rc = g.perm.Delete; break;
801
+ case 'e': rc = g.perm.RdAddr; break;
802
+ case 'f': rc = g.perm.NewWiki; break;
803
+ case 'g': rc = g.perm.Clone; break;
804
+ case 'h': rc = g.perm.History; break;
805
+ case 'i': rc = g.perm.Write; break;
806
+ case 'j': rc = g.perm.RdWiki; break;
807
+ case 'k': rc = g.perm.WrWiki; break;
808808
/* case 'l': */
809
- case 'm': rc = g.okApndWiki; break;
810
- case 'n': rc = g.okNewTkt; break;
811
- case 'o': rc = g.okRead; break;
812
- case 'p': rc = g.okPassword; break;
809
+ case 'm': rc = g.perm.ApndWiki; break;
810
+ case 'n': rc = g.perm.NewTkt; break;
811
+ case 'o': rc = g.perm.Read; break;
812
+ case 'p': rc = g.perm.Password; break;
813813
/* case 'q': */
814
- case 'r': rc = g.okRdTkt; break;
815
- case 's': rc = g.okSetup; break;
816
- case 't': rc = g.okTktFmt; break;
814
+ case 'r': rc = g.perm.RdTkt; break;
815
+ case 's': rc = g.perm.Setup; break;
816
+ case 't': rc = g.perm.TktFmt; break;
817817
/* case 'u': READER */
818818
/* case 'v': DEVELOPER */
819
- case 'w': rc = g.okWrTkt; break;
820
- case 'x': rc = g.okPrivate; break;
819
+ case 'w': rc = g.perm.WrTkt; break;
820
+ case 'x': rc = g.perm.Private; break;
821821
/* case 'y': */
822
- case 'z': rc = g.okZip; break;
822
+ case 'z': rc = g.perm.Zip; break;
823823
default: rc = 0; break;
824824
}
825825
}
826826
return rc;
827827
}
@@ -831,32 +831,11 @@
831831
*/
832832
void login_as_user(const char *zUser){
833833
char *zCap = ""; /* New capabilities */
834834
835835
/* Turn off all capabilities from prior logins */
836
- g.okSetup = 0;
837
- g.okAdmin = 0;
838
- g.okDelete = 0;
839
- g.okPassword = 0;
840
- g.okQuery = 0;
841
- g.okWrite = 0;
842
- g.okRead = 0;
843
- g.okHistory = 0;
844
- g.okClone = 0;
845
- g.okRdWiki = 0;
846
- g.okNewWiki = 0;
847
- g.okApndWiki = 0;
848
- g.okWrWiki = 0;
849
- g.okRdTkt = 0;
850
- g.okNewTkt = 0;
851
- g.okApndTkt = 0;
852
- g.okWrTkt = 0;
853
- g.okAttach = 0;
854
- g.okTktFmt = 0;
855
- g.okRdAddr = 0;
856
- g.okZip = 0;
857
- g.okPrivate = 0;
836
+ memset( &g.perm, 0, sizeof(g.perm) );
858837
859838
/* Set the global variables recording the userid and login. The
860839
** "nobody" user is a special case in that g.zLogin==0.
861840
*/
862841
g.userUid = db_int(0, "SELECT uid FROM user WHERE login=%Q", zUser);
@@ -892,11 +871,11 @@
892871
** the anonymous user has okHistory permission, then paint a mesage
893872
** to inform the user that much more information is available by
894873
** logging in as anonymous.
895874
*/
896875
void login_anonymous_available(void){
897
- if( !g.okHistory &&
876
+ if( !g.perm.History &&
898877
db_exists("SELECT 1 FROM user"
899878
" WHERE login='anonymous'"
900879
" AND cap LIKE '%%h%%'") ){
901880
const char *zUrl = PD("REQUEST_URI", "index");
902881
@ <p>Many <span class="disabled">hyperlinks are disabled.</span><br />
903882
--- src/login.c
+++ src/login.c
@@ -226,11 +226,11 @@
226 /* To logout, change the cookie value to an empty string */
227 const char *zCookieName = login_cookie_name();
228 cgi_set_cookie(zCookieName, "", login_cookie_path(), -86400);
229 redirect_to_g();
230 }
231 if( g.okPassword && zPasswd && (zNew1 = P("n1"))!=0 && (zNew2 = P("n2"))!=0 ){
232 /* The user requests a password change */
233 zSha1Pw = sha1_shared_secret(zPasswd, g.zLogin, 0);
234 if( db_int(1, "SELECT 0 FROM user"
235 " WHERE uid=%d AND (pw=%Q OR pw=%Q)",
236 g.userUid, zPasswd, zSha1Pw) ){
@@ -431,11 +431,11 @@
431 @ <p>To log off the system (and delete your login cookie)
432 @ press the following button:<br />
433 @ <input type="submit" name="out" value="Logout" /></p>
434 }
435 @ </form>
436 if( g.okPassword ){
437 @ <hr />
438 @ <p>To change your password, enter your old password and your
439 @ new password twice below then press the "Change Password"
440 @ button.</p>
441 @ <form action="login" method="post">
@@ -541,11 +541,11 @@
541
542 /*
543 ** This routine examines the login cookie to see if it exists and
544 ** and is valid. If the login cookie checks out, it then sets
545 ** global variables appropriately. Global variables set include
546 ** g.userUid and g.zLogin and of the g.okRead family of permission
547 ** booleans.
548 **
549 */
550 void login_check_credentials(void){
551 int uid = 0; /* User id */
@@ -725,40 +725,40 @@
725 */
726 void login_set_capabilities(const char *zCap, unsigned flags){
727 int i;
728 for(i=0; zCap[i]; i++){
729 switch( zCap[i] ){
730 case 's': g.okSetup = 1; /* Fall thru into Admin */
731 case 'a': g.okAdmin = g.okRdTkt = g.okWrTkt = g.okZip =
732 g.okRdWiki = g.okWrWiki = g.okNewWiki =
733 g.okApndWiki = g.okHistory = g.okClone =
734 g.okNewTkt = g.okPassword = g.okRdAddr =
735 g.okTktFmt = g.okAttach = g.okApndTkt = 1;
736 /* Fall thru into Read/Write */
737 case 'i': g.okRead = g.okWrite = 1; break;
738 case 'o': g.okRead = 1; break;
739 case 'z': g.okZip = 1; break;
740
741 case 'd': g.okDelete = 1; break;
742 case 'h': g.okHistory = 1; break;
743 case 'g': g.okClone = 1; break;
744 case 'p': g.okPassword = 1; break;
745
746 case 'j': g.okRdWiki = 1; break;
747 case 'k': g.okWrWiki = g.okRdWiki = g.okApndWiki =1; break;
748 case 'm': g.okApndWiki = 1; break;
749 case 'f': g.okNewWiki = 1; break;
750
751 case 'e': g.okRdAddr = 1; break;
752 case 'r': g.okRdTkt = 1; break;
753 case 'n': g.okNewTkt = 1; break;
754 case 'w': g.okWrTkt = g.okRdTkt = g.okNewTkt =
755 g.okApndTkt = 1; break;
756 case 'c': g.okApndTkt = 1; break;
757 case 't': g.okTktFmt = 1; break;
758 case 'b': g.okAttach = 1; break;
759 case 'x': g.okPrivate = 1; break;
760
761 /* The "u" privileges is a little different. It recursively
762 ** inherits all privileges of the user named "reader" */
763 case 'u': {
764 if( (flags & LOGIN_IGNORE_U)==0 ){
@@ -792,36 +792,36 @@
792 int i;
793 int rc = 1;
794 if( nCap<0 ) nCap = strlen(zCap);
795 for(i=0; i<nCap && rc && zCap[i]; i++){
796 switch( zCap[i] ){
797 case 'a': rc = g.okAdmin; break;
798 case 'b': rc = g.okAttach; break;
799 case 'c': rc = g.okApndTkt; break;
800 case 'd': rc = g.okDelete; break;
801 case 'e': rc = g.okRdAddr; break;
802 case 'f': rc = g.okNewWiki; break;
803 case 'g': rc = g.okClone; break;
804 case 'h': rc = g.okHistory; break;
805 case 'i': rc = g.okWrite; break;
806 case 'j': rc = g.okRdWiki; break;
807 case 'k': rc = g.okWrWiki; break;
808 /* case 'l': */
809 case 'm': rc = g.okApndWiki; break;
810 case 'n': rc = g.okNewTkt; break;
811 case 'o': rc = g.okRead; break;
812 case 'p': rc = g.okPassword; break;
813 /* case 'q': */
814 case 'r': rc = g.okRdTkt; break;
815 case 's': rc = g.okSetup; break;
816 case 't': rc = g.okTktFmt; break;
817 /* case 'u': READER */
818 /* case 'v': DEVELOPER */
819 case 'w': rc = g.okWrTkt; break;
820 case 'x': rc = g.okPrivate; break;
821 /* case 'y': */
822 case 'z': rc = g.okZip; break;
823 default: rc = 0; break;
824 }
825 }
826 return rc;
827 }
@@ -831,32 +831,11 @@
831 */
832 void login_as_user(const char *zUser){
833 char *zCap = ""; /* New capabilities */
834
835 /* Turn off all capabilities from prior logins */
836 g.okSetup = 0;
837 g.okAdmin = 0;
838 g.okDelete = 0;
839 g.okPassword = 0;
840 g.okQuery = 0;
841 g.okWrite = 0;
842 g.okRead = 0;
843 g.okHistory = 0;
844 g.okClone = 0;
845 g.okRdWiki = 0;
846 g.okNewWiki = 0;
847 g.okApndWiki = 0;
848 g.okWrWiki = 0;
849 g.okRdTkt = 0;
850 g.okNewTkt = 0;
851 g.okApndTkt = 0;
852 g.okWrTkt = 0;
853 g.okAttach = 0;
854 g.okTktFmt = 0;
855 g.okRdAddr = 0;
856 g.okZip = 0;
857 g.okPrivate = 0;
858
859 /* Set the global variables recording the userid and login. The
860 ** "nobody" user is a special case in that g.zLogin==0.
861 */
862 g.userUid = db_int(0, "SELECT uid FROM user WHERE login=%Q", zUser);
@@ -892,11 +871,11 @@
892 ** the anonymous user has okHistory permission, then paint a mesage
893 ** to inform the user that much more information is available by
894 ** logging in as anonymous.
895 */
896 void login_anonymous_available(void){
897 if( !g.okHistory &&
898 db_exists("SELECT 1 FROM user"
899 " WHERE login='anonymous'"
900 " AND cap LIKE '%%h%%'") ){
901 const char *zUrl = PD("REQUEST_URI", "index");
902 @ <p>Many <span class="disabled">hyperlinks are disabled.</span><br />
903
--- src/login.c
+++ src/login.c
@@ -226,11 +226,11 @@
226 /* To logout, change the cookie value to an empty string */
227 const char *zCookieName = login_cookie_name();
228 cgi_set_cookie(zCookieName, "", login_cookie_path(), -86400);
229 redirect_to_g();
230 }
231 if( g.perm.Password && zPasswd && (zNew1 = P("n1"))!=0 && (zNew2 = P("n2"))!=0 ){
232 /* The user requests a password change */
233 zSha1Pw = sha1_shared_secret(zPasswd, g.zLogin, 0);
234 if( db_int(1, "SELECT 0 FROM user"
235 " WHERE uid=%d AND (pw=%Q OR pw=%Q)",
236 g.userUid, zPasswd, zSha1Pw) ){
@@ -431,11 +431,11 @@
431 @ <p>To log off the system (and delete your login cookie)
432 @ press the following button:<br />
433 @ <input type="submit" name="out" value="Logout" /></p>
434 }
435 @ </form>
436 if( g.perm.Password ){
437 @ <hr />
438 @ <p>To change your password, enter your old password and your
439 @ new password twice below then press the "Change Password"
440 @ button.</p>
441 @ <form action="login" method="post">
@@ -541,11 +541,11 @@
541
542 /*
543 ** This routine examines the login cookie to see if it exists and
544 ** and is valid. If the login cookie checks out, it then sets
545 ** global variables appropriately. Global variables set include
546 ** g.userUid and g.zLogin and of the g.perm.Read family of permission
547 ** booleans.
548 **
549 */
550 void login_check_credentials(void){
551 int uid = 0; /* User id */
@@ -725,40 +725,40 @@
725 */
726 void login_set_capabilities(const char *zCap, unsigned flags){
727 int i;
728 for(i=0; zCap[i]; i++){
729 switch( zCap[i] ){
730 case 's': g.perm.Setup = 1; /* Fall thru into Admin */
731 case 'a': g.perm.Admin = g.perm.RdTkt = g.perm.WrTkt = g.perm.Zip =
732 g.perm.RdWiki = g.perm.WrWiki = g.perm.NewWiki =
733 g.perm.ApndWiki = g.perm.History = g.perm.Clone =
734 g.perm.NewTkt = g.perm.Password = g.perm.RdAddr =
735 g.perm.TktFmt = g.perm.Attach = g.perm.ApndTkt = 1;
736 /* Fall thru into Read/Write */
737 case 'i': g.perm.Read = g.perm.Write = 1; break;
738 case 'o': g.perm.Read = 1; break;
739 case 'z': g.perm.Zip = 1; break;
740
741 case 'd': g.perm.Delete = 1; break;
742 case 'h': g.perm.History = 1; break;
743 case 'g': g.perm.Clone = 1; break;
744 case 'p': g.perm.Password = 1; break;
745
746 case 'j': g.perm.RdWiki = 1; break;
747 case 'k': g.perm.WrWiki = g.perm.RdWiki = g.perm.ApndWiki =1; break;
748 case 'm': g.perm.ApndWiki = 1; break;
749 case 'f': g.perm.NewWiki = 1; break;
750
751 case 'e': g.perm.RdAddr = 1; break;
752 case 'r': g.perm.RdTkt = 1; break;
753 case 'n': g.perm.NewTkt = 1; break;
754 case 'w': g.perm.WrTkt = g.perm.RdTkt = g.perm.NewTkt =
755 g.perm.ApndTkt = 1; break;
756 case 'c': g.perm.ApndTkt = 1; break;
757 case 't': g.perm.TktFmt = 1; break;
758 case 'b': g.perm.Attach = 1; break;
759 case 'x': g.perm.Private = 1; break;
760
761 /* The "u" privileges is a little different. It recursively
762 ** inherits all privileges of the user named "reader" */
763 case 'u': {
764 if( (flags & LOGIN_IGNORE_U)==0 ){
@@ -792,36 +792,36 @@
792 int i;
793 int rc = 1;
794 if( nCap<0 ) nCap = strlen(zCap);
795 for(i=0; i<nCap && rc && zCap[i]; i++){
796 switch( zCap[i] ){
797 case 'a': rc = g.perm.Admin; break;
798 case 'b': rc = g.perm.Attach; break;
799 case 'c': rc = g.perm.ApndTkt; break;
800 case 'd': rc = g.perm.Delete; break;
801 case 'e': rc = g.perm.RdAddr; break;
802 case 'f': rc = g.perm.NewWiki; break;
803 case 'g': rc = g.perm.Clone; break;
804 case 'h': rc = g.perm.History; break;
805 case 'i': rc = g.perm.Write; break;
806 case 'j': rc = g.perm.RdWiki; break;
807 case 'k': rc = g.perm.WrWiki; break;
808 /* case 'l': */
809 case 'm': rc = g.perm.ApndWiki; break;
810 case 'n': rc = g.perm.NewTkt; break;
811 case 'o': rc = g.perm.Read; break;
812 case 'p': rc = g.perm.Password; break;
813 /* case 'q': */
814 case 'r': rc = g.perm.RdTkt; break;
815 case 's': rc = g.perm.Setup; break;
816 case 't': rc = g.perm.TktFmt; break;
817 /* case 'u': READER */
818 /* case 'v': DEVELOPER */
819 case 'w': rc = g.perm.WrTkt; break;
820 case 'x': rc = g.perm.Private; break;
821 /* case 'y': */
822 case 'z': rc = g.perm.Zip; break;
823 default: rc = 0; break;
824 }
825 }
826 return rc;
827 }
@@ -831,32 +831,11 @@
831 */
832 void login_as_user(const char *zUser){
833 char *zCap = ""; /* New capabilities */
834
835 /* Turn off all capabilities from prior logins */
836 memset( &g.perm, 0, sizeof(g.perm) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
837
838 /* Set the global variables recording the userid and login. The
839 ** "nobody" user is a special case in that g.zLogin==0.
840 */
841 g.userUid = db_int(0, "SELECT uid FROM user WHERE login=%Q", zUser);
@@ -892,11 +871,11 @@
871 ** the anonymous user has okHistory permission, then paint a mesage
872 ** to inform the user that much more information is available by
873 ** logging in as anonymous.
874 */
875 void login_anonymous_available(void){
876 if( !g.perm.History &&
877 db_exists("SELECT 1 FROM user"
878 " WHERE login='anonymous'"
879 " AND cap LIKE '%%h%%'") ){
880 const char *zUrl = PD("REQUEST_URI", "index");
881 @ <p>Many <span class="disabled">hyperlinks are disabled.</span><br />
882
+30 -23
--- src/main.c
+++ src/main.c
@@ -42,10 +42,38 @@
4242
/*
4343
** Maximum number of auxiliary parameters on reports
4444
*/
4545
#define MX_AUX 5
4646
47
+/*
48
+** Holds flags for fossil user permissions.
49
+*/
50
+struct FossilUserPerms {
51
+ char Setup; /* s: use Setup screens on web interface */
52
+ char Admin; /* a: administrative permission */
53
+ char Delete; /* d: delete wiki or tickets */
54
+ char Password; /* p: change password */
55
+ char Query; /* q: create new reports */
56
+ char Write; /* i: xfer inbound. checkin */
57
+ char Read; /* o: xfer outbound. checkout */
58
+ char History; /* h: access historical information. */
59
+ char Clone; /* g: clone */
60
+ char RdWiki; /* j: view wiki via web */
61
+ char NewWiki; /* f: create new wiki via web */
62
+ char ApndWiki; /* m: append to wiki via web */
63
+ char WrWiki; /* k: edit wiki via web */
64
+ char RdTkt; /* r: view tickets via web */
65
+ char NewTkt; /* n: create new tickets */
66
+ char ApndTkt; /* c: append to tickets via the web */
67
+ char WrTkt; /* w: make changes to tickets via web */
68
+ char Attach; /* b: add attachments */
69
+ char TktFmt; /* t: create new ticket report formats */
70
+ char RdAddr; /* e: read email addresses or other private data */
71
+ char Zip; /* z: download zipped artifact via /zip URL */
72
+ char Private; /* x: can send and receive private content */
73
+};
74
+
4775
/*
4876
** All global variables are in this structure.
4977
*/
5078
struct Global {
5179
int argc; char **argv; /* Command-line arguments to the program */
@@ -116,32 +144,11 @@
116144
int rcvid; /* The rcvid. 0 if not yet defined. */
117145
char *zIpAddr; /* The remote IP address */
118146
char *zNonce; /* The nonce used for login */
119147
120148
/* permissions used by the server */
121
- int okSetup; /* s: use Setup screens on web interface */
122
- int okAdmin; /* a: administrative permission */
123
- int okDelete; /* d: delete wiki or tickets */
124
- int okPassword; /* p: change password */
125
- int okQuery; /* q: create new reports */
126
- int okWrite; /* i: xfer inbound. checkin */
127
- int okRead; /* o: xfer outbound. checkout */
128
- int okHistory; /* h: access historical information. */
129
- int okClone; /* g: clone */
130
- int okRdWiki; /* j: view wiki via web */
131
- int okNewWiki; /* f: create new wiki via web */
132
- int okApndWiki; /* m: append to wiki via web */
133
- int okWrWiki; /* k: edit wiki via web */
134
- int okRdTkt; /* r: view tickets via web */
135
- int okNewTkt; /* n: create new tickets */
136
- int okApndTkt; /* c: append to tickets via the web */
137
- int okWrTkt; /* w: make changes to tickets via web */
138
- int okAttach; /* b: add attachments */
139
- int okTktFmt; /* t: create new ticket report formats */
140
- int okRdAddr; /* e: read email addresses or other private data */
141
- int okZip; /* z: download zipped artifact via /zip URL */
142
- int okPrivate; /* x: can send and receive private content */
149
+ struct FossilUserPerms perm;
143150
144151
/* For defense against Cross-site Request Forgery attacks */
145152
char zCsrfToken[12]; /* Value of the anti-CSRF token */
146153
int okCsrf; /* Anti-CSRF token is present and valid */
147154
@@ -1008,11 +1015,11 @@
10081015
file_simplify_name(zAltRepo, -1);
10091016
}
10101017
db_close(1);
10111018
db_open_repository(zAltRepo);
10121019
login_as_user(zUser);
1013
- g.okPassword = 0;
1020
+ g.perm.Password = 0;
10141021
zPath += i;
10151022
nHost = g.zTop - g.zBaseURL;
10161023
g.zBaseURL = mprintf("%z/%s", g.zBaseURL, g.zPath);
10171024
g.zTop = g.zBaseURL + nHost;
10181025
continue;
10191026
--- src/main.c
+++ src/main.c
@@ -42,10 +42,38 @@
42 /*
43 ** Maximum number of auxiliary parameters on reports
44 */
45 #define MX_AUX 5
46
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47 /*
48 ** All global variables are in this structure.
49 */
50 struct Global {
51 int argc; char **argv; /* Command-line arguments to the program */
@@ -116,32 +144,11 @@
116 int rcvid; /* The rcvid. 0 if not yet defined. */
117 char *zIpAddr; /* The remote IP address */
118 char *zNonce; /* The nonce used for login */
119
120 /* permissions used by the server */
121 int okSetup; /* s: use Setup screens on web interface */
122 int okAdmin; /* a: administrative permission */
123 int okDelete; /* d: delete wiki or tickets */
124 int okPassword; /* p: change password */
125 int okQuery; /* q: create new reports */
126 int okWrite; /* i: xfer inbound. checkin */
127 int okRead; /* o: xfer outbound. checkout */
128 int okHistory; /* h: access historical information. */
129 int okClone; /* g: clone */
130 int okRdWiki; /* j: view wiki via web */
131 int okNewWiki; /* f: create new wiki via web */
132 int okApndWiki; /* m: append to wiki via web */
133 int okWrWiki; /* k: edit wiki via web */
134 int okRdTkt; /* r: view tickets via web */
135 int okNewTkt; /* n: create new tickets */
136 int okApndTkt; /* c: append to tickets via the web */
137 int okWrTkt; /* w: make changes to tickets via web */
138 int okAttach; /* b: add attachments */
139 int okTktFmt; /* t: create new ticket report formats */
140 int okRdAddr; /* e: read email addresses or other private data */
141 int okZip; /* z: download zipped artifact via /zip URL */
142 int okPrivate; /* x: can send and receive private content */
143
144 /* For defense against Cross-site Request Forgery attacks */
145 char zCsrfToken[12]; /* Value of the anti-CSRF token */
146 int okCsrf; /* Anti-CSRF token is present and valid */
147
@@ -1008,11 +1015,11 @@
1008 file_simplify_name(zAltRepo, -1);
1009 }
1010 db_close(1);
1011 db_open_repository(zAltRepo);
1012 login_as_user(zUser);
1013 g.okPassword = 0;
1014 zPath += i;
1015 nHost = g.zTop - g.zBaseURL;
1016 g.zBaseURL = mprintf("%z/%s", g.zBaseURL, g.zPath);
1017 g.zTop = g.zBaseURL + nHost;
1018 continue;
1019
--- src/main.c
+++ src/main.c
@@ -42,10 +42,38 @@
42 /*
43 ** Maximum number of auxiliary parameters on reports
44 */
45 #define MX_AUX 5
46
47 /*
48 ** Holds flags for fossil user permissions.
49 */
50 struct FossilUserPerms {
51 char Setup; /* s: use Setup screens on web interface */
52 char Admin; /* a: administrative permission */
53 char Delete; /* d: delete wiki or tickets */
54 char Password; /* p: change password */
55 char Query; /* q: create new reports */
56 char Write; /* i: xfer inbound. checkin */
57 char Read; /* o: xfer outbound. checkout */
58 char History; /* h: access historical information. */
59 char Clone; /* g: clone */
60 char RdWiki; /* j: view wiki via web */
61 char NewWiki; /* f: create new wiki via web */
62 char ApndWiki; /* m: append to wiki via web */
63 char WrWiki; /* k: edit wiki via web */
64 char RdTkt; /* r: view tickets via web */
65 char NewTkt; /* n: create new tickets */
66 char ApndTkt; /* c: append to tickets via the web */
67 char WrTkt; /* w: make changes to tickets via web */
68 char Attach; /* b: add attachments */
69 char TktFmt; /* t: create new ticket report formats */
70 char RdAddr; /* e: read email addresses or other private data */
71 char Zip; /* z: download zipped artifact via /zip URL */
72 char Private; /* x: can send and receive private content */
73 };
74
75 /*
76 ** All global variables are in this structure.
77 */
78 struct Global {
79 int argc; char **argv; /* Command-line arguments to the program */
@@ -116,32 +144,11 @@
144 int rcvid; /* The rcvid. 0 if not yet defined. */
145 char *zIpAddr; /* The remote IP address */
146 char *zNonce; /* The nonce used for login */
147
148 /* permissions used by the server */
149 struct FossilUserPerms perm;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
150
151 /* For defense against Cross-site Request Forgery attacks */
152 char zCsrfToken[12]; /* Value of the anti-CSRF token */
153 int okCsrf; /* Anti-CSRF token is present and valid */
154
@@ -1008,11 +1015,11 @@
1015 file_simplify_name(zAltRepo, -1);
1016 }
1017 db_close(1);
1018 db_open_repository(zAltRepo);
1019 login_as_user(zUser);
1020 g.perm.Password = 0;
1021 zPath += i;
1022 nHost = g.zTop - g.zBaseURL;
1023 g.zBaseURL = mprintf("%z/%s", g.zBaseURL, g.zPath);
1024 g.zTop = g.zBaseURL + nHost;
1025 continue;
1026
+23 -23
--- src/report.c
+++ src/report.c
@@ -34,11 +34,11 @@
3434
Stmt q;
3535
int rn = 0;
3636
int cnt = 0;
3737
3838
login_check_credentials();
39
- if( !g.okRdTkt && !g.okNewTkt ){ login_needed(); return; }
39
+ if( !g.perm.RdTkt && !g.perm.NewTkt ){ login_needed(); return; }
4040
style_header("Ticket Main Menu");
4141
if( g.thTrace ) Th_Trace("BEGIN_REPORTLIST<br />\n", -1);
4242
zScript = ticket_reportlist_code();
4343
if( g.thTrace ) Th_Trace("BEGIN_REPORTLIST_SCRIPT<br />\n", -1);
4444
@@ -47,11 +47,11 @@
4747
4848
db_prepare(&q, "SELECT rn, title, owner FROM reportfmt ORDER BY title");
4949
while( db_step(&q)==SQLITE_ROW ){
5050
const char *zTitle = db_column_text(&q, 1);
5151
const char *zOwner = db_column_text(&q, 2);
52
- if( zTitle[0] =='_' && !g.okTktFmt ){
52
+ if( zTitle[0] =='_' && !g.perm.TktFmt ){
5353
continue;
5454
}
5555
rn = db_column_int(&q, 0);
5656
cnt++;
5757
blob_appendf(&ril, "<li>");
@@ -59,22 +59,22 @@
5959
blob_appendf(&ril, "%s", zTitle);
6060
} else {
6161
blob_appendf(&ril, "<a href=\"rptview?rn=%d\" rel=\"nofollow\">%h</a>", rn, zTitle);
6262
}
6363
blob_appendf(&ril, "&nbsp;&nbsp;&nbsp;");
64
- if( g.okWrite && zOwner && zOwner[0] ){
64
+ if( g.perm.Write && zOwner && zOwner[0] ){
6565
blob_appendf(&ril, "(by <i>%h</i></i>) ", zOwner);
6666
}
67
- if( g.okTktFmt ){
67
+ if( g.perm.TktFmt ){
6868
blob_appendf(&ril, "[<a href=\"rptedit?rn=%d&amp;copy=1\" rel=\"nofollow\">copy</a>] ", rn);
6969
}
70
- if( g.okAdmin
71
- || (g.okWrTkt && zOwner && fossil_strcmp(g.zLogin,zOwner)==0)
70
+ if( g.perm.Admin
71
+ || (g.perm.WrTkt && zOwner && fossil_strcmp(g.zLogin,zOwner)==0)
7272
){
7373
blob_appendf(&ril, "[<a href=\"rptedit?rn=%d\" rel=\"nofollow\">edit</a>] ", rn);
7474
}
75
- if( g.okTktFmt ){
75
+ if( g.perm.TktFmt ){
7676
blob_appendf(&ril, "[<a href=\"rptsql?rn=%d\" rel=\"nofollow\">sql</a>] ", rn);
7777
}
7878
blob_appendf(&ril, "</li>\n");
7979
}
8080
@@ -184,11 +184,11 @@
184184
if( fossil_stricmp(zArg1, azAllowed[i])==0 ) break;
185185
}
186186
if( i>=sizeof(azAllowed)/sizeof(azAllowed[0]) ){
187187
*(char**)pError = mprintf("access to table \"%s\" is restricted",zArg1);
188188
rc = SQLITE_DENY;
189
- }else if( !g.okRdAddr && strncmp(zArg2, "private_", 8)==0 ){
189
+ }else if( !g.perm.RdAddr && strncmp(zArg2, "private_", 8)==0 ){
190190
rc = SQLITE_IGNORE;
191191
}
192192
break;
193193
}
194194
default: {
@@ -275,11 +275,11 @@
275275
const char *zOwner;
276276
const char *zClrKey;
277277
Stmt q;
278278
279279
login_check_credentials();
280
- if( !g.okTktFmt ){
280
+ if( !g.perm.TktFmt ){
281281
login_needed();
282282
return;
283283
}
284284
rn = atoi(PD("rn","0"));
285285
db_prepare(&q, "SELECT title, sqlcode, owner, cols "
@@ -323,11 +323,11 @@
323323
const char *zClrKey;
324324
char *zSQL;
325325
char *zErr = 0;
326326
327327
login_check_credentials();
328
- if( !g.okTktFmt ){
328
+ if( !g.perm.TktFmt ){
329329
login_needed();
330330
return;
331331
}
332332
/*view_add_functions(0);*/
333333
rn = atoi(PD("rn","0"));
@@ -430,11 +430,11 @@
430430
@ <input type="text" name="t" value="%h(zTitle)" size="60" /></p>
431431
@ <p>Enter a complete SQL query statement against the "TICKET" table:<br />
432432
@ <textarea name="s" rows="20" cols="80">%h(zSQL)</textarea>
433433
@ </p>
434434
login_insert_csrf_secret();
435
- if( g.okAdmin ){
435
+ if( g.perm.Admin ){
436436
@ <p>Report owner:
437437
@ <input type="text" name="w" size="20" value="%h(zOwner)" />
438438
@ </p>
439439
} else {
440440
@ <input type="hidden" name="w" value="%h(zOwner)" />
@@ -443,11 +443,11 @@
443443
@ color key is displayed.) Each line contains the text for a single
444444
@ entry in the key. The first token of each line is the background
445445
@ color for that line.<br />
446446
@ <textarea name="k" rows="8" cols="50">%h(zClrKey)</textarea>
447447
@ </p>
448
- if( !g.okAdmin && fossil_strcmp(zOwner,g.zLogin)!=0 ){
448
+ if( !g.perm.Admin && fossil_strcmp(zOwner,g.zLogin)!=0 ){
449449
@ <p>This report format is owned by %h(zOwner). You are not allowed
450450
@ to change it.</p>
451451
@ </form>
452452
report_format_hints();
453453
style_footer();
@@ -659,11 +659,11 @@
659659
for(i=0; i<nArg; i++){
660660
if( azName[i][0]=='b' && fossil_strcmp(azName[i],"bgcolor")==0 ){
661661
pState->iBg = i;
662662
continue;
663663
}
664
- if( g.okWrite && azName[i][0]=='#' ){
664
+ if( g.perm.Write && azName[i][0]=='#' ){
665665
pState->nCol++;
666666
}
667667
if( !pState->isMultirow ){
668668
if( azName[i][0]=='_' ){
669669
pState->isMultirow = 1;
@@ -680,11 +680,11 @@
680680
zTid = 0;
681681
for(i=0; i<nArg; i++){
682682
char *zName = azName[i];
683683
if( i==pState->iBg ) continue;
684684
if( pState->iNewRow>=0 && i>=pState->iNewRow ){
685
- if( g.okWrite && zTid ){
685
+ if( g.perm.Write && zTid ){
686686
@ <th>&nbsp;</th>
687687
zTid = 0;
688688
}
689689
if( zName[0]=='_' ) zName++;
690690
@ </tr><tr><th colspan=%d(pState->nCol)>%h(zName)</th>
@@ -693,11 +693,11 @@
693693
zTid = zName;
694694
}
695695
@ <th>%h(zName)</th>
696696
}
697697
}
698
- if( g.okWrite && zTid ){
698
+ if( g.perm.Write && zTid ){
699699
@ <th>&nbsp;</th>
700700
}
701701
@ </tr>
702702
}
703703
if( azArg==0 ){
@@ -726,11 +726,11 @@
726726
char *zData;
727727
if( i==pState->iBg ) continue;
728728
zData = azArg[i];
729729
if( zData==0 ) zData = "";
730730
if( pState->iNewRow>=0 && i>=pState->iNewRow ){
731
- if( zTid && g.okWrite ){
731
+ if( zTid && g.perm.Write ){
732732
@ <td valign="top"><a href="tktedit/%h(zTid)">edit</a></td>
733733
zTid = 0;
734734
}
735735
if( zData[0] ){
736736
Blob content;
@@ -739,11 +739,11 @@
739739
wiki_convert(&content, 0, 0);
740740
blob_reset(&content);
741741
}
742742
}else if( azName[i][0]=='#' ){
743743
zTid = zData;
744
- if( g.okHistory ){
744
+ if( g.perm.History ){
745745
@ <td valign="top"><a href="tktview?name=%h(zData)">%h(zData)</a></td>
746746
}else{
747747
@ <td valign="top">%h(zData)</td>
748748
}
749749
}else if( zData[0]==0 ){
@@ -752,11 +752,11 @@
752752
@ <td valign="top">
753753
@ %h(zData)
754754
@ </td>
755755
}
756756
}
757
- if( zTid && g.okWrite ){
757
+ if( zTid && g.perm.Write ){
758758
@ <td valign="top"><a href="tktedit/%h(zTid)">edit</a></td>
759759
}
760760
@ </tr>
761761
return 0;
762762
}
@@ -915,11 +915,11 @@
915915
Stmt q;
916916
char *zErr1 = 0;
917917
char *zErr2 = 0;
918918
919919
login_check_credentials();
920
- if( !g.okRdTkt ){ login_needed(); return; }
920
+ if( !g.perm.RdTkt ){ login_needed(); return; }
921921
rn = atoi(PD("rn","0"));
922922
if( rn==0 ){
923923
cgi_redirect("reportlist");
924924
return;
925925
}
@@ -957,18 +957,18 @@
957957
struct GenerateHTML sState;
958958
959959
db_multi_exec("PRAGMA empty_result_callbacks=ON");
960960
style_submenu_element("Raw", "Raw",
961961
"rptview?tablist=1&amp;%h", PD("QUERY_STRING",""));
962
- if( g.okAdmin
963
- || (g.okTktFmt && g.zLogin && fossil_strcmp(g.zLogin,zOwner)==0) ){
962
+ if( g.perm.Admin
963
+ || (g.perm.TktFmt && g.zLogin && fossil_strcmp(g.zLogin,zOwner)==0) ){
964964
style_submenu_element("Edit", "Edit", "rptedit?rn=%d", rn);
965965
}
966
- if( g.okTktFmt ){
966
+ if( g.perm.TktFmt ){
967967
style_submenu_element("SQL", "SQL", "rptsql?rn=%d",rn);
968968
}
969
- if( g.okNewTkt ){
969
+ if( g.perm.NewTkt ){
970970
style_submenu_element("New Ticket", "Create a new ticket",
971971
"%s/tktnew", g.zTop);
972972
}
973973
style_header(zTitle);
974974
output_color_key(zClrKey, 1,
975975
--- src/report.c
+++ src/report.c
@@ -34,11 +34,11 @@
34 Stmt q;
35 int rn = 0;
36 int cnt = 0;
37
38 login_check_credentials();
39 if( !g.okRdTkt && !g.okNewTkt ){ login_needed(); return; }
40 style_header("Ticket Main Menu");
41 if( g.thTrace ) Th_Trace("BEGIN_REPORTLIST<br />\n", -1);
42 zScript = ticket_reportlist_code();
43 if( g.thTrace ) Th_Trace("BEGIN_REPORTLIST_SCRIPT<br />\n", -1);
44
@@ -47,11 +47,11 @@
47
48 db_prepare(&q, "SELECT rn, title, owner FROM reportfmt ORDER BY title");
49 while( db_step(&q)==SQLITE_ROW ){
50 const char *zTitle = db_column_text(&q, 1);
51 const char *zOwner = db_column_text(&q, 2);
52 if( zTitle[0] =='_' && !g.okTktFmt ){
53 continue;
54 }
55 rn = db_column_int(&q, 0);
56 cnt++;
57 blob_appendf(&ril, "<li>");
@@ -59,22 +59,22 @@
59 blob_appendf(&ril, "%s", zTitle);
60 } else {
61 blob_appendf(&ril, "<a href=\"rptview?rn=%d\" rel=\"nofollow\">%h</a>", rn, zTitle);
62 }
63 blob_appendf(&ril, "&nbsp;&nbsp;&nbsp;");
64 if( g.okWrite && zOwner && zOwner[0] ){
65 blob_appendf(&ril, "(by <i>%h</i></i>) ", zOwner);
66 }
67 if( g.okTktFmt ){
68 blob_appendf(&ril, "[<a href=\"rptedit?rn=%d&amp;copy=1\" rel=\"nofollow\">copy</a>] ", rn);
69 }
70 if( g.okAdmin
71 || (g.okWrTkt && zOwner && fossil_strcmp(g.zLogin,zOwner)==0)
72 ){
73 blob_appendf(&ril, "[<a href=\"rptedit?rn=%d\" rel=\"nofollow\">edit</a>] ", rn);
74 }
75 if( g.okTktFmt ){
76 blob_appendf(&ril, "[<a href=\"rptsql?rn=%d\" rel=\"nofollow\">sql</a>] ", rn);
77 }
78 blob_appendf(&ril, "</li>\n");
79 }
80
@@ -184,11 +184,11 @@
184 if( fossil_stricmp(zArg1, azAllowed[i])==0 ) break;
185 }
186 if( i>=sizeof(azAllowed)/sizeof(azAllowed[0]) ){
187 *(char**)pError = mprintf("access to table \"%s\" is restricted",zArg1);
188 rc = SQLITE_DENY;
189 }else if( !g.okRdAddr && strncmp(zArg2, "private_", 8)==0 ){
190 rc = SQLITE_IGNORE;
191 }
192 break;
193 }
194 default: {
@@ -275,11 +275,11 @@
275 const char *zOwner;
276 const char *zClrKey;
277 Stmt q;
278
279 login_check_credentials();
280 if( !g.okTktFmt ){
281 login_needed();
282 return;
283 }
284 rn = atoi(PD("rn","0"));
285 db_prepare(&q, "SELECT title, sqlcode, owner, cols "
@@ -323,11 +323,11 @@
323 const char *zClrKey;
324 char *zSQL;
325 char *zErr = 0;
326
327 login_check_credentials();
328 if( !g.okTktFmt ){
329 login_needed();
330 return;
331 }
332 /*view_add_functions(0);*/
333 rn = atoi(PD("rn","0"));
@@ -430,11 +430,11 @@
430 @ <input type="text" name="t" value="%h(zTitle)" size="60" /></p>
431 @ <p>Enter a complete SQL query statement against the "TICKET" table:<br />
432 @ <textarea name="s" rows="20" cols="80">%h(zSQL)</textarea>
433 @ </p>
434 login_insert_csrf_secret();
435 if( g.okAdmin ){
436 @ <p>Report owner:
437 @ <input type="text" name="w" size="20" value="%h(zOwner)" />
438 @ </p>
439 } else {
440 @ <input type="hidden" name="w" value="%h(zOwner)" />
@@ -443,11 +443,11 @@
443 @ color key is displayed.) Each line contains the text for a single
444 @ entry in the key. The first token of each line is the background
445 @ color for that line.<br />
446 @ <textarea name="k" rows="8" cols="50">%h(zClrKey)</textarea>
447 @ </p>
448 if( !g.okAdmin && fossil_strcmp(zOwner,g.zLogin)!=0 ){
449 @ <p>This report format is owned by %h(zOwner). You are not allowed
450 @ to change it.</p>
451 @ </form>
452 report_format_hints();
453 style_footer();
@@ -659,11 +659,11 @@
659 for(i=0; i<nArg; i++){
660 if( azName[i][0]=='b' && fossil_strcmp(azName[i],"bgcolor")==0 ){
661 pState->iBg = i;
662 continue;
663 }
664 if( g.okWrite && azName[i][0]=='#' ){
665 pState->nCol++;
666 }
667 if( !pState->isMultirow ){
668 if( azName[i][0]=='_' ){
669 pState->isMultirow = 1;
@@ -680,11 +680,11 @@
680 zTid = 0;
681 for(i=0; i<nArg; i++){
682 char *zName = azName[i];
683 if( i==pState->iBg ) continue;
684 if( pState->iNewRow>=0 && i>=pState->iNewRow ){
685 if( g.okWrite && zTid ){
686 @ <th>&nbsp;</th>
687 zTid = 0;
688 }
689 if( zName[0]=='_' ) zName++;
690 @ </tr><tr><th colspan=%d(pState->nCol)>%h(zName)</th>
@@ -693,11 +693,11 @@
693 zTid = zName;
694 }
695 @ <th>%h(zName)</th>
696 }
697 }
698 if( g.okWrite && zTid ){
699 @ <th>&nbsp;</th>
700 }
701 @ </tr>
702 }
703 if( azArg==0 ){
@@ -726,11 +726,11 @@
726 char *zData;
727 if( i==pState->iBg ) continue;
728 zData = azArg[i];
729 if( zData==0 ) zData = "";
730 if( pState->iNewRow>=0 && i>=pState->iNewRow ){
731 if( zTid && g.okWrite ){
732 @ <td valign="top"><a href="tktedit/%h(zTid)">edit</a></td>
733 zTid = 0;
734 }
735 if( zData[0] ){
736 Blob content;
@@ -739,11 +739,11 @@
739 wiki_convert(&content, 0, 0);
740 blob_reset(&content);
741 }
742 }else if( azName[i][0]=='#' ){
743 zTid = zData;
744 if( g.okHistory ){
745 @ <td valign="top"><a href="tktview?name=%h(zData)">%h(zData)</a></td>
746 }else{
747 @ <td valign="top">%h(zData)</td>
748 }
749 }else if( zData[0]==0 ){
@@ -752,11 +752,11 @@
752 @ <td valign="top">
753 @ %h(zData)
754 @ </td>
755 }
756 }
757 if( zTid && g.okWrite ){
758 @ <td valign="top"><a href="tktedit/%h(zTid)">edit</a></td>
759 }
760 @ </tr>
761 return 0;
762 }
@@ -915,11 +915,11 @@
915 Stmt q;
916 char *zErr1 = 0;
917 char *zErr2 = 0;
918
919 login_check_credentials();
920 if( !g.okRdTkt ){ login_needed(); return; }
921 rn = atoi(PD("rn","0"));
922 if( rn==0 ){
923 cgi_redirect("reportlist");
924 return;
925 }
@@ -957,18 +957,18 @@
957 struct GenerateHTML sState;
958
959 db_multi_exec("PRAGMA empty_result_callbacks=ON");
960 style_submenu_element("Raw", "Raw",
961 "rptview?tablist=1&amp;%h", PD("QUERY_STRING",""));
962 if( g.okAdmin
963 || (g.okTktFmt && g.zLogin && fossil_strcmp(g.zLogin,zOwner)==0) ){
964 style_submenu_element("Edit", "Edit", "rptedit?rn=%d", rn);
965 }
966 if( g.okTktFmt ){
967 style_submenu_element("SQL", "SQL", "rptsql?rn=%d",rn);
968 }
969 if( g.okNewTkt ){
970 style_submenu_element("New Ticket", "Create a new ticket",
971 "%s/tktnew", g.zTop);
972 }
973 style_header(zTitle);
974 output_color_key(zClrKey, 1,
975
--- src/report.c
+++ src/report.c
@@ -34,11 +34,11 @@
34 Stmt q;
35 int rn = 0;
36 int cnt = 0;
37
38 login_check_credentials();
39 if( !g.perm.RdTkt && !g.perm.NewTkt ){ login_needed(); return; }
40 style_header("Ticket Main Menu");
41 if( g.thTrace ) Th_Trace("BEGIN_REPORTLIST<br />\n", -1);
42 zScript = ticket_reportlist_code();
43 if( g.thTrace ) Th_Trace("BEGIN_REPORTLIST_SCRIPT<br />\n", -1);
44
@@ -47,11 +47,11 @@
47
48 db_prepare(&q, "SELECT rn, title, owner FROM reportfmt ORDER BY title");
49 while( db_step(&q)==SQLITE_ROW ){
50 const char *zTitle = db_column_text(&q, 1);
51 const char *zOwner = db_column_text(&q, 2);
52 if( zTitle[0] =='_' && !g.perm.TktFmt ){
53 continue;
54 }
55 rn = db_column_int(&q, 0);
56 cnt++;
57 blob_appendf(&ril, "<li>");
@@ -59,22 +59,22 @@
59 blob_appendf(&ril, "%s", zTitle);
60 } else {
61 blob_appendf(&ril, "<a href=\"rptview?rn=%d\" rel=\"nofollow\">%h</a>", rn, zTitle);
62 }
63 blob_appendf(&ril, "&nbsp;&nbsp;&nbsp;");
64 if( g.perm.Write && zOwner && zOwner[0] ){
65 blob_appendf(&ril, "(by <i>%h</i></i>) ", zOwner);
66 }
67 if( g.perm.TktFmt ){
68 blob_appendf(&ril, "[<a href=\"rptedit?rn=%d&amp;copy=1\" rel=\"nofollow\">copy</a>] ", rn);
69 }
70 if( g.perm.Admin
71 || (g.perm.WrTkt && zOwner && fossil_strcmp(g.zLogin,zOwner)==0)
72 ){
73 blob_appendf(&ril, "[<a href=\"rptedit?rn=%d\" rel=\"nofollow\">edit</a>] ", rn);
74 }
75 if( g.perm.TktFmt ){
76 blob_appendf(&ril, "[<a href=\"rptsql?rn=%d\" rel=\"nofollow\">sql</a>] ", rn);
77 }
78 blob_appendf(&ril, "</li>\n");
79 }
80
@@ -184,11 +184,11 @@
184 if( fossil_stricmp(zArg1, azAllowed[i])==0 ) break;
185 }
186 if( i>=sizeof(azAllowed)/sizeof(azAllowed[0]) ){
187 *(char**)pError = mprintf("access to table \"%s\" is restricted",zArg1);
188 rc = SQLITE_DENY;
189 }else if( !g.perm.RdAddr && strncmp(zArg2, "private_", 8)==0 ){
190 rc = SQLITE_IGNORE;
191 }
192 break;
193 }
194 default: {
@@ -275,11 +275,11 @@
275 const char *zOwner;
276 const char *zClrKey;
277 Stmt q;
278
279 login_check_credentials();
280 if( !g.perm.TktFmt ){
281 login_needed();
282 return;
283 }
284 rn = atoi(PD("rn","0"));
285 db_prepare(&q, "SELECT title, sqlcode, owner, cols "
@@ -323,11 +323,11 @@
323 const char *zClrKey;
324 char *zSQL;
325 char *zErr = 0;
326
327 login_check_credentials();
328 if( !g.perm.TktFmt ){
329 login_needed();
330 return;
331 }
332 /*view_add_functions(0);*/
333 rn = atoi(PD("rn","0"));
@@ -430,11 +430,11 @@
430 @ <input type="text" name="t" value="%h(zTitle)" size="60" /></p>
431 @ <p>Enter a complete SQL query statement against the "TICKET" table:<br />
432 @ <textarea name="s" rows="20" cols="80">%h(zSQL)</textarea>
433 @ </p>
434 login_insert_csrf_secret();
435 if( g.perm.Admin ){
436 @ <p>Report owner:
437 @ <input type="text" name="w" size="20" value="%h(zOwner)" />
438 @ </p>
439 } else {
440 @ <input type="hidden" name="w" value="%h(zOwner)" />
@@ -443,11 +443,11 @@
443 @ color key is displayed.) Each line contains the text for a single
444 @ entry in the key. The first token of each line is the background
445 @ color for that line.<br />
446 @ <textarea name="k" rows="8" cols="50">%h(zClrKey)</textarea>
447 @ </p>
448 if( !g.perm.Admin && fossil_strcmp(zOwner,g.zLogin)!=0 ){
449 @ <p>This report format is owned by %h(zOwner). You are not allowed
450 @ to change it.</p>
451 @ </form>
452 report_format_hints();
453 style_footer();
@@ -659,11 +659,11 @@
659 for(i=0; i<nArg; i++){
660 if( azName[i][0]=='b' && fossil_strcmp(azName[i],"bgcolor")==0 ){
661 pState->iBg = i;
662 continue;
663 }
664 if( g.perm.Write && azName[i][0]=='#' ){
665 pState->nCol++;
666 }
667 if( !pState->isMultirow ){
668 if( azName[i][0]=='_' ){
669 pState->isMultirow = 1;
@@ -680,11 +680,11 @@
680 zTid = 0;
681 for(i=0; i<nArg; i++){
682 char *zName = azName[i];
683 if( i==pState->iBg ) continue;
684 if( pState->iNewRow>=0 && i>=pState->iNewRow ){
685 if( g.perm.Write && zTid ){
686 @ <th>&nbsp;</th>
687 zTid = 0;
688 }
689 if( zName[0]=='_' ) zName++;
690 @ </tr><tr><th colspan=%d(pState->nCol)>%h(zName)</th>
@@ -693,11 +693,11 @@
693 zTid = zName;
694 }
695 @ <th>%h(zName)</th>
696 }
697 }
698 if( g.perm.Write && zTid ){
699 @ <th>&nbsp;</th>
700 }
701 @ </tr>
702 }
703 if( azArg==0 ){
@@ -726,11 +726,11 @@
726 char *zData;
727 if( i==pState->iBg ) continue;
728 zData = azArg[i];
729 if( zData==0 ) zData = "";
730 if( pState->iNewRow>=0 && i>=pState->iNewRow ){
731 if( zTid && g.perm.Write ){
732 @ <td valign="top"><a href="tktedit/%h(zTid)">edit</a></td>
733 zTid = 0;
734 }
735 if( zData[0] ){
736 Blob content;
@@ -739,11 +739,11 @@
739 wiki_convert(&content, 0, 0);
740 blob_reset(&content);
741 }
742 }else if( azName[i][0]=='#' ){
743 zTid = zData;
744 if( g.perm.History ){
745 @ <td valign="top"><a href="tktview?name=%h(zData)">%h(zData)</a></td>
746 }else{
747 @ <td valign="top">%h(zData)</td>
748 }
749 }else if( zData[0]==0 ){
@@ -752,11 +752,11 @@
752 @ <td valign="top">
753 @ %h(zData)
754 @ </td>
755 }
756 }
757 if( zTid && g.perm.Write ){
758 @ <td valign="top"><a href="tktedit/%h(zTid)">edit</a></td>
759 }
760 @ </tr>
761 return 0;
762 }
@@ -915,11 +915,11 @@
915 Stmt q;
916 char *zErr1 = 0;
917 char *zErr2 = 0;
918
919 login_check_credentials();
920 if( !g.perm.RdTkt ){ login_needed(); return; }
921 rn = atoi(PD("rn","0"));
922 if( rn==0 ){
923 cgi_redirect("reportlist");
924 return;
925 }
@@ -957,18 +957,18 @@
957 struct GenerateHTML sState;
958
959 db_multi_exec("PRAGMA empty_result_callbacks=ON");
960 style_submenu_element("Raw", "Raw",
961 "rptview?tablist=1&amp;%h", PD("QUERY_STRING",""));
962 if( g.perm.Admin
963 || (g.perm.TktFmt && g.zLogin && fossil_strcmp(g.zLogin,zOwner)==0) ){
964 style_submenu_element("Edit", "Edit", "rptedit?rn=%d", rn);
965 }
966 if( g.perm.TktFmt ){
967 style_submenu_element("SQL", "SQL", "rptsql?rn=%d",rn);
968 }
969 if( g.perm.NewTkt ){
970 style_submenu_element("New Ticket", "Create a new ticket",
971 "%s/tktnew", g.zTop);
972 }
973 style_header(zTitle);
974 output_color_key(zClrKey, 1,
975
+11 -11
--- src/rss.c
+++ src/rss.c
@@ -44,39 +44,39 @@
4444
@ FROM event, blob
4545
@ WHERE blob.rid=event.objid
4646
;
4747
4848
login_check_credentials();
49
- if( !g.okRead && !g.okRdTkt && !g.okRdWiki ){
49
+ if( !g.perm.Read && !g.perm.RdTkt && !g.perm.RdWiki ){
5050
return;
5151
}
5252
5353
blob_zero(&bSQL);
5454
blob_append( &bSQL, zSQL1, -1 );
5555
5656
if( zType[0]!='a' ){
57
- if( zType[0]=='c' && !g.okRead ) zType = "x";
58
- if( zType[0]=='w' && !g.okRdWiki ) zType = "x";
59
- if( zType[0]=='t' && !g.okRdTkt ) zType = "x";
57
+ if( zType[0]=='c' && !g.perm.Read ) zType = "x";
58
+ if( zType[0]=='w' && !g.perm.RdWiki ) zType = "x";
59
+ if( zType[0]=='t' && !g.perm.RdTkt ) zType = "x";
6060
blob_appendf(&bSQL, " AND event.type=%Q", zType);
6161
}else{
62
- if( !g.okRead ){
63
- if( g.okRdTkt && g.okRdWiki ){
62
+ if( !g.perm.Read ){
63
+ if( g.perm.RdTkt && g.perm.RdWiki ){
6464
blob_append(&bSQL, " AND event.type!='ci'", -1);
65
- }else if( g.okRdTkt ){
65
+ }else if( g.perm.RdTkt ){
6666
blob_append(&bSQL, " AND event.type=='t'", -1);
6767
}else{
6868
blob_append(&bSQL, " AND event.type=='w'", -1);
6969
}
70
- }else if( !g.okRdWiki ){
71
- if( g.okRdTkt ){
70
+ }else if( !g.perm.RdWiki ){
71
+ if( g.perm.RdTkt ){
7272
blob_append(&bSQL, " AND event.type!='w'", -1);
7373
}else{
7474
blob_append(&bSQL, " AND event.type=='ci'", -1);
7575
}
76
- }else if( !g.okRdTkt ){
77
- assert( !g.okRdTkt &&& g.okRead && g.okRdWiki );
76
+ }else if( !g.perm.RdTkt ){
77
+ assert( !g.perm.RdTkt &&& g.perm.Read && g.perm.RdWiki );
7878
blob_append(&bSQL, " AND event.type!='t'", -1);
7979
}
8080
}
8181
8282
blob_append( &bSQL, " ORDER BY event.mtime DESC", -1 );
8383
--- src/rss.c
+++ src/rss.c
@@ -44,39 +44,39 @@
44 @ FROM event, blob
45 @ WHERE blob.rid=event.objid
46 ;
47
48 login_check_credentials();
49 if( !g.okRead && !g.okRdTkt && !g.okRdWiki ){
50 return;
51 }
52
53 blob_zero(&bSQL);
54 blob_append( &bSQL, zSQL1, -1 );
55
56 if( zType[0]!='a' ){
57 if( zType[0]=='c' && !g.okRead ) zType = "x";
58 if( zType[0]=='w' && !g.okRdWiki ) zType = "x";
59 if( zType[0]=='t' && !g.okRdTkt ) zType = "x";
60 blob_appendf(&bSQL, " AND event.type=%Q", zType);
61 }else{
62 if( !g.okRead ){
63 if( g.okRdTkt && g.okRdWiki ){
64 blob_append(&bSQL, " AND event.type!='ci'", -1);
65 }else if( g.okRdTkt ){
66 blob_append(&bSQL, " AND event.type=='t'", -1);
67 }else{
68 blob_append(&bSQL, " AND event.type=='w'", -1);
69 }
70 }else if( !g.okRdWiki ){
71 if( g.okRdTkt ){
72 blob_append(&bSQL, " AND event.type!='w'", -1);
73 }else{
74 blob_append(&bSQL, " AND event.type=='ci'", -1);
75 }
76 }else if( !g.okRdTkt ){
77 assert( !g.okRdTkt &&& g.okRead && g.okRdWiki );
78 blob_append(&bSQL, " AND event.type!='t'", -1);
79 }
80 }
81
82 blob_append( &bSQL, " ORDER BY event.mtime DESC", -1 );
83
--- src/rss.c
+++ src/rss.c
@@ -44,39 +44,39 @@
44 @ FROM event, blob
45 @ WHERE blob.rid=event.objid
46 ;
47
48 login_check_credentials();
49 if( !g.perm.Read && !g.perm.RdTkt && !g.perm.RdWiki ){
50 return;
51 }
52
53 blob_zero(&bSQL);
54 blob_append( &bSQL, zSQL1, -1 );
55
56 if( zType[0]!='a' ){
57 if( zType[0]=='c' && !g.perm.Read ) zType = "x";
58 if( zType[0]=='w' && !g.perm.RdWiki ) zType = "x";
59 if( zType[0]=='t' && !g.perm.RdTkt ) zType = "x";
60 blob_appendf(&bSQL, " AND event.type=%Q", zType);
61 }else{
62 if( !g.perm.Read ){
63 if( g.perm.RdTkt && g.perm.RdWiki ){
64 blob_append(&bSQL, " AND event.type!='ci'", -1);
65 }else if( g.perm.RdTkt ){
66 blob_append(&bSQL, " AND event.type=='t'", -1);
67 }else{
68 blob_append(&bSQL, " AND event.type=='w'", -1);
69 }
70 }else if( !g.perm.RdWiki ){
71 if( g.perm.RdTkt ){
72 blob_append(&bSQL, " AND event.type!='w'", -1);
73 }else{
74 blob_append(&bSQL, " AND event.type=='ci'", -1);
75 }
76 }else if( !g.perm.RdTkt ){
77 assert( !g.perm.RdTkt &&& g.perm.Read && g.perm.RdWiki );
78 blob_append(&bSQL, " AND event.type!='t'", -1);
79 }
80 }
81
82 blob_append( &bSQL, " ORDER BY event.mtime DESC", -1 );
83
+17 -17
--- src/setup.c
+++ src/setup.c
@@ -52,11 +52,11 @@
5252
/*
5353
** WEBPAGE: /setup
5454
*/
5555
void setup_page(void){
5656
login_check_credentials();
57
- if( !g.okSetup ){
57
+ if( !g.perm.Setup ){
5858
login_needed();
5959
}
6060
6161
style_header("Server Administration");
6262
@ <table border="0" cellspacing="7">
@@ -106,11 +106,11 @@
106106
*/
107107
void setup_ulist(void){
108108
Stmt s;
109109
110110
login_check_credentials();
111
- if( !g.okAdmin ){
111
+ if( !g.perm.Admin ){
112112
login_needed();
113113
return;
114114
}
115115
116116
style_submenu_element("Add", "Add User", "setup_uedit");
@@ -127,15 +127,15 @@
127127
db_prepare(&s, "SELECT uid, login, cap, info FROM user ORDER BY login");
128128
while( db_step(&s)==SQLITE_ROW ){
129129
const char *zCap = db_column_text(&s, 2);
130130
@ <tr>
131131
@ <td class="usetupListUser" style="text-align: right;padding-right: 20px;white-space:nowrap;">
132
- if( g.okAdmin && (zCap[0]!='s' || g.okSetup) ){
132
+ if( g.perm.Admin && (zCap[0]!='s' || g.perm.Setup) ){
133133
@ <a href="setup_uedit?id=%d(db_column_int(&s,0))">
134134
}
135135
@ %h(db_column_text(&s,1))
136
- if( g.okAdmin ){
136
+ if( g.perm.Admin ){
137137
@ </a>
138138
}
139139
@ </td>
140140
@ <td class="usetupListCap" style="text-align: center;padding-right: 15px;">%s(zCap)</td>
141141
@ <td class="usetupListCon" style="text-align: left;">%s(db_column_text(&s,3))</td>
@@ -259,18 +259,18 @@
259259
/* user doing the editing is ADMIN. Disallow editing */
260260
261261
/* Must have ADMIN privleges to access this page
262262
*/
263263
login_check_credentials();
264
- if( !g.okAdmin ){ login_needed(); return; }
264
+ if( !g.perm.Admin ){ login_needed(); return; }
265265
266266
/* Check to see if an ADMIN user is trying to edit a SETUP account.
267267
** Don't allow that.
268268
*/
269269
zId = PD("id", "0");
270270
uid = atoi(zId);
271
- if( zId && !g.okSetup && uid>0 ){
271
+ if( zId && !g.perm.Setup && uid>0 ){
272272
char *zOldCaps;
273273
zOldCaps = db_text(0, "SELECT cap FROM user WHERE uid=%d",uid);
274274
higherUser = zOldCaps && strchr(zOldCaps,'s');
275275
}
276276
@@ -296,11 +296,11 @@
296296
int ak = P("ak")!=0;
297297
int an = P("an")!=0;
298298
int ao = P("ao")!=0;
299299
int ap = P("ap")!=0;
300300
int ar = P("ar")!=0;
301
- int as = g.okSetup && P("as")!=0;
301
+ int as = g.perm.Setup && P("as")!=0;
302302
int aw = P("aw")!=0;
303303
int ac = P("ac")!=0;
304304
int af = P("af")!=0;
305305
int am = P("am")!=0;
306306
int ah = P("ah")!=0;
@@ -513,11 +513,11 @@
513513
@ </tr>
514514
@ <tr>
515515
@ <td class="usetupEditLabel">Capabilities:</td>
516516
@ <td>
517517
#define B(x) inherit[x]
518
- if( g.okSetup ){
518
+ if( g.perm.Setup ){
519519
@ <input type="checkbox" name="as"%s(oas) />%s(B('s'))Setup<br />
520520
}
521521
@ <input type="checkbox" name="aa"%s(oaa) />%s(B('a'))Admin<br />
522522
@ <input type="checkbox" name="ad"%s(oad) />%s(B('d'))Delete<br />
523523
@ <input type="checkbox" name="ae"%s(oae) />%s(B('e'))Email<br />
@@ -816,11 +816,11 @@
816816
/*
817817
** WEBPAGE: setup_access
818818
*/
819819
void setup_access(void){
820820
login_check_credentials();
821
- if( !g.okSetup ){
821
+ if( !g.perm.Setup ){
822822
login_needed();
823823
}
824824
825825
style_header("Access Control Settings");
826826
db_begin_transaction();
@@ -918,11 +918,11 @@
918918
const char *zLogin = PD("login", "");
919919
const char *zPw = PD("pw", "");
920920
const char *zNewName = PD("newname", "New Login Group");
921921
922922
login_check_credentials();
923
- if( !g.okSetup ){
923
+ if( !g.perm.Setup ){
924924
login_needed();
925925
}
926926
file_canonical_name(g.zRepositoryName, &fullName);
927927
zSelfRepo = mprintf(blob_str(&fullName));
928928
blob_reset(&fullName);
@@ -1004,11 +1004,11 @@
10041004
/*
10051005
** WEBPAGE: setup_timeline
10061006
*/
10071007
void setup_timeline(void){
10081008
login_check_credentials();
1009
- if( !g.okSetup ){
1009
+ if( !g.perm.Setup ){
10101010
login_needed();
10111011
}
10121012
10131013
style_header("Timeline Display Preferences");
10141014
db_begin_transaction();
@@ -1053,11 +1053,11 @@
10531053
*/
10541054
void setup_settings(void){
10551055
struct stControlSettings const *pSet;
10561056
10571057
login_check_credentials();
1058
- if( !g.okSetup ){
1058
+ if( !g.perm.Setup ){
10591059
login_needed();
10601060
}
10611061
10621062
style_header("Settings");
10631063
db_open_local();
@@ -1107,11 +1107,11 @@
11071107
/*
11081108
** WEBPAGE: setup_config
11091109
*/
11101110
void setup_config(void){
11111111
login_check_credentials();
1112
- if( !g.okSetup ){
1112
+ if( !g.perm.Setup ){
11131113
login_needed();
11141114
}
11151115
11161116
style_header("WWW Configuration");
11171117
db_begin_transaction();
@@ -1171,11 +1171,11 @@
11711171
/*
11721172
** WEBPAGE: setup_editcss
11731173
*/
11741174
void setup_editcss(void){
11751175
login_check_credentials();
1176
- if( !g.okSetup ){
1176
+ if( !g.perm.Setup ){
11771177
login_needed();
11781178
}
11791179
db_begin_transaction();
11801180
if( P("clear")!=0 ){
11811181
db_multi_exec("DELETE FROM config WHERE name='css'");
@@ -1215,11 +1215,11 @@
12151215
/*
12161216
** WEBPAGE: setup_header
12171217
*/
12181218
void setup_header(void){
12191219
login_check_credentials();
1220
- if( !g.okSetup ){
1220
+ if( !g.perm.Setup ){
12211221
login_needed();
12221222
}
12231223
db_begin_transaction();
12241224
if( P("clear")!=0 ){
12251225
db_multi_exec("DELETE FROM config WHERE name='header'");
@@ -1253,11 +1253,11 @@
12531253
/*
12541254
** WEBPAGE: setup_footer
12551255
*/
12561256
void setup_footer(void){
12571257
login_check_credentials();
1258
- if( !g.okSetup ){
1258
+ if( !g.perm.Setup ){
12591259
login_needed();
12601260
}
12611261
db_begin_transaction();
12621262
if( P("clear")!=0 ){
12631263
db_multi_exec("DELETE FROM config WHERE name='footer'");
@@ -1296,11 +1296,11 @@
12961296
int szImg = atoi(PD("im:bytes","0"));
12971297
if( szImg>0 ){
12981298
zMime = PD("im:mimetype","image/gif");
12991299
}
13001300
login_check_credentials();
1301
- if( !g.okSetup ){
1301
+ if( !g.perm.Setup ){
13021302
login_needed();
13031303
}
13041304
db_begin_transaction();
13051305
if( P("set")!=0 && zMime && zMime[0] && szImg>0 ){
13061306
Blob img;
13071307
--- src/setup.c
+++ src/setup.c
@@ -52,11 +52,11 @@
52 /*
53 ** WEBPAGE: /setup
54 */
55 void setup_page(void){
56 login_check_credentials();
57 if( !g.okSetup ){
58 login_needed();
59 }
60
61 style_header("Server Administration");
62 @ <table border="0" cellspacing="7">
@@ -106,11 +106,11 @@
106 */
107 void setup_ulist(void){
108 Stmt s;
109
110 login_check_credentials();
111 if( !g.okAdmin ){
112 login_needed();
113 return;
114 }
115
116 style_submenu_element("Add", "Add User", "setup_uedit");
@@ -127,15 +127,15 @@
127 db_prepare(&s, "SELECT uid, login, cap, info FROM user ORDER BY login");
128 while( db_step(&s)==SQLITE_ROW ){
129 const char *zCap = db_column_text(&s, 2);
130 @ <tr>
131 @ <td class="usetupListUser" style="text-align: right;padding-right: 20px;white-space:nowrap;">
132 if( g.okAdmin && (zCap[0]!='s' || g.okSetup) ){
133 @ <a href="setup_uedit?id=%d(db_column_int(&s,0))">
134 }
135 @ %h(db_column_text(&s,1))
136 if( g.okAdmin ){
137 @ </a>
138 }
139 @ </td>
140 @ <td class="usetupListCap" style="text-align: center;padding-right: 15px;">%s(zCap)</td>
141 @ <td class="usetupListCon" style="text-align: left;">%s(db_column_text(&s,3))</td>
@@ -259,18 +259,18 @@
259 /* user doing the editing is ADMIN. Disallow editing */
260
261 /* Must have ADMIN privleges to access this page
262 */
263 login_check_credentials();
264 if( !g.okAdmin ){ login_needed(); return; }
265
266 /* Check to see if an ADMIN user is trying to edit a SETUP account.
267 ** Don't allow that.
268 */
269 zId = PD("id", "0");
270 uid = atoi(zId);
271 if( zId && !g.okSetup && uid>0 ){
272 char *zOldCaps;
273 zOldCaps = db_text(0, "SELECT cap FROM user WHERE uid=%d",uid);
274 higherUser = zOldCaps && strchr(zOldCaps,'s');
275 }
276
@@ -296,11 +296,11 @@
296 int ak = P("ak")!=0;
297 int an = P("an")!=0;
298 int ao = P("ao")!=0;
299 int ap = P("ap")!=0;
300 int ar = P("ar")!=0;
301 int as = g.okSetup && P("as")!=0;
302 int aw = P("aw")!=0;
303 int ac = P("ac")!=0;
304 int af = P("af")!=0;
305 int am = P("am")!=0;
306 int ah = P("ah")!=0;
@@ -513,11 +513,11 @@
513 @ </tr>
514 @ <tr>
515 @ <td class="usetupEditLabel">Capabilities:</td>
516 @ <td>
517 #define B(x) inherit[x]
518 if( g.okSetup ){
519 @ <input type="checkbox" name="as"%s(oas) />%s(B('s'))Setup<br />
520 }
521 @ <input type="checkbox" name="aa"%s(oaa) />%s(B('a'))Admin<br />
522 @ <input type="checkbox" name="ad"%s(oad) />%s(B('d'))Delete<br />
523 @ <input type="checkbox" name="ae"%s(oae) />%s(B('e'))Email<br />
@@ -816,11 +816,11 @@
816 /*
817 ** WEBPAGE: setup_access
818 */
819 void setup_access(void){
820 login_check_credentials();
821 if( !g.okSetup ){
822 login_needed();
823 }
824
825 style_header("Access Control Settings");
826 db_begin_transaction();
@@ -918,11 +918,11 @@
918 const char *zLogin = PD("login", "");
919 const char *zPw = PD("pw", "");
920 const char *zNewName = PD("newname", "New Login Group");
921
922 login_check_credentials();
923 if( !g.okSetup ){
924 login_needed();
925 }
926 file_canonical_name(g.zRepositoryName, &fullName);
927 zSelfRepo = mprintf(blob_str(&fullName));
928 blob_reset(&fullName);
@@ -1004,11 +1004,11 @@
1004 /*
1005 ** WEBPAGE: setup_timeline
1006 */
1007 void setup_timeline(void){
1008 login_check_credentials();
1009 if( !g.okSetup ){
1010 login_needed();
1011 }
1012
1013 style_header("Timeline Display Preferences");
1014 db_begin_transaction();
@@ -1053,11 +1053,11 @@
1053 */
1054 void setup_settings(void){
1055 struct stControlSettings const *pSet;
1056
1057 login_check_credentials();
1058 if( !g.okSetup ){
1059 login_needed();
1060 }
1061
1062 style_header("Settings");
1063 db_open_local();
@@ -1107,11 +1107,11 @@
1107 /*
1108 ** WEBPAGE: setup_config
1109 */
1110 void setup_config(void){
1111 login_check_credentials();
1112 if( !g.okSetup ){
1113 login_needed();
1114 }
1115
1116 style_header("WWW Configuration");
1117 db_begin_transaction();
@@ -1171,11 +1171,11 @@
1171 /*
1172 ** WEBPAGE: setup_editcss
1173 */
1174 void setup_editcss(void){
1175 login_check_credentials();
1176 if( !g.okSetup ){
1177 login_needed();
1178 }
1179 db_begin_transaction();
1180 if( P("clear")!=0 ){
1181 db_multi_exec("DELETE FROM config WHERE name='css'");
@@ -1215,11 +1215,11 @@
1215 /*
1216 ** WEBPAGE: setup_header
1217 */
1218 void setup_header(void){
1219 login_check_credentials();
1220 if( !g.okSetup ){
1221 login_needed();
1222 }
1223 db_begin_transaction();
1224 if( P("clear")!=0 ){
1225 db_multi_exec("DELETE FROM config WHERE name='header'");
@@ -1253,11 +1253,11 @@
1253 /*
1254 ** WEBPAGE: setup_footer
1255 */
1256 void setup_footer(void){
1257 login_check_credentials();
1258 if( !g.okSetup ){
1259 login_needed();
1260 }
1261 db_begin_transaction();
1262 if( P("clear")!=0 ){
1263 db_multi_exec("DELETE FROM config WHERE name='footer'");
@@ -1296,11 +1296,11 @@
1296 int szImg = atoi(PD("im:bytes","0"));
1297 if( szImg>0 ){
1298 zMime = PD("im:mimetype","image/gif");
1299 }
1300 login_check_credentials();
1301 if( !g.okSetup ){
1302 login_needed();
1303 }
1304 db_begin_transaction();
1305 if( P("set")!=0 && zMime && zMime[0] && szImg>0 ){
1306 Blob img;
1307
--- src/setup.c
+++ src/setup.c
@@ -52,11 +52,11 @@
52 /*
53 ** WEBPAGE: /setup
54 */
55 void setup_page(void){
56 login_check_credentials();
57 if( !g.perm.Setup ){
58 login_needed();
59 }
60
61 style_header("Server Administration");
62 @ <table border="0" cellspacing="7">
@@ -106,11 +106,11 @@
106 */
107 void setup_ulist(void){
108 Stmt s;
109
110 login_check_credentials();
111 if( !g.perm.Admin ){
112 login_needed();
113 return;
114 }
115
116 style_submenu_element("Add", "Add User", "setup_uedit");
@@ -127,15 +127,15 @@
127 db_prepare(&s, "SELECT uid, login, cap, info FROM user ORDER BY login");
128 while( db_step(&s)==SQLITE_ROW ){
129 const char *zCap = db_column_text(&s, 2);
130 @ <tr>
131 @ <td class="usetupListUser" style="text-align: right;padding-right: 20px;white-space:nowrap;">
132 if( g.perm.Admin && (zCap[0]!='s' || g.perm.Setup) ){
133 @ <a href="setup_uedit?id=%d(db_column_int(&s,0))">
134 }
135 @ %h(db_column_text(&s,1))
136 if( g.perm.Admin ){
137 @ </a>
138 }
139 @ </td>
140 @ <td class="usetupListCap" style="text-align: center;padding-right: 15px;">%s(zCap)</td>
141 @ <td class="usetupListCon" style="text-align: left;">%s(db_column_text(&s,3))</td>
@@ -259,18 +259,18 @@
259 /* user doing the editing is ADMIN. Disallow editing */
260
261 /* Must have ADMIN privleges to access this page
262 */
263 login_check_credentials();
264 if( !g.perm.Admin ){ login_needed(); return; }
265
266 /* Check to see if an ADMIN user is trying to edit a SETUP account.
267 ** Don't allow that.
268 */
269 zId = PD("id", "0");
270 uid = atoi(zId);
271 if( zId && !g.perm.Setup && uid>0 ){
272 char *zOldCaps;
273 zOldCaps = db_text(0, "SELECT cap FROM user WHERE uid=%d",uid);
274 higherUser = zOldCaps && strchr(zOldCaps,'s');
275 }
276
@@ -296,11 +296,11 @@
296 int ak = P("ak")!=0;
297 int an = P("an")!=0;
298 int ao = P("ao")!=0;
299 int ap = P("ap")!=0;
300 int ar = P("ar")!=0;
301 int as = g.perm.Setup && P("as")!=0;
302 int aw = P("aw")!=0;
303 int ac = P("ac")!=0;
304 int af = P("af")!=0;
305 int am = P("am")!=0;
306 int ah = P("ah")!=0;
@@ -513,11 +513,11 @@
513 @ </tr>
514 @ <tr>
515 @ <td class="usetupEditLabel">Capabilities:</td>
516 @ <td>
517 #define B(x) inherit[x]
518 if( g.perm.Setup ){
519 @ <input type="checkbox" name="as"%s(oas) />%s(B('s'))Setup<br />
520 }
521 @ <input type="checkbox" name="aa"%s(oaa) />%s(B('a'))Admin<br />
522 @ <input type="checkbox" name="ad"%s(oad) />%s(B('d'))Delete<br />
523 @ <input type="checkbox" name="ae"%s(oae) />%s(B('e'))Email<br />
@@ -816,11 +816,11 @@
816 /*
817 ** WEBPAGE: setup_access
818 */
819 void setup_access(void){
820 login_check_credentials();
821 if( !g.perm.Setup ){
822 login_needed();
823 }
824
825 style_header("Access Control Settings");
826 db_begin_transaction();
@@ -918,11 +918,11 @@
918 const char *zLogin = PD("login", "");
919 const char *zPw = PD("pw", "");
920 const char *zNewName = PD("newname", "New Login Group");
921
922 login_check_credentials();
923 if( !g.perm.Setup ){
924 login_needed();
925 }
926 file_canonical_name(g.zRepositoryName, &fullName);
927 zSelfRepo = mprintf(blob_str(&fullName));
928 blob_reset(&fullName);
@@ -1004,11 +1004,11 @@
1004 /*
1005 ** WEBPAGE: setup_timeline
1006 */
1007 void setup_timeline(void){
1008 login_check_credentials();
1009 if( !g.perm.Setup ){
1010 login_needed();
1011 }
1012
1013 style_header("Timeline Display Preferences");
1014 db_begin_transaction();
@@ -1053,11 +1053,11 @@
1053 */
1054 void setup_settings(void){
1055 struct stControlSettings const *pSet;
1056
1057 login_check_credentials();
1058 if( !g.perm.Setup ){
1059 login_needed();
1060 }
1061
1062 style_header("Settings");
1063 db_open_local();
@@ -1107,11 +1107,11 @@
1107 /*
1108 ** WEBPAGE: setup_config
1109 */
1110 void setup_config(void){
1111 login_check_credentials();
1112 if( !g.perm.Setup ){
1113 login_needed();
1114 }
1115
1116 style_header("WWW Configuration");
1117 db_begin_transaction();
@@ -1171,11 +1171,11 @@
1171 /*
1172 ** WEBPAGE: setup_editcss
1173 */
1174 void setup_editcss(void){
1175 login_check_credentials();
1176 if( !g.perm.Setup ){
1177 login_needed();
1178 }
1179 db_begin_transaction();
1180 if( P("clear")!=0 ){
1181 db_multi_exec("DELETE FROM config WHERE name='css'");
@@ -1215,11 +1215,11 @@
1215 /*
1216 ** WEBPAGE: setup_header
1217 */
1218 void setup_header(void){
1219 login_check_credentials();
1220 if( !g.perm.Setup ){
1221 login_needed();
1222 }
1223 db_begin_transaction();
1224 if( P("clear")!=0 ){
1225 db_multi_exec("DELETE FROM config WHERE name='header'");
@@ -1253,11 +1253,11 @@
1253 /*
1254 ** WEBPAGE: setup_footer
1255 */
1256 void setup_footer(void){
1257 login_check_credentials();
1258 if( !g.perm.Setup ){
1259 login_needed();
1260 }
1261 db_begin_transaction();
1262 if( P("clear")!=0 ){
1263 db_multi_exec("DELETE FROM config WHERE name='footer'");
@@ -1296,11 +1296,11 @@
1296 int szImg = atoi(PD("im:bytes","0"));
1297 if( szImg>0 ){
1298 zMime = PD("im:mimetype","image/gif");
1299 }
1300 login_check_credentials();
1301 if( !g.perm.Setup ){
1302 login_needed();
1303 }
1304 db_begin_transaction();
1305 if( P("set")!=0 && zMime && zMime[0] && szImg>0 ){
1306 Blob img;
1307
+3 -3
--- src/shun.c
+++ src/shun.c
@@ -44,11 +44,11 @@
4444
const char *zUuid = P("uuid");
4545
int nUuid;
4646
char zCanonical[UUID_SIZE+1];
4747
4848
login_check_credentials();
49
- if( !g.okAdmin ){
49
+ if( !g.perm.Admin ){
5050
login_needed();
5151
}
5252
if( P("rebuild") ){
5353
db_close(1);
5454
db_open_repository(g.zRepositoryName);
@@ -219,11 +219,11 @@
219219
int ofst = atoi(PD("ofst","0"));
220220
int cnt;
221221
Stmt q;
222222
223223
login_check_credentials();
224
- if( !g.okAdmin ){
224
+ if( !g.perm.Admin ){
225225
login_needed();
226226
}
227227
style_header("Content Sources");
228228
if( ofst>0 ){
229229
style_submenu_element("Newer", "Newer", "rcvfromlist?ofst=%d",
@@ -282,11 +282,11 @@
282282
void rcvfrom_page(void){
283283
int rcvid = atoi(PD("rcvid","0"));
284284
Stmt q;
285285
286286
login_check_credentials();
287
- if( !g.okAdmin ){
287
+ if( !g.perm.Admin ){
288288
login_needed();
289289
}
290290
style_header("Content Source %d", rcvid);
291291
db_prepare(&q,
292292
"SELECT login, datetime(rcvfrom.mtime), rcvfrom.ipaddr"
293293
--- src/shun.c
+++ src/shun.c
@@ -44,11 +44,11 @@
44 const char *zUuid = P("uuid");
45 int nUuid;
46 char zCanonical[UUID_SIZE+1];
47
48 login_check_credentials();
49 if( !g.okAdmin ){
50 login_needed();
51 }
52 if( P("rebuild") ){
53 db_close(1);
54 db_open_repository(g.zRepositoryName);
@@ -219,11 +219,11 @@
219 int ofst = atoi(PD("ofst","0"));
220 int cnt;
221 Stmt q;
222
223 login_check_credentials();
224 if( !g.okAdmin ){
225 login_needed();
226 }
227 style_header("Content Sources");
228 if( ofst>0 ){
229 style_submenu_element("Newer", "Newer", "rcvfromlist?ofst=%d",
@@ -282,11 +282,11 @@
282 void rcvfrom_page(void){
283 int rcvid = atoi(PD("rcvid","0"));
284 Stmt q;
285
286 login_check_credentials();
287 if( !g.okAdmin ){
288 login_needed();
289 }
290 style_header("Content Source %d", rcvid);
291 db_prepare(&q,
292 "SELECT login, datetime(rcvfrom.mtime), rcvfrom.ipaddr"
293
--- src/shun.c
+++ src/shun.c
@@ -44,11 +44,11 @@
44 const char *zUuid = P("uuid");
45 int nUuid;
46 char zCanonical[UUID_SIZE+1];
47
48 login_check_credentials();
49 if( !g.perm.Admin ){
50 login_needed();
51 }
52 if( P("rebuild") ){
53 db_close(1);
54 db_open_repository(g.zRepositoryName);
@@ -219,11 +219,11 @@
219 int ofst = atoi(PD("ofst","0"));
220 int cnt;
221 Stmt q;
222
223 login_check_credentials();
224 if( !g.perm.Admin ){
225 login_needed();
226 }
227 style_header("Content Sources");
228 if( ofst>0 ){
229 style_submenu_element("Newer", "Newer", "rcvfromlist?ofst=%d",
@@ -282,11 +282,11 @@
282 void rcvfrom_page(void){
283 int rcvid = atoi(PD("rcvid","0"));
284 Stmt q;
285
286 login_check_credentials();
287 if( !g.perm.Admin ){
288 login_needed();
289 }
290 style_header("Content Source %d", rcvid);
291 db_prepare(&q,
292 "SELECT login, datetime(rcvfrom.mtime), rcvfrom.ipaddr"
293
+1 -1
--- src/skins.c
+++ src/skins.c
@@ -1025,11 +1025,11 @@
10251025
const char *zCurrent; /* Current skin */
10261026
int i; /* Loop counter */
10271027
Stmt q;
10281028
10291029
login_check_credentials();
1030
- if( !g.okSetup ){
1030
+ if( !g.perm.Setup ){
10311031
login_needed();
10321032
}
10331033
db_begin_transaction();
10341034
10351035
/* Process requests to delete a user-defined skin */
10361036
--- src/skins.c
+++ src/skins.c
@@ -1025,11 +1025,11 @@
1025 const char *zCurrent; /* Current skin */
1026 int i; /* Loop counter */
1027 Stmt q;
1028
1029 login_check_credentials();
1030 if( !g.okSetup ){
1031 login_needed();
1032 }
1033 db_begin_transaction();
1034
1035 /* Process requests to delete a user-defined skin */
1036
--- src/skins.c
+++ src/skins.c
@@ -1025,11 +1025,11 @@
1025 const char *zCurrent; /* Current skin */
1026 int i; /* Loop counter */
1027 Stmt q;
1028
1029 login_check_credentials();
1030 if( !g.perm.Setup ){
1031 login_needed();
1032 }
1033 db_begin_transaction();
1034
1035 /* Process requests to delete a user-defined skin */
1036
+1 -1
--- src/stat.c
+++ src/stat.c
@@ -34,11 +34,11 @@
3434
const char *zDb;
3535
int brief;
3636
char zBuf[100];
3737
3838
login_check_credentials();
39
- if( !g.okRead ){ login_needed(); return; }
39
+ if( !g.perm.Read ){ login_needed(); return; }
4040
brief = P("brief")!=0;
4141
style_header("Repository Statistics");
4242
@ <table class="label-value">
4343
@ <tr><th>Repository&nbsp;Size:</th><td>
4444
fsize = file_size(g.zRepositoryName);
4545
--- src/stat.c
+++ src/stat.c
@@ -34,11 +34,11 @@
34 const char *zDb;
35 int brief;
36 char zBuf[100];
37
38 login_check_credentials();
39 if( !g.okRead ){ login_needed(); return; }
40 brief = P("brief")!=0;
41 style_header("Repository Statistics");
42 @ <table class="label-value">
43 @ <tr><th>Repository&nbsp;Size:</th><td>
44 fsize = file_size(g.zRepositoryName);
45
--- src/stat.c
+++ src/stat.c
@@ -34,11 +34,11 @@
34 const char *zDb;
35 int brief;
36 char zBuf[100];
37
38 login_check_credentials();
39 if( !g.perm.Read ){ login_needed(); return; }
40 brief = P("brief")!=0;
41 style_header("Repository Statistics");
42 @ <table class="label-value">
43 @ <tr><th>Repository&nbsp;Size:</th><td>
44 fsize = file_size(g.zRepositoryName);
45
+1 -1
--- src/style.c
+++ src/style.c
@@ -820,11 +820,11 @@
820820
@ g.userUid = %d(g.userUid)<br />
821821
@ g.zLogin = %h(g.zLogin)<br />
822822
@ capabilities = %s(zCap)<br />
823823
@ <hr>
824824
cgi_print_all();
825
- if( g.okSetup ){
825
+ if( g.perm.Setup ){
826826
const char *zRedir = P("redirect");
827827
if( zRedir ) cgi_redirect(zRedir);
828828
}
829829
style_footer();
830830
}
831831
--- src/style.c
+++ src/style.c
@@ -820,11 +820,11 @@
820 @ g.userUid = %d(g.userUid)<br />
821 @ g.zLogin = %h(g.zLogin)<br />
822 @ capabilities = %s(zCap)<br />
823 @ <hr>
824 cgi_print_all();
825 if( g.okSetup ){
826 const char *zRedir = P("redirect");
827 if( zRedir ) cgi_redirect(zRedir);
828 }
829 style_footer();
830 }
831
--- src/style.c
+++ src/style.c
@@ -820,11 +820,11 @@
820 @ g.userUid = %d(g.userUid)<br />
821 @ g.zLogin = %h(g.zLogin)<br />
822 @ capabilities = %s(zCap)<br />
823 @ <hr>
824 cgi_print_all();
825 if( g.perm.Setup ){
826 const char *zRedir = P("redirect");
827 if( zRedir ) cgi_redirect(zRedir);
828 }
829 style_footer();
830 }
831
+3 -3
--- src/tag.c
+++ src/tag.c
@@ -529,11 +529,11 @@
529529
*/
530530
void taglist_page(void){
531531
Stmt q;
532532
533533
login_check_credentials();
534
- if( !g.okRead ){
534
+ if( !g.perm.Read ){
535535
login_needed();
536536
}
537537
login_anonymous_available();
538538
style_header("Tags");
539539
style_submenu_element("Timeline", "Timeline", "tagtimeline");
@@ -548,11 +548,11 @@
548548
" ORDER BY tagname"
549549
);
550550
@ <ul>
551551
while( db_step(&q)==SQLITE_ROW ){
552552
const char *zName = db_column_text(&q, 0);
553
- if( g.okHistory ){
553
+ if( g.perm.History ){
554554
@ <li><a class="tagLink" href="%s(g.zTop)/timeline?t=%T(zName)">
555555
@ %h(zName)</a></li>
556556
}else{
557557
@ <li><span class="tagDsp">%h(zName)</span></li>
558558
}
@@ -567,11 +567,11 @@
567567
*/
568568
void tagtimeline_page(void){
569569
Stmt q;
570570
571571
login_check_credentials();
572
- if( !g.okRead ){ login_needed(); return; }
572
+ if( !g.perm.Read ){ login_needed(); return; }
573573
574574
style_header("Tagged Check-ins");
575575
style_submenu_element("List", "List", "taglist");
576576
login_anonymous_available();
577577
@ <h2>Check-ins with non-propagating tags:</h2>
578578
--- src/tag.c
+++ src/tag.c
@@ -529,11 +529,11 @@
529 */
530 void taglist_page(void){
531 Stmt q;
532
533 login_check_credentials();
534 if( !g.okRead ){
535 login_needed();
536 }
537 login_anonymous_available();
538 style_header("Tags");
539 style_submenu_element("Timeline", "Timeline", "tagtimeline");
@@ -548,11 +548,11 @@
548 " ORDER BY tagname"
549 );
550 @ <ul>
551 while( db_step(&q)==SQLITE_ROW ){
552 const char *zName = db_column_text(&q, 0);
553 if( g.okHistory ){
554 @ <li><a class="tagLink" href="%s(g.zTop)/timeline?t=%T(zName)">
555 @ %h(zName)</a></li>
556 }else{
557 @ <li><span class="tagDsp">%h(zName)</span></li>
558 }
@@ -567,11 +567,11 @@
567 */
568 void tagtimeline_page(void){
569 Stmt q;
570
571 login_check_credentials();
572 if( !g.okRead ){ login_needed(); return; }
573
574 style_header("Tagged Check-ins");
575 style_submenu_element("List", "List", "taglist");
576 login_anonymous_available();
577 @ <h2>Check-ins with non-propagating tags:</h2>
578
--- src/tag.c
+++ src/tag.c
@@ -529,11 +529,11 @@
529 */
530 void taglist_page(void){
531 Stmt q;
532
533 login_check_credentials();
534 if( !g.perm.Read ){
535 login_needed();
536 }
537 login_anonymous_available();
538 style_header("Tags");
539 style_submenu_element("Timeline", "Timeline", "tagtimeline");
@@ -548,11 +548,11 @@
548 " ORDER BY tagname"
549 );
550 @ <ul>
551 while( db_step(&q)==SQLITE_ROW ){
552 const char *zName = db_column_text(&q, 0);
553 if( g.perm.History ){
554 @ <li><a class="tagLink" href="%s(g.zTop)/timeline?t=%T(zName)">
555 @ %h(zName)</a></li>
556 }else{
557 @ <li><span class="tagDsp">%h(zName)</span></li>
558 }
@@ -567,11 +567,11 @@
567 */
568 void tagtimeline_page(void){
569 Stmt q;
570
571 login_check_credentials();
572 if( !g.perm.Read ){ login_needed(); return; }
573
574 style_header("Tagged Check-ins");
575 style_submenu_element("List", "List", "taglist");
576 login_anonymous_available();
577 @ <h2>Check-ins with non-propagating tags:</h2>
578
+1 -1
--- src/tar.c
+++ src/tar.c
@@ -572,11 +572,11 @@
572572
char *zName, *zRid;
573573
int nName, nRid;
574574
Blob tarball;
575575
576576
login_check_credentials();
577
- if( !g.okZip ){ login_needed(); return; }
577
+ if( !g.perm.Zip ){ login_needed(); return; }
578578
zName = mprintf("%s", PD("name",""));
579579
nName = strlen(zName);
580580
zRid = mprintf("%s", PD("uuid",""));
581581
nRid = strlen(zRid);
582582
if( nName>7 && fossil_strcmp(&zName[nName-7], ".tar.gz")==0 ){
583583
--- src/tar.c
+++ src/tar.c
@@ -572,11 +572,11 @@
572 char *zName, *zRid;
573 int nName, nRid;
574 Blob tarball;
575
576 login_check_credentials();
577 if( !g.okZip ){ login_needed(); return; }
578 zName = mprintf("%s", PD("name",""));
579 nName = strlen(zName);
580 zRid = mprintf("%s", PD("uuid",""));
581 nRid = strlen(zRid);
582 if( nName>7 && fossil_strcmp(&zName[nName-7], ".tar.gz")==0 ){
583
--- src/tar.c
+++ src/tar.c
@@ -572,11 +572,11 @@
572 char *zName, *zRid;
573 int nName, nRid;
574 Blob tarball;
575
576 login_check_credentials();
577 if( !g.perm.Zip ){ login_needed(); return; }
578 zName = mprintf("%s", PD("name",""));
579 nName = strlen(zName);
580 zRid = mprintf("%s", PD("uuid",""));
581 nRid = strlen(zRid);
582 if( nName>7 && fossil_strcmp(&zName[nName-7], ".tar.gz")==0 ){
583
+31 -31
--- src/timeline.c
+++ src/timeline.c
@@ -47,11 +47,11 @@
4747
** Generate a hyperlink to a version.
4848
*/
4949
void hyperlink_to_uuid(const char *zUuid){
5050
char z[UUID_SIZE+1];
5151
shorten_uuid(z, zUuid);
52
- if( g.okHistory ){
52
+ if( g.perm.History ){
5353
@ <a class="timelineHistLink" href="%s(g.zTop)/info/%s(z)">[%s(z)]</a>
5454
}else{
5555
@ <span class="timelineHistDsp">[%s(z)]</span>
5656
}
5757
}
@@ -58,11 +58,11 @@
5858
5959
/*
6060
** Generate a hyperlink to a diff between two versions.
6161
*/
6262
void hyperlink_to_diff(const char *zV1, const char *zV2){
63
- if( g.okHistory ){
63
+ if( g.perm.History ){
6464
if( zV2==0 ){
6565
@ <a href="%s(g.zTop)/diff?v2=%s(zV1)">[diff]</a>
6666
}else{
6767
@ <a href="%s(g.zTop)/diff?v1=%s(zV1)&amp;v2=%s(zV2)">[diff]</a>
6868
}
@@ -72,11 +72,11 @@
7272
/*
7373
** Generate a hyperlink to a date & time.
7474
*/
7575
void hyperlink_to_date(const char *zDate, const char *zSuffix){
7676
if( zSuffix==0 ) zSuffix = "";
77
- if( g.okHistory ){
77
+ if( g.perm.History ){
7878
@ <a href="%s(g.zTop)/timeline?c=%T(zDate)">%s(zDate)</a>%s(zSuffix)
7979
}else{
8080
@ %s(zDate)%s(zSuffix)
8181
}
8282
}
@@ -86,11 +86,11 @@
8686
** events by that user. If the date+time is specified, then the timeline
8787
** is centered on that date+time.
8888
*/
8989
void hyperlink_to_user(const char *zU, const char *zD, const char *zSuf){
9090
if( zSuf==0 ) zSuf = "";
91
- if( g.okHistory ){
91
+ if( g.perm.History ){
9292
if( zD && zD[0] ){
9393
@ <a href="%s(g.zTop)/timeline?c=%T(zD)&amp;u=%T(zU)">%h(zU)</a>%s(zSuf)
9494
}else{
9595
@ <a href="%s(g.zTop)/timeline?u=%T(zU)">%h(zU)</a>%s(zSuf)
9696
}
@@ -350,11 +350,11 @@
350350
351351
/* Generate the "user: USERNAME" at the end of the comment, together
352352
** with a hyperlink to another timeline for that user.
353353
*/
354354
if( zTagList && zTagList[0]==0 ) zTagList = 0;
355
- if( g.okHistory && fossil_strcmp(zUser, zThisUser)!=0 ){
355
+ if( g.perm.History && fossil_strcmp(zUser, zThisUser)!=0 ){
356356
char *zLink = mprintf("%s/timeline?u=%h&c=%t&nd",
357357
g.zTop, zUser, zDate);
358358
@ (user: <a href="%s(zLink)">%h(zUser)</a>%s(zTagList?",":"\051")
359359
fossil_free(zLink);
360360
}else{
@@ -363,11 +363,11 @@
363363
364364
/* Generate the "tags: TAGLIST" at the end of the comment, together
365365
** with hyperlinks to the tag list.
366366
*/
367367
if( zTagList ){
368
- if( g.okHistory ){
368
+ if( g.perm.History ){
369369
int i;
370370
const char *z = zTagList;
371371
Blob links;
372372
blob_zero(&links);
373373
while( z && z[0] ){
@@ -394,11 +394,11 @@
394394
if( xExtra ){
395395
xExtra(rid);
396396
}
397397
398398
/* Generate the file-change list if requested */
399
- if( (tmFlags & TIMELINE_FCHANGES)!=0 && zType[0]=='c' && g.okHistory ){
399
+ if( (tmFlags & TIMELINE_FCHANGES)!=0 && zType[0]=='c' && g.perm.History ){
400400
int inUl = 0;
401401
if( !fchngQueryInit ){
402402
db_prepare(&fchngQuery,
403403
"SELECT (pid==0) AS isnew,"
404404
" (fid==0) AS isdel,"
@@ -896,15 +896,15 @@
896896
int you_rid = name_to_typed_rid(P("you"),"ci");/* you= for common ancst */
897897
898898
/* To view the timeline, must have permission to read project data.
899899
*/
900900
login_check_credentials();
901
- if( !g.okRead && !g.okRdTkt && !g.okRdWiki ){ login_needed(); return; }
902
- if( zTagName && g.okRead ){
901
+ if( !g.perm.Read && !g.perm.RdTkt && !g.perm.RdWiki ){ login_needed(); return; }
902
+ if( zTagName && g.perm.Read ){
903903
tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname='sym-%q'", zTagName);
904904
zThisTag = zTagName;
905
- }else if( zBrName && g.okRead ){
905
+ }else if( zBrName && g.perm.Read ){
906906
tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname='sym-%q'",zBrName);
907907
zThisTag = zBrName;
908908
}else{
909909
tagid = 0;
910910
}
@@ -930,11 +930,11 @@
930930
if( P("fc")!=0 || P("detail")!=0 ){
931931
tmFlags |= TIMELINE_FCHANGES;
932932
url_add_parameter(&url, "fc", 0);
933933
}
934934
if( !useDividers ) url_add_parameter(&url, "nd", 0);
935
- if( ((from_rid && to_rid) || (me_rid && you_rid)) && g.okRead ){
935
+ if( ((from_rid && to_rid) || (me_rid && you_rid)) && g.perm.Read ){
936936
/* If from= and to= are present, display all nodes on a path connecting
937937
** the two */
938938
PathNode *p = 0;
939939
const char *zFrom = 0;
940940
const char *zTo = 0;
@@ -956,24 +956,24 @@
956956
p = p->u.pTo;
957957
}
958958
blob_append(&sql, ")", -1);
959959
path_reset();
960960
blob_append(&desc, "All nodes on the path from ", -1);
961
- if( g.okHistory ){
961
+ if( g.perm.History ){
962962
blob_appendf(&desc, "<a href='%s/info/%h'>[%h]</a>", g.zTop,zFrom,zFrom);
963963
}else{
964964
blob_appendf(&desc, "[%h]", zFrom);
965965
}
966966
blob_append(&desc, " and ", -1);
967
- if( g.okHistory ){
967
+ if( g.perm.History ){
968968
blob_appendf(&desc, "<a href='%s/info/%h'>[%h]</a>.", g.zTop, zTo, zTo);
969969
}else{
970970
blob_appendf(&desc, "[%h].", zTo);
971971
}
972972
tmFlags |= TIMELINE_DISJOINT;
973973
db_multi_exec("%s", blob_str(&sql));
974
- }else if( (p_rid || d_rid) && g.okRead ){
974
+ }else if( (p_rid || d_rid) && g.perm.Read ){
975975
/* If p= or d= is present, ignore all other parameters other than n= */
976976
char *zUuid;
977977
int np, nd;
978978
979979
if( p_rid && d_rid ){
@@ -1005,17 +1005,17 @@
10051005
blob_appendf(&desc, "%d ancestors", np);
10061006
db_multi_exec("%s", blob_str(&sql));
10071007
}
10081008
if( d_rid==0 && useDividers ) timeline_add_dividers(0, p_rid);
10091009
}
1010
- if( g.okHistory ){
1010
+ if( g.perm.History ){
10111011
blob_appendf(&desc, " of <a href='%s/info/%s'>[%.10s]</a>",
10121012
g.zTop, zUuid, zUuid);
10131013
}else{
10141014
blob_appendf(&desc, " of check-in [%.10s]", zUuid);
10151015
}
1016
- }else if( f_rid && g.okRead ){
1016
+ }else if( f_rid && g.perm.Read ){
10171017
/* If f= is present, ignore all other parameters other than n= */
10181018
char *zUuid;
10191019
db_multi_exec(
10201020
"CREATE TEMP TABLE IF NOT EXISTS ok(rid INTEGER PRIMARY KEY);"
10211021
"INSERT INTO ok VALUES(%d);"
@@ -1026,11 +1026,11 @@
10261026
blob_appendf(&sql, " AND event.objid IN ok");
10271027
db_multi_exec("%s", blob_str(&sql));
10281028
if( useDividers ) timeline_add_dividers(0, f_rid);
10291029
blob_appendf(&desc, "Parents and children of check-in ");
10301030
zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", f_rid);
1031
- if( g.okHistory ){
1031
+ if( g.perm.History ){
10321032
blob_appendf(&desc, "<a href='%s/info/%s'>[%.10s]</a>",
10331033
g.zTop, zUuid, zUuid);
10341034
}else{
10351035
blob_appendf(&desc, "[%.10s]", zUuid);
10361036
}
@@ -1071,30 +1071,30 @@
10711071
}else{
10721072
url_add_parameter(&url, "t", zTagName);
10731073
}
10741074
blob_appendf(&sql, ")");
10751075
}
1076
- if( (zType[0]=='w' && !g.okRdWiki)
1077
- || (zType[0]=='t' && !g.okRdTkt)
1078
- || (zType[0]=='e' && !g.okRdWiki)
1079
- || (zType[0]=='c' && !g.okRead)
1076
+ if( (zType[0]=='w' && !g.perm.RdWiki)
1077
+ || (zType[0]=='t' && !g.perm.RdTkt)
1078
+ || (zType[0]=='e' && !g.perm.RdWiki)
1079
+ || (zType[0]=='c' && !g.perm.Read)
10801080
){
10811081
zType = "all";
10821082
}
10831083
if( zType[0]=='a' ){
1084
- if( !g.okRead || !g.okRdWiki || !g.okRdTkt ){
1084
+ if( !g.perm.Read || !g.perm.RdWiki || !g.perm.RdTkt ){
10851085
char cSep = '(';
10861086
blob_appendf(&sql, " AND event.type IN ");
1087
- if( g.okRead ){
1087
+ if( g.perm.Read ){
10881088
blob_appendf(&sql, "%c'ci'", cSep);
10891089
cSep = ',';
10901090
}
1091
- if( g.okRdWiki ){
1091
+ if( g.perm.RdWiki ){
10921092
blob_appendf(&sql, "%c'w','e'", cSep);
10931093
cSep = ',';
10941094
}
1095
- if( g.okRdTkt ){
1095
+ if( g.perm.RdTkt ){
10961096
blob_appendf(&sql, "%c't'", cSep);
10971097
cSep = ',';
10981098
}
10991099
blob_appendf(&sql, ")");
11001100
}
@@ -1200,11 +1200,11 @@
12001200
blob_appendf(&desc, " occurring around %h.<br />", zCirca);
12011201
}
12021202
if( zSearch ){
12031203
blob_appendf(&desc, " matching \"%h\"", zSearch);
12041204
}
1205
- if( g.okHistory ){
1205
+ if( g.perm.History ){
12061206
if( zAfter || n==nEntry ){
12071207
zDate = db_text(0, "SELECT min(timestamp) FROM timeline /*scan*/");
12081208
timeline_submenu(&url, "Older", "b", zDate, "a");
12091209
free(zDate);
12101210
}
@@ -1214,20 +1214,20 @@
12141214
free(zDate);
12151215
}else if( tagid==0 ){
12161216
if( zType[0]!='a' ){
12171217
timeline_submenu(&url, "All Types", "y", "all", 0);
12181218
}
1219
- if( zType[0]!='w' && g.okRdWiki ){
1219
+ if( zType[0]!='w' && g.perm.RdWiki ){
12201220
timeline_submenu(&url, "Wiki Only", "y", "w", 0);
12211221
}
1222
- if( zType[0]!='c' && g.okRead ){
1222
+ if( zType[0]!='c' && g.perm.Read ){
12231223
timeline_submenu(&url, "Checkins Only", "y", "ci", 0);
12241224
}
1225
- if( zType[0]!='t' && g.okRdTkt ){
1225
+ if( zType[0]!='t' && g.perm.RdTkt ){
12261226
timeline_submenu(&url, "Tickets Only", "y", "t", 0);
12271227
}
1228
- if( zType[0]!='e' && g.okRdWiki ){
1228
+ if( zType[0]!='e' && g.perm.RdWiki ){
12291229
timeline_submenu(&url, "Events Only", "y", "e", 0);
12301230
}
12311231
}
12321232
if( nEntry>20 ){
12331233
timeline_submenu(&url, "20 Entries", "n", "20", 0);
@@ -1602,11 +1602,11 @@
16021602
*/
16031603
void test_timewarp_page(void){
16041604
Stmt q;
16051605
16061606
login_check_credentials();
1607
- if( !g.okRead || !g.okHistory ){ login_needed(); return; }
1607
+ if( !g.perm.Read || !g.perm.History ){ login_needed(); return; }
16081608
style_header("Instances of timewarp");
16091609
@ <ul>
16101610
db_prepare(&q,
16111611
"SELECT blob.uuid "
16121612
" FROM plink p, plink c, blob"
16131613
--- src/timeline.c
+++ src/timeline.c
@@ -47,11 +47,11 @@
47 ** Generate a hyperlink to a version.
48 */
49 void hyperlink_to_uuid(const char *zUuid){
50 char z[UUID_SIZE+1];
51 shorten_uuid(z, zUuid);
52 if( g.okHistory ){
53 @ <a class="timelineHistLink" href="%s(g.zTop)/info/%s(z)">[%s(z)]</a>
54 }else{
55 @ <span class="timelineHistDsp">[%s(z)]</span>
56 }
57 }
@@ -58,11 +58,11 @@
58
59 /*
60 ** Generate a hyperlink to a diff between two versions.
61 */
62 void hyperlink_to_diff(const char *zV1, const char *zV2){
63 if( g.okHistory ){
64 if( zV2==0 ){
65 @ <a href="%s(g.zTop)/diff?v2=%s(zV1)">[diff]</a>
66 }else{
67 @ <a href="%s(g.zTop)/diff?v1=%s(zV1)&amp;v2=%s(zV2)">[diff]</a>
68 }
@@ -72,11 +72,11 @@
72 /*
73 ** Generate a hyperlink to a date & time.
74 */
75 void hyperlink_to_date(const char *zDate, const char *zSuffix){
76 if( zSuffix==0 ) zSuffix = "";
77 if( g.okHistory ){
78 @ <a href="%s(g.zTop)/timeline?c=%T(zDate)">%s(zDate)</a>%s(zSuffix)
79 }else{
80 @ %s(zDate)%s(zSuffix)
81 }
82 }
@@ -86,11 +86,11 @@
86 ** events by that user. If the date+time is specified, then the timeline
87 ** is centered on that date+time.
88 */
89 void hyperlink_to_user(const char *zU, const char *zD, const char *zSuf){
90 if( zSuf==0 ) zSuf = "";
91 if( g.okHistory ){
92 if( zD && zD[0] ){
93 @ <a href="%s(g.zTop)/timeline?c=%T(zD)&amp;u=%T(zU)">%h(zU)</a>%s(zSuf)
94 }else{
95 @ <a href="%s(g.zTop)/timeline?u=%T(zU)">%h(zU)</a>%s(zSuf)
96 }
@@ -350,11 +350,11 @@
350
351 /* Generate the "user: USERNAME" at the end of the comment, together
352 ** with a hyperlink to another timeline for that user.
353 */
354 if( zTagList && zTagList[0]==0 ) zTagList = 0;
355 if( g.okHistory && fossil_strcmp(zUser, zThisUser)!=0 ){
356 char *zLink = mprintf("%s/timeline?u=%h&c=%t&nd",
357 g.zTop, zUser, zDate);
358 @ (user: <a href="%s(zLink)">%h(zUser)</a>%s(zTagList?",":"\051")
359 fossil_free(zLink);
360 }else{
@@ -363,11 +363,11 @@
363
364 /* Generate the "tags: TAGLIST" at the end of the comment, together
365 ** with hyperlinks to the tag list.
366 */
367 if( zTagList ){
368 if( g.okHistory ){
369 int i;
370 const char *z = zTagList;
371 Blob links;
372 blob_zero(&links);
373 while( z && z[0] ){
@@ -394,11 +394,11 @@
394 if( xExtra ){
395 xExtra(rid);
396 }
397
398 /* Generate the file-change list if requested */
399 if( (tmFlags & TIMELINE_FCHANGES)!=0 && zType[0]=='c' && g.okHistory ){
400 int inUl = 0;
401 if( !fchngQueryInit ){
402 db_prepare(&fchngQuery,
403 "SELECT (pid==0) AS isnew,"
404 " (fid==0) AS isdel,"
@@ -896,15 +896,15 @@
896 int you_rid = name_to_typed_rid(P("you"),"ci");/* you= for common ancst */
897
898 /* To view the timeline, must have permission to read project data.
899 */
900 login_check_credentials();
901 if( !g.okRead && !g.okRdTkt && !g.okRdWiki ){ login_needed(); return; }
902 if( zTagName && g.okRead ){
903 tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname='sym-%q'", zTagName);
904 zThisTag = zTagName;
905 }else if( zBrName && g.okRead ){
906 tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname='sym-%q'",zBrName);
907 zThisTag = zBrName;
908 }else{
909 tagid = 0;
910 }
@@ -930,11 +930,11 @@
930 if( P("fc")!=0 || P("detail")!=0 ){
931 tmFlags |= TIMELINE_FCHANGES;
932 url_add_parameter(&url, "fc", 0);
933 }
934 if( !useDividers ) url_add_parameter(&url, "nd", 0);
935 if( ((from_rid && to_rid) || (me_rid && you_rid)) && g.okRead ){
936 /* If from= and to= are present, display all nodes on a path connecting
937 ** the two */
938 PathNode *p = 0;
939 const char *zFrom = 0;
940 const char *zTo = 0;
@@ -956,24 +956,24 @@
956 p = p->u.pTo;
957 }
958 blob_append(&sql, ")", -1);
959 path_reset();
960 blob_append(&desc, "All nodes on the path from ", -1);
961 if( g.okHistory ){
962 blob_appendf(&desc, "<a href='%s/info/%h'>[%h]</a>", g.zTop,zFrom,zFrom);
963 }else{
964 blob_appendf(&desc, "[%h]", zFrom);
965 }
966 blob_append(&desc, " and ", -1);
967 if( g.okHistory ){
968 blob_appendf(&desc, "<a href='%s/info/%h'>[%h]</a>.", g.zTop, zTo, zTo);
969 }else{
970 blob_appendf(&desc, "[%h].", zTo);
971 }
972 tmFlags |= TIMELINE_DISJOINT;
973 db_multi_exec("%s", blob_str(&sql));
974 }else if( (p_rid || d_rid) && g.okRead ){
975 /* If p= or d= is present, ignore all other parameters other than n= */
976 char *zUuid;
977 int np, nd;
978
979 if( p_rid && d_rid ){
@@ -1005,17 +1005,17 @@
1005 blob_appendf(&desc, "%d ancestors", np);
1006 db_multi_exec("%s", blob_str(&sql));
1007 }
1008 if( d_rid==0 && useDividers ) timeline_add_dividers(0, p_rid);
1009 }
1010 if( g.okHistory ){
1011 blob_appendf(&desc, " of <a href='%s/info/%s'>[%.10s]</a>",
1012 g.zTop, zUuid, zUuid);
1013 }else{
1014 blob_appendf(&desc, " of check-in [%.10s]", zUuid);
1015 }
1016 }else if( f_rid && g.okRead ){
1017 /* If f= is present, ignore all other parameters other than n= */
1018 char *zUuid;
1019 db_multi_exec(
1020 "CREATE TEMP TABLE IF NOT EXISTS ok(rid INTEGER PRIMARY KEY);"
1021 "INSERT INTO ok VALUES(%d);"
@@ -1026,11 +1026,11 @@
1026 blob_appendf(&sql, " AND event.objid IN ok");
1027 db_multi_exec("%s", blob_str(&sql));
1028 if( useDividers ) timeline_add_dividers(0, f_rid);
1029 blob_appendf(&desc, "Parents and children of check-in ");
1030 zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", f_rid);
1031 if( g.okHistory ){
1032 blob_appendf(&desc, "<a href='%s/info/%s'>[%.10s]</a>",
1033 g.zTop, zUuid, zUuid);
1034 }else{
1035 blob_appendf(&desc, "[%.10s]", zUuid);
1036 }
@@ -1071,30 +1071,30 @@
1071 }else{
1072 url_add_parameter(&url, "t", zTagName);
1073 }
1074 blob_appendf(&sql, ")");
1075 }
1076 if( (zType[0]=='w' && !g.okRdWiki)
1077 || (zType[0]=='t' && !g.okRdTkt)
1078 || (zType[0]=='e' && !g.okRdWiki)
1079 || (zType[0]=='c' && !g.okRead)
1080 ){
1081 zType = "all";
1082 }
1083 if( zType[0]=='a' ){
1084 if( !g.okRead || !g.okRdWiki || !g.okRdTkt ){
1085 char cSep = '(';
1086 blob_appendf(&sql, " AND event.type IN ");
1087 if( g.okRead ){
1088 blob_appendf(&sql, "%c'ci'", cSep);
1089 cSep = ',';
1090 }
1091 if( g.okRdWiki ){
1092 blob_appendf(&sql, "%c'w','e'", cSep);
1093 cSep = ',';
1094 }
1095 if( g.okRdTkt ){
1096 blob_appendf(&sql, "%c't'", cSep);
1097 cSep = ',';
1098 }
1099 blob_appendf(&sql, ")");
1100 }
@@ -1200,11 +1200,11 @@
1200 blob_appendf(&desc, " occurring around %h.<br />", zCirca);
1201 }
1202 if( zSearch ){
1203 blob_appendf(&desc, " matching \"%h\"", zSearch);
1204 }
1205 if( g.okHistory ){
1206 if( zAfter || n==nEntry ){
1207 zDate = db_text(0, "SELECT min(timestamp) FROM timeline /*scan*/");
1208 timeline_submenu(&url, "Older", "b", zDate, "a");
1209 free(zDate);
1210 }
@@ -1214,20 +1214,20 @@
1214 free(zDate);
1215 }else if( tagid==0 ){
1216 if( zType[0]!='a' ){
1217 timeline_submenu(&url, "All Types", "y", "all", 0);
1218 }
1219 if( zType[0]!='w' && g.okRdWiki ){
1220 timeline_submenu(&url, "Wiki Only", "y", "w", 0);
1221 }
1222 if( zType[0]!='c' && g.okRead ){
1223 timeline_submenu(&url, "Checkins Only", "y", "ci", 0);
1224 }
1225 if( zType[0]!='t' && g.okRdTkt ){
1226 timeline_submenu(&url, "Tickets Only", "y", "t", 0);
1227 }
1228 if( zType[0]!='e' && g.okRdWiki ){
1229 timeline_submenu(&url, "Events Only", "y", "e", 0);
1230 }
1231 }
1232 if( nEntry>20 ){
1233 timeline_submenu(&url, "20 Entries", "n", "20", 0);
@@ -1602,11 +1602,11 @@
1602 */
1603 void test_timewarp_page(void){
1604 Stmt q;
1605
1606 login_check_credentials();
1607 if( !g.okRead || !g.okHistory ){ login_needed(); return; }
1608 style_header("Instances of timewarp");
1609 @ <ul>
1610 db_prepare(&q,
1611 "SELECT blob.uuid "
1612 " FROM plink p, plink c, blob"
1613
--- src/timeline.c
+++ src/timeline.c
@@ -47,11 +47,11 @@
47 ** Generate a hyperlink to a version.
48 */
49 void hyperlink_to_uuid(const char *zUuid){
50 char z[UUID_SIZE+1];
51 shorten_uuid(z, zUuid);
52 if( g.perm.History ){
53 @ <a class="timelineHistLink" href="%s(g.zTop)/info/%s(z)">[%s(z)]</a>
54 }else{
55 @ <span class="timelineHistDsp">[%s(z)]</span>
56 }
57 }
@@ -58,11 +58,11 @@
58
59 /*
60 ** Generate a hyperlink to a diff between two versions.
61 */
62 void hyperlink_to_diff(const char *zV1, const char *zV2){
63 if( g.perm.History ){
64 if( zV2==0 ){
65 @ <a href="%s(g.zTop)/diff?v2=%s(zV1)">[diff]</a>
66 }else{
67 @ <a href="%s(g.zTop)/diff?v1=%s(zV1)&amp;v2=%s(zV2)">[diff]</a>
68 }
@@ -72,11 +72,11 @@
72 /*
73 ** Generate a hyperlink to a date & time.
74 */
75 void hyperlink_to_date(const char *zDate, const char *zSuffix){
76 if( zSuffix==0 ) zSuffix = "";
77 if( g.perm.History ){
78 @ <a href="%s(g.zTop)/timeline?c=%T(zDate)">%s(zDate)</a>%s(zSuffix)
79 }else{
80 @ %s(zDate)%s(zSuffix)
81 }
82 }
@@ -86,11 +86,11 @@
86 ** events by that user. If the date+time is specified, then the timeline
87 ** is centered on that date+time.
88 */
89 void hyperlink_to_user(const char *zU, const char *zD, const char *zSuf){
90 if( zSuf==0 ) zSuf = "";
91 if( g.perm.History ){
92 if( zD && zD[0] ){
93 @ <a href="%s(g.zTop)/timeline?c=%T(zD)&amp;u=%T(zU)">%h(zU)</a>%s(zSuf)
94 }else{
95 @ <a href="%s(g.zTop)/timeline?u=%T(zU)">%h(zU)</a>%s(zSuf)
96 }
@@ -350,11 +350,11 @@
350
351 /* Generate the "user: USERNAME" at the end of the comment, together
352 ** with a hyperlink to another timeline for that user.
353 */
354 if( zTagList && zTagList[0]==0 ) zTagList = 0;
355 if( g.perm.History && fossil_strcmp(zUser, zThisUser)!=0 ){
356 char *zLink = mprintf("%s/timeline?u=%h&c=%t&nd",
357 g.zTop, zUser, zDate);
358 @ (user: <a href="%s(zLink)">%h(zUser)</a>%s(zTagList?",":"\051")
359 fossil_free(zLink);
360 }else{
@@ -363,11 +363,11 @@
363
364 /* Generate the "tags: TAGLIST" at the end of the comment, together
365 ** with hyperlinks to the tag list.
366 */
367 if( zTagList ){
368 if( g.perm.History ){
369 int i;
370 const char *z = zTagList;
371 Blob links;
372 blob_zero(&links);
373 while( z && z[0] ){
@@ -394,11 +394,11 @@
394 if( xExtra ){
395 xExtra(rid);
396 }
397
398 /* Generate the file-change list if requested */
399 if( (tmFlags & TIMELINE_FCHANGES)!=0 && zType[0]=='c' && g.perm.History ){
400 int inUl = 0;
401 if( !fchngQueryInit ){
402 db_prepare(&fchngQuery,
403 "SELECT (pid==0) AS isnew,"
404 " (fid==0) AS isdel,"
@@ -896,15 +896,15 @@
896 int you_rid = name_to_typed_rid(P("you"),"ci");/* you= for common ancst */
897
898 /* To view the timeline, must have permission to read project data.
899 */
900 login_check_credentials();
901 if( !g.perm.Read && !g.perm.RdTkt && !g.perm.RdWiki ){ login_needed(); return; }
902 if( zTagName && g.perm.Read ){
903 tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname='sym-%q'", zTagName);
904 zThisTag = zTagName;
905 }else if( zBrName && g.perm.Read ){
906 tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname='sym-%q'",zBrName);
907 zThisTag = zBrName;
908 }else{
909 tagid = 0;
910 }
@@ -930,11 +930,11 @@
930 if( P("fc")!=0 || P("detail")!=0 ){
931 tmFlags |= TIMELINE_FCHANGES;
932 url_add_parameter(&url, "fc", 0);
933 }
934 if( !useDividers ) url_add_parameter(&url, "nd", 0);
935 if( ((from_rid && to_rid) || (me_rid && you_rid)) && g.perm.Read ){
936 /* If from= and to= are present, display all nodes on a path connecting
937 ** the two */
938 PathNode *p = 0;
939 const char *zFrom = 0;
940 const char *zTo = 0;
@@ -956,24 +956,24 @@
956 p = p->u.pTo;
957 }
958 blob_append(&sql, ")", -1);
959 path_reset();
960 blob_append(&desc, "All nodes on the path from ", -1);
961 if( g.perm.History ){
962 blob_appendf(&desc, "<a href='%s/info/%h'>[%h]</a>", g.zTop,zFrom,zFrom);
963 }else{
964 blob_appendf(&desc, "[%h]", zFrom);
965 }
966 blob_append(&desc, " and ", -1);
967 if( g.perm.History ){
968 blob_appendf(&desc, "<a href='%s/info/%h'>[%h]</a>.", g.zTop, zTo, zTo);
969 }else{
970 blob_appendf(&desc, "[%h].", zTo);
971 }
972 tmFlags |= TIMELINE_DISJOINT;
973 db_multi_exec("%s", blob_str(&sql));
974 }else if( (p_rid || d_rid) && g.perm.Read ){
975 /* If p= or d= is present, ignore all other parameters other than n= */
976 char *zUuid;
977 int np, nd;
978
979 if( p_rid && d_rid ){
@@ -1005,17 +1005,17 @@
1005 blob_appendf(&desc, "%d ancestors", np);
1006 db_multi_exec("%s", blob_str(&sql));
1007 }
1008 if( d_rid==0 && useDividers ) timeline_add_dividers(0, p_rid);
1009 }
1010 if( g.perm.History ){
1011 blob_appendf(&desc, " of <a href='%s/info/%s'>[%.10s]</a>",
1012 g.zTop, zUuid, zUuid);
1013 }else{
1014 blob_appendf(&desc, " of check-in [%.10s]", zUuid);
1015 }
1016 }else if( f_rid && g.perm.Read ){
1017 /* If f= is present, ignore all other parameters other than n= */
1018 char *zUuid;
1019 db_multi_exec(
1020 "CREATE TEMP TABLE IF NOT EXISTS ok(rid INTEGER PRIMARY KEY);"
1021 "INSERT INTO ok VALUES(%d);"
@@ -1026,11 +1026,11 @@
1026 blob_appendf(&sql, " AND event.objid IN ok");
1027 db_multi_exec("%s", blob_str(&sql));
1028 if( useDividers ) timeline_add_dividers(0, f_rid);
1029 blob_appendf(&desc, "Parents and children of check-in ");
1030 zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", f_rid);
1031 if( g.perm.History ){
1032 blob_appendf(&desc, "<a href='%s/info/%s'>[%.10s]</a>",
1033 g.zTop, zUuid, zUuid);
1034 }else{
1035 blob_appendf(&desc, "[%.10s]", zUuid);
1036 }
@@ -1071,30 +1071,30 @@
1071 }else{
1072 url_add_parameter(&url, "t", zTagName);
1073 }
1074 blob_appendf(&sql, ")");
1075 }
1076 if( (zType[0]=='w' && !g.perm.RdWiki)
1077 || (zType[0]=='t' && !g.perm.RdTkt)
1078 || (zType[0]=='e' && !g.perm.RdWiki)
1079 || (zType[0]=='c' && !g.perm.Read)
1080 ){
1081 zType = "all";
1082 }
1083 if( zType[0]=='a' ){
1084 if( !g.perm.Read || !g.perm.RdWiki || !g.perm.RdTkt ){
1085 char cSep = '(';
1086 blob_appendf(&sql, " AND event.type IN ");
1087 if( g.perm.Read ){
1088 blob_appendf(&sql, "%c'ci'", cSep);
1089 cSep = ',';
1090 }
1091 if( g.perm.RdWiki ){
1092 blob_appendf(&sql, "%c'w','e'", cSep);
1093 cSep = ',';
1094 }
1095 if( g.perm.RdTkt ){
1096 blob_appendf(&sql, "%c't'", cSep);
1097 cSep = ',';
1098 }
1099 blob_appendf(&sql, ")");
1100 }
@@ -1200,11 +1200,11 @@
1200 blob_appendf(&desc, " occurring around %h.<br />", zCirca);
1201 }
1202 if( zSearch ){
1203 blob_appendf(&desc, " matching \"%h\"", zSearch);
1204 }
1205 if( g.perm.History ){
1206 if( zAfter || n==nEntry ){
1207 zDate = db_text(0, "SELECT min(timestamp) FROM timeline /*scan*/");
1208 timeline_submenu(&url, "Older", "b", zDate, "a");
1209 free(zDate);
1210 }
@@ -1214,20 +1214,20 @@
1214 free(zDate);
1215 }else if( tagid==0 ){
1216 if( zType[0]!='a' ){
1217 timeline_submenu(&url, "All Types", "y", "all", 0);
1218 }
1219 if( zType[0]!='w' && g.perm.RdWiki ){
1220 timeline_submenu(&url, "Wiki Only", "y", "w", 0);
1221 }
1222 if( zType[0]!='c' && g.perm.Read ){
1223 timeline_submenu(&url, "Checkins Only", "y", "ci", 0);
1224 }
1225 if( zType[0]!='t' && g.perm.RdTkt ){
1226 timeline_submenu(&url, "Tickets Only", "y", "t", 0);
1227 }
1228 if( zType[0]!='e' && g.perm.RdWiki ){
1229 timeline_submenu(&url, "Events Only", "y", "e", 0);
1230 }
1231 }
1232 if( nEntry>20 ){
1233 timeline_submenu(&url, "20 Entries", "n", "20", 0);
@@ -1602,11 +1602,11 @@
1602 */
1603 void test_timewarp_page(void){
1604 Stmt q;
1605
1606 login_check_credentials();
1607 if( !g.perm.Read || !g.perm.History ){ login_needed(); return; }
1608 style_header("Instances of timewarp");
1609 @ <ul>
1610 db_prepare(&q,
1611 "SELECT blob.uuid "
1612 " FROM plink p, plink c, blob"
1613
+12 -12
--- src/tkt.c
+++ src/tkt.c
@@ -89,11 +89,11 @@
8989
**
9090
** Only load those fields which do not already exist as
9191
** variables.
9292
**
9393
** Fields of the TICKET table that begin with "private_" are
94
-** expanded using the db_reveal() function. If g.okRdAddr is
94
+** expanded using the db_reveal() function. If g.perm.RdAddr is
9595
** true, then the db_reveal() function will decode the content
9696
** using the CONCEALED table so that the content legable.
9797
** Otherwise, db_reveal() is a no-op and the content remains
9898
** obscured.
9999
*/
@@ -292,28 +292,28 @@
292292
const char *zScript;
293293
char *zFullName;
294294
const char *zUuid = PD("name","");
295295
296296
login_check_credentials();
297
- if( !g.okRdTkt ){ login_needed(); return; }
298
- if( g.okWrTkt || g.okApndTkt ){
297
+ if( !g.perm.RdTkt ){ login_needed(); return; }
298
+ if( g.perm.WrTkt || g.perm.ApndTkt ){
299299
style_submenu_element("Edit", "Edit The Ticket", "%s/tktedit?name=%T",
300300
g.zTop, PD("name",""));
301301
}
302
- if( g.okHistory ){
302
+ if( g.perm.History ){
303303
style_submenu_element("History", "History Of This Ticket",
304304
"%s/tkthistory/%T", g.zTop, zUuid);
305305
style_submenu_element("Timeline", "Timeline Of This Ticket",
306306
"%s/tkttimeline/%T", g.zTop, zUuid);
307307
style_submenu_element("Check-ins", "Check-ins Of This Ticket",
308308
"%s/tkttimeline/%T?y=ci", g.zTop, zUuid);
309309
}
310
- if( g.okNewTkt ){
310
+ if( g.perm.NewTkt ){
311311
style_submenu_element("New Ticket", "Create a new ticket",
312312
"%s/tktnew", g.zTop);
313313
}
314
- if( g.okApndTkt && g.okAttach ){
314
+ if( g.perm.ApndTkt && g.perm.Attach ){
315315
style_submenu_element("Attach", "Add An Attachment",
316316
"%s/attachadd?tkt=%T&amp;from=%s/tktview/%t",
317317
g.zTop, zUuid, g.zTop, zUuid);
318318
}
319319
style_header("View Ticket");
@@ -345,19 +345,19 @@
345345
@ <hr /><h2>Attachments:</h2>
346346
@ <ul>
347347
}
348348
cnt++;
349349
@ <li>
350
- if( g.okRead && g.okHistory ){
350
+ if( g.perm.Read && g.perm.History ){
351351
@ <a href="%s(g.zTop)/attachview?tkt=%s(zFullName)&amp;file=%t(zFile)">
352352
@ %h(zFile)</a>
353353
}else{
354354
@ %h(zFile)
355355
}
356356
@ added by %h(zUser) on
357357
hyperlink_to_date(zDate, ".");
358
- if( g.okWrTkt && g.okAttach ){
358
+ if( g.perm.WrTkt && g.perm.Attach ){
359359
@ [<a href="%s(g.zTop)/attachdelete?tkt=%s(zFullName)&amp;file=%t(zFile)&amp;from=%s(g.zTop)/tktview%%3fname=%s(zFullName)">delete</a>]
360360
}
361361
@ </li>
362362
}
363363
if( cnt ){
@@ -510,11 +510,11 @@
510510
void tktnew_page(void){
511511
const char *zScript;
512512
char *zNewUuid = 0;
513513
514514
login_check_credentials();
515
- if( !g.okNewTkt ){ login_needed(); return; }
515
+ if( !g.perm.NewTkt ){ login_needed(); return; }
516516
if( P("cancel") ){
517517
cgi_redirect("home");
518518
}
519519
style_header("New Ticket");
520520
if( g.thTrace ) Th_Trace("BEGIN_TKTNEW<br />\n", -1);
@@ -556,11 +556,11 @@
556556
int nName;
557557
const char *zName;
558558
int nRec;
559559
560560
login_check_credentials();
561
- if( !g.okApndTkt && !g.okWrTkt ){ login_needed(); return; }
561
+ if( !g.perm.ApndTkt && !g.perm.WrTkt ){ login_needed(); return; }
562562
zName = P("name");
563563
if( P("cancel") ){
564564
cgi_redirectf("tktview?name=%T", zName);
565565
}
566566
style_header("Edit Ticket");
@@ -651,11 +651,11 @@
651651
int tagid;
652652
char zGlobPattern[50];
653653
const char *zType;
654654
655655
login_check_credentials();
656
- if( !g.okHistory || !g.okRdTkt ){ login_needed(); return; }
656
+ if( !g.perm.History || !g.perm.RdTkt ){ login_needed(); return; }
657657
zUuid = PD("name","");
658658
zType = PD("y","a");
659659
if( zType[0]!='c' ){
660660
style_submenu_element("Check-ins", "Check-ins",
661661
"%s/tkttimeline?name=%T&amp;y=ci", g.zTop, zUuid);
@@ -725,11 +725,11 @@
725725
char *zTitle;
726726
const char *zUuid;
727727
int tagid;
728728
729729
login_check_credentials();
730
- if( !g.okHistory || !g.okRdTkt ){ login_needed(); return; }
730
+ if( !g.perm.History || !g.perm.RdTkt ){ login_needed(); return; }
731731
zUuid = PD("name","");
732732
zTitle = mprintf("History Of Ticket %h", zUuid);
733733
style_submenu_element("Status", "Status",
734734
"%s/info/%s", g.zTop, zUuid);
735735
style_submenu_element("Check-ins", "Check-ins",
736736
--- src/tkt.c
+++ src/tkt.c
@@ -89,11 +89,11 @@
89 **
90 ** Only load those fields which do not already exist as
91 ** variables.
92 **
93 ** Fields of the TICKET table that begin with "private_" are
94 ** expanded using the db_reveal() function. If g.okRdAddr is
95 ** true, then the db_reveal() function will decode the content
96 ** using the CONCEALED table so that the content legable.
97 ** Otherwise, db_reveal() is a no-op and the content remains
98 ** obscured.
99 */
@@ -292,28 +292,28 @@
292 const char *zScript;
293 char *zFullName;
294 const char *zUuid = PD("name","");
295
296 login_check_credentials();
297 if( !g.okRdTkt ){ login_needed(); return; }
298 if( g.okWrTkt || g.okApndTkt ){
299 style_submenu_element("Edit", "Edit The Ticket", "%s/tktedit?name=%T",
300 g.zTop, PD("name",""));
301 }
302 if( g.okHistory ){
303 style_submenu_element("History", "History Of This Ticket",
304 "%s/tkthistory/%T", g.zTop, zUuid);
305 style_submenu_element("Timeline", "Timeline Of This Ticket",
306 "%s/tkttimeline/%T", g.zTop, zUuid);
307 style_submenu_element("Check-ins", "Check-ins Of This Ticket",
308 "%s/tkttimeline/%T?y=ci", g.zTop, zUuid);
309 }
310 if( g.okNewTkt ){
311 style_submenu_element("New Ticket", "Create a new ticket",
312 "%s/tktnew", g.zTop);
313 }
314 if( g.okApndTkt && g.okAttach ){
315 style_submenu_element("Attach", "Add An Attachment",
316 "%s/attachadd?tkt=%T&amp;from=%s/tktview/%t",
317 g.zTop, zUuid, g.zTop, zUuid);
318 }
319 style_header("View Ticket");
@@ -345,19 +345,19 @@
345 @ <hr /><h2>Attachments:</h2>
346 @ <ul>
347 }
348 cnt++;
349 @ <li>
350 if( g.okRead && g.okHistory ){
351 @ <a href="%s(g.zTop)/attachview?tkt=%s(zFullName)&amp;file=%t(zFile)">
352 @ %h(zFile)</a>
353 }else{
354 @ %h(zFile)
355 }
356 @ added by %h(zUser) on
357 hyperlink_to_date(zDate, ".");
358 if( g.okWrTkt && g.okAttach ){
359 @ [<a href="%s(g.zTop)/attachdelete?tkt=%s(zFullName)&amp;file=%t(zFile)&amp;from=%s(g.zTop)/tktview%%3fname=%s(zFullName)">delete</a>]
360 }
361 @ </li>
362 }
363 if( cnt ){
@@ -510,11 +510,11 @@
510 void tktnew_page(void){
511 const char *zScript;
512 char *zNewUuid = 0;
513
514 login_check_credentials();
515 if( !g.okNewTkt ){ login_needed(); return; }
516 if( P("cancel") ){
517 cgi_redirect("home");
518 }
519 style_header("New Ticket");
520 if( g.thTrace ) Th_Trace("BEGIN_TKTNEW<br />\n", -1);
@@ -556,11 +556,11 @@
556 int nName;
557 const char *zName;
558 int nRec;
559
560 login_check_credentials();
561 if( !g.okApndTkt && !g.okWrTkt ){ login_needed(); return; }
562 zName = P("name");
563 if( P("cancel") ){
564 cgi_redirectf("tktview?name=%T", zName);
565 }
566 style_header("Edit Ticket");
@@ -651,11 +651,11 @@
651 int tagid;
652 char zGlobPattern[50];
653 const char *zType;
654
655 login_check_credentials();
656 if( !g.okHistory || !g.okRdTkt ){ login_needed(); return; }
657 zUuid = PD("name","");
658 zType = PD("y","a");
659 if( zType[0]!='c' ){
660 style_submenu_element("Check-ins", "Check-ins",
661 "%s/tkttimeline?name=%T&amp;y=ci", g.zTop, zUuid);
@@ -725,11 +725,11 @@
725 char *zTitle;
726 const char *zUuid;
727 int tagid;
728
729 login_check_credentials();
730 if( !g.okHistory || !g.okRdTkt ){ login_needed(); return; }
731 zUuid = PD("name","");
732 zTitle = mprintf("History Of Ticket %h", zUuid);
733 style_submenu_element("Status", "Status",
734 "%s/info/%s", g.zTop, zUuid);
735 style_submenu_element("Check-ins", "Check-ins",
736
--- src/tkt.c
+++ src/tkt.c
@@ -89,11 +89,11 @@
89 **
90 ** Only load those fields which do not already exist as
91 ** variables.
92 **
93 ** Fields of the TICKET table that begin with "private_" are
94 ** expanded using the db_reveal() function. If g.perm.RdAddr is
95 ** true, then the db_reveal() function will decode the content
96 ** using the CONCEALED table so that the content legable.
97 ** Otherwise, db_reveal() is a no-op and the content remains
98 ** obscured.
99 */
@@ -292,28 +292,28 @@
292 const char *zScript;
293 char *zFullName;
294 const char *zUuid = PD("name","");
295
296 login_check_credentials();
297 if( !g.perm.RdTkt ){ login_needed(); return; }
298 if( g.perm.WrTkt || g.perm.ApndTkt ){
299 style_submenu_element("Edit", "Edit The Ticket", "%s/tktedit?name=%T",
300 g.zTop, PD("name",""));
301 }
302 if( g.perm.History ){
303 style_submenu_element("History", "History Of This Ticket",
304 "%s/tkthistory/%T", g.zTop, zUuid);
305 style_submenu_element("Timeline", "Timeline Of This Ticket",
306 "%s/tkttimeline/%T", g.zTop, zUuid);
307 style_submenu_element("Check-ins", "Check-ins Of This Ticket",
308 "%s/tkttimeline/%T?y=ci", g.zTop, zUuid);
309 }
310 if( g.perm.NewTkt ){
311 style_submenu_element("New Ticket", "Create a new ticket",
312 "%s/tktnew", g.zTop);
313 }
314 if( g.perm.ApndTkt && g.perm.Attach ){
315 style_submenu_element("Attach", "Add An Attachment",
316 "%s/attachadd?tkt=%T&amp;from=%s/tktview/%t",
317 g.zTop, zUuid, g.zTop, zUuid);
318 }
319 style_header("View Ticket");
@@ -345,19 +345,19 @@
345 @ <hr /><h2>Attachments:</h2>
346 @ <ul>
347 }
348 cnt++;
349 @ <li>
350 if( g.perm.Read && g.perm.History ){
351 @ <a href="%s(g.zTop)/attachview?tkt=%s(zFullName)&amp;file=%t(zFile)">
352 @ %h(zFile)</a>
353 }else{
354 @ %h(zFile)
355 }
356 @ added by %h(zUser) on
357 hyperlink_to_date(zDate, ".");
358 if( g.perm.WrTkt && g.perm.Attach ){
359 @ [<a href="%s(g.zTop)/attachdelete?tkt=%s(zFullName)&amp;file=%t(zFile)&amp;from=%s(g.zTop)/tktview%%3fname=%s(zFullName)">delete</a>]
360 }
361 @ </li>
362 }
363 if( cnt ){
@@ -510,11 +510,11 @@
510 void tktnew_page(void){
511 const char *zScript;
512 char *zNewUuid = 0;
513
514 login_check_credentials();
515 if( !g.perm.NewTkt ){ login_needed(); return; }
516 if( P("cancel") ){
517 cgi_redirect("home");
518 }
519 style_header("New Ticket");
520 if( g.thTrace ) Th_Trace("BEGIN_TKTNEW<br />\n", -1);
@@ -556,11 +556,11 @@
556 int nName;
557 const char *zName;
558 int nRec;
559
560 login_check_credentials();
561 if( !g.perm.ApndTkt && !g.perm.WrTkt ){ login_needed(); return; }
562 zName = P("name");
563 if( P("cancel") ){
564 cgi_redirectf("tktview?name=%T", zName);
565 }
566 style_header("Edit Ticket");
@@ -651,11 +651,11 @@
651 int tagid;
652 char zGlobPattern[50];
653 const char *zType;
654
655 login_check_credentials();
656 if( !g.perm.History || !g.perm.RdTkt ){ login_needed(); return; }
657 zUuid = PD("name","");
658 zType = PD("y","a");
659 if( zType[0]!='c' ){
660 style_submenu_element("Check-ins", "Check-ins",
661 "%s/tkttimeline?name=%T&amp;y=ci", g.zTop, zUuid);
@@ -725,11 +725,11 @@
725 char *zTitle;
726 const char *zUuid;
727 int tagid;
728
729 login_check_credentials();
730 if( !g.perm.History || !g.perm.RdTkt ){ login_needed(); return; }
731 zUuid = PD("name","");
732 zTitle = mprintf("History Of Ticket %h", zUuid);
733 style_submenu_element("Status", "Status",
734 "%s/info/%s", g.zTop, zUuid);
735 style_submenu_element("Check-ins", "Check-ins",
736
+3 -3
--- src/tktsetup.c
+++ src/tktsetup.c
@@ -26,11 +26,11 @@
2626
** Main sub-menu for configuring the ticketing system.
2727
** WEBPAGE: tktsetup
2828
*/
2929
void tktsetup_page(void){
3030
login_check_credentials();
31
- if( !g.okSetup ){
31
+ if( !g.perm.Setup ){
3232
login_needed();
3333
}
3434
3535
style_header("Ticket Setup");
3636
@ <table border="0" cellspacing="20">
@@ -102,11 +102,11 @@
102102
){
103103
const char *z;
104104
int isSubmit;
105105
106106
login_check_credentials();
107
- if( !g.okSetup ){
107
+ if( !g.perm.Setup ){
108108
login_needed();
109109
}
110110
if( P("setup") ){
111111
cgi_redirect("tktsetup");
112112
}
@@ -690,11 +690,11 @@
690690
/*
691691
** WEBPAGE: tktsetup_timeline
692692
*/
693693
void tktsetup_timeline_page(void){
694694
login_check_credentials();
695
- if( !g.okSetup ){
695
+ if( !g.perm.Setup ){
696696
login_needed();
697697
}
698698
699699
if( P("setup") ){
700700
cgi_redirect("tktsetup");
701701
--- src/tktsetup.c
+++ src/tktsetup.c
@@ -26,11 +26,11 @@
26 ** Main sub-menu for configuring the ticketing system.
27 ** WEBPAGE: tktsetup
28 */
29 void tktsetup_page(void){
30 login_check_credentials();
31 if( !g.okSetup ){
32 login_needed();
33 }
34
35 style_header("Ticket Setup");
36 @ <table border="0" cellspacing="20">
@@ -102,11 +102,11 @@
102 ){
103 const char *z;
104 int isSubmit;
105
106 login_check_credentials();
107 if( !g.okSetup ){
108 login_needed();
109 }
110 if( P("setup") ){
111 cgi_redirect("tktsetup");
112 }
@@ -690,11 +690,11 @@
690 /*
691 ** WEBPAGE: tktsetup_timeline
692 */
693 void tktsetup_timeline_page(void){
694 login_check_credentials();
695 if( !g.okSetup ){
696 login_needed();
697 }
698
699 if( P("setup") ){
700 cgi_redirect("tktsetup");
701
--- src/tktsetup.c
+++ src/tktsetup.c
@@ -26,11 +26,11 @@
26 ** Main sub-menu for configuring the ticketing system.
27 ** WEBPAGE: tktsetup
28 */
29 void tktsetup_page(void){
30 login_check_credentials();
31 if( !g.perm.Setup ){
32 login_needed();
33 }
34
35 style_header("Ticket Setup");
36 @ <table border="0" cellspacing="20">
@@ -102,11 +102,11 @@
102 ){
103 const char *z;
104 int isSubmit;
105
106 login_check_credentials();
107 if( !g.perm.Setup ){
108 login_needed();
109 }
110 if( P("setup") ){
111 cgi_redirect("tktsetup");
112 }
@@ -690,11 +690,11 @@
690 /*
691 ** WEBPAGE: tktsetup_timeline
692 */
693 void tktsetup_timeline_page(void){
694 login_check_credentials();
695 if( !g.perm.Setup ){
696 login_needed();
697 }
698
699 if( P("setup") ){
700 cgi_redirect("tktsetup");
701
+1 -1
--- src/user.c
+++ src/user.c
@@ -393,11 +393,11 @@
393393
Stmt q;
394394
int cnt = 0;
395395
int rc;
396396
397397
login_check_credentials();
398
- if( !g.okAdmin ){ login_needed(); return; }
398
+ if( !g.perm.Admin ){ login_needed(); return; }
399399
create_accesslog_table();
400400
401401
if( P("delall") && P("delallbtn") ){
402402
db_multi_exec("DELETE FROM accesslog");
403403
cgi_redirectf("%s/access_log?y=%d&n=%d&o=%o", g.zTop, y, n, skip);
404404
--- src/user.c
+++ src/user.c
@@ -393,11 +393,11 @@
393 Stmt q;
394 int cnt = 0;
395 int rc;
396
397 login_check_credentials();
398 if( !g.okAdmin ){ login_needed(); return; }
399 create_accesslog_table();
400
401 if( P("delall") && P("delallbtn") ){
402 db_multi_exec("DELETE FROM accesslog");
403 cgi_redirectf("%s/access_log?y=%d&n=%d&o=%o", g.zTop, y, n, skip);
404
--- src/user.c
+++ src/user.c
@@ -393,11 +393,11 @@
393 Stmt q;
394 int cnt = 0;
395 int rc;
396
397 login_check_credentials();
398 if( !g.perm.Admin ){ login_needed(); return; }
399 create_accesslog_table();
400
401 if( P("delall") && P("delallbtn") ){
402 db_multi_exec("DELETE FROM accesslog");
403 cgi_redirectf("%s/access_log?y=%d&n=%d&o=%o", g.zTop, y, n, skip);
404
+18 -18
--- src/wiki.c
+++ src/wiki.c
@@ -90,11 +90,11 @@
9090
if( fossil_strcmp(zIndexPage, zPathInfo)==0 ) zIndexPage = 0;
9191
}
9292
if( zIndexPage ){
9393
cgi_redirectf("%s/%s", g.zTop, zIndexPage);
9494
}
95
- if( !g.okRdWiki ){
95
+ if( !g.perm.RdWiki ){
9696
cgi_redirectf("%s/login?g=%s/home", g.zTop, g.zTop);
9797
}
9898
if( zPageName ){
9999
login_check_credentials();
100100
g.zExtra = zPageName;
@@ -135,11 +135,11 @@
135135
char *zBody = mprintf("%s","<i>Empty Page</i>");
136136
Stmt q;
137137
int cnt = 0;
138138
139139
login_check_credentials();
140
- if( !g.okRdWiki ){ login_needed(); return; }
140
+ if( !g.perm.RdWiki ){ login_needed(); return; }
141141
zPageName = P("name");
142142
if( zPageName==0 ){
143143
style_header("Wiki");
144144
@ <ul>
145145
{ char *zHomePageName = db_get("project-name",0);
@@ -152,13 +152,13 @@
152152
@ pages. </li>
153153
@ <li> <a href="%s(g.zTop)/wiki_rules">Formatting rules</a> for
154154
@ wiki.</li>
155155
@ <li> Use the <a href="%s(g.zTop)/wiki?name=Sandbox">Sandbox</a>
156156
@ to experiment.</li>
157
- if( g.okNewWiki ){
157
+ if( g.perm.NewWiki ){
158158
@ <li> Create a <a href="%s(g.zTop)/wikinew">new wiki page</a>.</li>
159
- if( g.okWrite ){
159
+ if( g.perm.Write ){
160160
@ <li> Create a <a href="%s(g.zTop)/eventedit">new event</a>.</li>
161161
}
162162
}
163163
@ <li> <a href="%s(g.zTop)/wcontent">List of All Wiki Pages</a>
164164
@ available on this server.</li>
@@ -186,24 +186,24 @@
186186
if( pWiki ){
187187
zBody = pWiki->zWiki;
188188
}
189189
}
190190
if( !g.isHome ){
191
- if( (rid && g.okWrWiki) || (!rid && g.okNewWiki) ){
191
+ if( (rid && g.perm.WrWiki) || (!rid && g.perm.NewWiki) ){
192192
style_submenu_element("Edit", "Edit Wiki Page", "%s/wikiedit?name=%T",
193193
g.zTop, zPageName);
194194
}
195
- if( rid && g.okApndWiki && g.okAttach ){
195
+ if( rid && g.perm.ApndWiki && g.perm.Attach ){
196196
style_submenu_element("Attach", "Add An Attachment",
197197
"%s/attachadd?page=%T&amp;from=%s/wiki%%3fname=%T",
198198
g.zTop, zPageName, g.zTop, zPageName);
199199
}
200
- if( rid && g.okApndWiki ){
200
+ if( rid && g.perm.ApndWiki ){
201201
style_submenu_element("Append", "Add A Comment", "%s/wikiappend?name=%T",
202202
g.zTop, zPageName);
203203
}
204
- if( g.okHistory ){
204
+ if( g.perm.History ){
205205
style_submenu_element("History", "History", "%s/whistory?name=%T",
206206
g.zTop, zPageName);
207207
}
208208
}
209209
style_header(zPageName);
@@ -225,19 +225,19 @@
225225
@ <hr /><h2>Attachments:</h2>
226226
@ <ul>
227227
}
228228
cnt++;
229229
@ <li>
230
- if( g.okHistory && g.okRead ){
230
+ if( g.perm.History && g.perm.Read ){
231231
@ <a href="%s(g.zTop)/attachview?page=%s(zPageName)&amp;file=%t(zFile)">
232232
@ %h(zFile)</a>
233233
}else{
234234
@ <li>%h(zFile)
235235
}
236236
@ added by %h(zUser) on
237237
hyperlink_to_date(zDate, ".");
238
- if( g.okWrWiki && g.okAttach ){
238
+ if( g.perm.WrWiki && g.perm.Attach ){
239239
@ [<a href="%s(g.zTop)/attachdelete?page=%s(zPageName)&amp;file=%t(zFile)&amp;from=%s(g.zTop)/wiki%%3fname=%s(zPageName)">delete</a>]
240240
}
241241
@ </li>
242242
}
243243
if( cnt ){
@@ -271,11 +271,11 @@
271271
login_check_credentials();
272272
zPageName = PD("name","");
273273
if( check_name(zPageName) ) return;
274274
isSandbox = is_sandbox(zPageName);
275275
if( isSandbox ){
276
- if( !g.okWrWiki ){
276
+ if( !g.perm.WrWiki ){
277277
login_needed();
278278
return;
279279
}
280280
if( zBody==0 ){
281281
zBody = db_get("sandbox","");
@@ -286,11 +286,11 @@
286286
"SELECT rid FROM tagxref"
287287
" WHERE tagid=(SELECT tagid FROM tag WHERE tagname=%Q)"
288288
" ORDER BY mtime DESC", zTag
289289
);
290290
free(zTag);
291
- if( (rid && !g.okWrWiki) || (!rid && !g.okNewWiki) ){
291
+ if( (rid && !g.perm.WrWiki) || (!rid && !g.perm.NewWiki) ){
292292
login_needed();
293293
return;
294294
}
295295
if( zBody==0 && (pWiki = manifest_get(rid, CFTYPE_WIKI))!=0 ){
296296
zBody = pWiki->zWiki;
@@ -375,11 +375,11 @@
375375
** to the wikiedit screen for that new page.
376376
*/
377377
void wikinew_page(void){
378378
const char *zName;
379379
login_check_credentials();
380
- if( !g.okNewWiki ){
380
+ if( !g.perm.NewWiki ){
381381
login_needed();
382382
return;
383383
}
384384
zName = PD("name","");
385385
if( zName[0] && wiki_name_is_wellformed((const unsigned char *)zName) ){
@@ -450,11 +450,11 @@
450450
if( !rid ){
451451
fossil_redirect_home();
452452
return;
453453
}
454454
}
455
- if( !g.okApndWiki ){
455
+ if( !g.perm.ApndWiki ){
456456
login_needed();
457457
return;
458458
}
459459
if( P("submit")!=0 && P("r")!=0 && P("u")!=0 ){
460460
char *zDate;
@@ -560,11 +560,11 @@
560560
Stmt q;
561561
char *zTitle;
562562
char *zSQL;
563563
const char *zPageName;
564564
login_check_credentials();
565
- if( !g.okHistory ){ login_needed(); return; }
565
+ if( !g.perm.History ){ login_needed(); return; }
566566
zPageName = PD("name","");
567567
zTitle = mprintf("History Of %s", zPageName);
568568
style_header(zTitle);
569569
free(zTitle);
570570
@@ -596,11 +596,11 @@
596596
Manifest *pW1, *pW2 = 0;
597597
Blob w1, w2, d;
598598
599599
login_check_credentials();
600600
rid1 = atoi(PD("a","0"));
601
- if( !g.okHistory ){ login_needed(); return; }
601
+ if( !g.perm.History ){ login_needed(); return; }
602602
if( rid1==0 ) fossil_redirect_home();
603603
rid2 = atoi(PD("b","0"));
604604
zPageName = PD("name","");
605605
zTitle = mprintf("Changes To %s", zPageName);
606606
style_header(zTitle);
@@ -642,11 +642,11 @@
642642
void wcontent_page(void){
643643
Stmt q;
644644
int showAll = P("all")!=0;
645645
646646
login_check_credentials();
647
- if( !g.okRdWiki ){ login_needed(); return; }
647
+ if( !g.perm.RdWiki ){ login_needed(); return; }
648648
style_header("Available Wiki Pages");
649649
if( showAll ){
650650
style_submenu_element("Active", "Only Active Pages", "%s/wcontent", g.zTop);
651651
}else{
652652
style_submenu_element("All", "All", "%s/wcontent?all=1", g.zTop);
@@ -681,11 +681,11 @@
681681
*/
682682
void wfind_page(void){
683683
Stmt q;
684684
const char * zTitle;
685685
login_check_credentials();
686
- if( !g.okRdWiki ){ login_needed(); return; }
686
+ if( !g.perm.RdWiki ){ login_needed(); return; }
687687
zTitle = PD("title","*");
688688
style_header("Wiki Pages Found");
689689
@ <ul>
690690
db_prepare(&q,
691691
"SELECT substr(tagname, 6, 1000) FROM tag WHERE tagname like 'wiki-%%%q%%'"
692692
--- src/wiki.c
+++ src/wiki.c
@@ -90,11 +90,11 @@
90 if( fossil_strcmp(zIndexPage, zPathInfo)==0 ) zIndexPage = 0;
91 }
92 if( zIndexPage ){
93 cgi_redirectf("%s/%s", g.zTop, zIndexPage);
94 }
95 if( !g.okRdWiki ){
96 cgi_redirectf("%s/login?g=%s/home", g.zTop, g.zTop);
97 }
98 if( zPageName ){
99 login_check_credentials();
100 g.zExtra = zPageName;
@@ -135,11 +135,11 @@
135 char *zBody = mprintf("%s","<i>Empty Page</i>");
136 Stmt q;
137 int cnt = 0;
138
139 login_check_credentials();
140 if( !g.okRdWiki ){ login_needed(); return; }
141 zPageName = P("name");
142 if( zPageName==0 ){
143 style_header("Wiki");
144 @ <ul>
145 { char *zHomePageName = db_get("project-name",0);
@@ -152,13 +152,13 @@
152 @ pages. </li>
153 @ <li> <a href="%s(g.zTop)/wiki_rules">Formatting rules</a> for
154 @ wiki.</li>
155 @ <li> Use the <a href="%s(g.zTop)/wiki?name=Sandbox">Sandbox</a>
156 @ to experiment.</li>
157 if( g.okNewWiki ){
158 @ <li> Create a <a href="%s(g.zTop)/wikinew">new wiki page</a>.</li>
159 if( g.okWrite ){
160 @ <li> Create a <a href="%s(g.zTop)/eventedit">new event</a>.</li>
161 }
162 }
163 @ <li> <a href="%s(g.zTop)/wcontent">List of All Wiki Pages</a>
164 @ available on this server.</li>
@@ -186,24 +186,24 @@
186 if( pWiki ){
187 zBody = pWiki->zWiki;
188 }
189 }
190 if( !g.isHome ){
191 if( (rid && g.okWrWiki) || (!rid && g.okNewWiki) ){
192 style_submenu_element("Edit", "Edit Wiki Page", "%s/wikiedit?name=%T",
193 g.zTop, zPageName);
194 }
195 if( rid && g.okApndWiki && g.okAttach ){
196 style_submenu_element("Attach", "Add An Attachment",
197 "%s/attachadd?page=%T&amp;from=%s/wiki%%3fname=%T",
198 g.zTop, zPageName, g.zTop, zPageName);
199 }
200 if( rid && g.okApndWiki ){
201 style_submenu_element("Append", "Add A Comment", "%s/wikiappend?name=%T",
202 g.zTop, zPageName);
203 }
204 if( g.okHistory ){
205 style_submenu_element("History", "History", "%s/whistory?name=%T",
206 g.zTop, zPageName);
207 }
208 }
209 style_header(zPageName);
@@ -225,19 +225,19 @@
225 @ <hr /><h2>Attachments:</h2>
226 @ <ul>
227 }
228 cnt++;
229 @ <li>
230 if( g.okHistory && g.okRead ){
231 @ <a href="%s(g.zTop)/attachview?page=%s(zPageName)&amp;file=%t(zFile)">
232 @ %h(zFile)</a>
233 }else{
234 @ <li>%h(zFile)
235 }
236 @ added by %h(zUser) on
237 hyperlink_to_date(zDate, ".");
238 if( g.okWrWiki && g.okAttach ){
239 @ [<a href="%s(g.zTop)/attachdelete?page=%s(zPageName)&amp;file=%t(zFile)&amp;from=%s(g.zTop)/wiki%%3fname=%s(zPageName)">delete</a>]
240 }
241 @ </li>
242 }
243 if( cnt ){
@@ -271,11 +271,11 @@
271 login_check_credentials();
272 zPageName = PD("name","");
273 if( check_name(zPageName) ) return;
274 isSandbox = is_sandbox(zPageName);
275 if( isSandbox ){
276 if( !g.okWrWiki ){
277 login_needed();
278 return;
279 }
280 if( zBody==0 ){
281 zBody = db_get("sandbox","");
@@ -286,11 +286,11 @@
286 "SELECT rid FROM tagxref"
287 " WHERE tagid=(SELECT tagid FROM tag WHERE tagname=%Q)"
288 " ORDER BY mtime DESC", zTag
289 );
290 free(zTag);
291 if( (rid && !g.okWrWiki) || (!rid && !g.okNewWiki) ){
292 login_needed();
293 return;
294 }
295 if( zBody==0 && (pWiki = manifest_get(rid, CFTYPE_WIKI))!=0 ){
296 zBody = pWiki->zWiki;
@@ -375,11 +375,11 @@
375 ** to the wikiedit screen for that new page.
376 */
377 void wikinew_page(void){
378 const char *zName;
379 login_check_credentials();
380 if( !g.okNewWiki ){
381 login_needed();
382 return;
383 }
384 zName = PD("name","");
385 if( zName[0] && wiki_name_is_wellformed((const unsigned char *)zName) ){
@@ -450,11 +450,11 @@
450 if( !rid ){
451 fossil_redirect_home();
452 return;
453 }
454 }
455 if( !g.okApndWiki ){
456 login_needed();
457 return;
458 }
459 if( P("submit")!=0 && P("r")!=0 && P("u")!=0 ){
460 char *zDate;
@@ -560,11 +560,11 @@
560 Stmt q;
561 char *zTitle;
562 char *zSQL;
563 const char *zPageName;
564 login_check_credentials();
565 if( !g.okHistory ){ login_needed(); return; }
566 zPageName = PD("name","");
567 zTitle = mprintf("History Of %s", zPageName);
568 style_header(zTitle);
569 free(zTitle);
570
@@ -596,11 +596,11 @@
596 Manifest *pW1, *pW2 = 0;
597 Blob w1, w2, d;
598
599 login_check_credentials();
600 rid1 = atoi(PD("a","0"));
601 if( !g.okHistory ){ login_needed(); return; }
602 if( rid1==0 ) fossil_redirect_home();
603 rid2 = atoi(PD("b","0"));
604 zPageName = PD("name","");
605 zTitle = mprintf("Changes To %s", zPageName);
606 style_header(zTitle);
@@ -642,11 +642,11 @@
642 void wcontent_page(void){
643 Stmt q;
644 int showAll = P("all")!=0;
645
646 login_check_credentials();
647 if( !g.okRdWiki ){ login_needed(); return; }
648 style_header("Available Wiki Pages");
649 if( showAll ){
650 style_submenu_element("Active", "Only Active Pages", "%s/wcontent", g.zTop);
651 }else{
652 style_submenu_element("All", "All", "%s/wcontent?all=1", g.zTop);
@@ -681,11 +681,11 @@
681 */
682 void wfind_page(void){
683 Stmt q;
684 const char * zTitle;
685 login_check_credentials();
686 if( !g.okRdWiki ){ login_needed(); return; }
687 zTitle = PD("title","*");
688 style_header("Wiki Pages Found");
689 @ <ul>
690 db_prepare(&q,
691 "SELECT substr(tagname, 6, 1000) FROM tag WHERE tagname like 'wiki-%%%q%%'"
692
--- src/wiki.c
+++ src/wiki.c
@@ -90,11 +90,11 @@
90 if( fossil_strcmp(zIndexPage, zPathInfo)==0 ) zIndexPage = 0;
91 }
92 if( zIndexPage ){
93 cgi_redirectf("%s/%s", g.zTop, zIndexPage);
94 }
95 if( !g.perm.RdWiki ){
96 cgi_redirectf("%s/login?g=%s/home", g.zTop, g.zTop);
97 }
98 if( zPageName ){
99 login_check_credentials();
100 g.zExtra = zPageName;
@@ -135,11 +135,11 @@
135 char *zBody = mprintf("%s","<i>Empty Page</i>");
136 Stmt q;
137 int cnt = 0;
138
139 login_check_credentials();
140 if( !g.perm.RdWiki ){ login_needed(); return; }
141 zPageName = P("name");
142 if( zPageName==0 ){
143 style_header("Wiki");
144 @ <ul>
145 { char *zHomePageName = db_get("project-name",0);
@@ -152,13 +152,13 @@
152 @ pages. </li>
153 @ <li> <a href="%s(g.zTop)/wiki_rules">Formatting rules</a> for
154 @ wiki.</li>
155 @ <li> Use the <a href="%s(g.zTop)/wiki?name=Sandbox">Sandbox</a>
156 @ to experiment.</li>
157 if( g.perm.NewWiki ){
158 @ <li> Create a <a href="%s(g.zTop)/wikinew">new wiki page</a>.</li>
159 if( g.perm.Write ){
160 @ <li> Create a <a href="%s(g.zTop)/eventedit">new event</a>.</li>
161 }
162 }
163 @ <li> <a href="%s(g.zTop)/wcontent">List of All Wiki Pages</a>
164 @ available on this server.</li>
@@ -186,24 +186,24 @@
186 if( pWiki ){
187 zBody = pWiki->zWiki;
188 }
189 }
190 if( !g.isHome ){
191 if( (rid && g.perm.WrWiki) || (!rid && g.perm.NewWiki) ){
192 style_submenu_element("Edit", "Edit Wiki Page", "%s/wikiedit?name=%T",
193 g.zTop, zPageName);
194 }
195 if( rid && g.perm.ApndWiki && g.perm.Attach ){
196 style_submenu_element("Attach", "Add An Attachment",
197 "%s/attachadd?page=%T&amp;from=%s/wiki%%3fname=%T",
198 g.zTop, zPageName, g.zTop, zPageName);
199 }
200 if( rid && g.perm.ApndWiki ){
201 style_submenu_element("Append", "Add A Comment", "%s/wikiappend?name=%T",
202 g.zTop, zPageName);
203 }
204 if( g.perm.History ){
205 style_submenu_element("History", "History", "%s/whistory?name=%T",
206 g.zTop, zPageName);
207 }
208 }
209 style_header(zPageName);
@@ -225,19 +225,19 @@
225 @ <hr /><h2>Attachments:</h2>
226 @ <ul>
227 }
228 cnt++;
229 @ <li>
230 if( g.perm.History && g.perm.Read ){
231 @ <a href="%s(g.zTop)/attachview?page=%s(zPageName)&amp;file=%t(zFile)">
232 @ %h(zFile)</a>
233 }else{
234 @ <li>%h(zFile)
235 }
236 @ added by %h(zUser) on
237 hyperlink_to_date(zDate, ".");
238 if( g.perm.WrWiki && g.perm.Attach ){
239 @ [<a href="%s(g.zTop)/attachdelete?page=%s(zPageName)&amp;file=%t(zFile)&amp;from=%s(g.zTop)/wiki%%3fname=%s(zPageName)">delete</a>]
240 }
241 @ </li>
242 }
243 if( cnt ){
@@ -271,11 +271,11 @@
271 login_check_credentials();
272 zPageName = PD("name","");
273 if( check_name(zPageName) ) return;
274 isSandbox = is_sandbox(zPageName);
275 if( isSandbox ){
276 if( !g.perm.WrWiki ){
277 login_needed();
278 return;
279 }
280 if( zBody==0 ){
281 zBody = db_get("sandbox","");
@@ -286,11 +286,11 @@
286 "SELECT rid FROM tagxref"
287 " WHERE tagid=(SELECT tagid FROM tag WHERE tagname=%Q)"
288 " ORDER BY mtime DESC", zTag
289 );
290 free(zTag);
291 if( (rid && !g.perm.WrWiki) || (!rid && !g.perm.NewWiki) ){
292 login_needed();
293 return;
294 }
295 if( zBody==0 && (pWiki = manifest_get(rid, CFTYPE_WIKI))!=0 ){
296 zBody = pWiki->zWiki;
@@ -375,11 +375,11 @@
375 ** to the wikiedit screen for that new page.
376 */
377 void wikinew_page(void){
378 const char *zName;
379 login_check_credentials();
380 if( !g.perm.NewWiki ){
381 login_needed();
382 return;
383 }
384 zName = PD("name","");
385 if( zName[0] && wiki_name_is_wellformed((const unsigned char *)zName) ){
@@ -450,11 +450,11 @@
450 if( !rid ){
451 fossil_redirect_home();
452 return;
453 }
454 }
455 if( !g.perm.ApndWiki ){
456 login_needed();
457 return;
458 }
459 if( P("submit")!=0 && P("r")!=0 && P("u")!=0 ){
460 char *zDate;
@@ -560,11 +560,11 @@
560 Stmt q;
561 char *zTitle;
562 char *zSQL;
563 const char *zPageName;
564 login_check_credentials();
565 if( !g.perm.History ){ login_needed(); return; }
566 zPageName = PD("name","");
567 zTitle = mprintf("History Of %s", zPageName);
568 style_header(zTitle);
569 free(zTitle);
570
@@ -596,11 +596,11 @@
596 Manifest *pW1, *pW2 = 0;
597 Blob w1, w2, d;
598
599 login_check_credentials();
600 rid1 = atoi(PD("a","0"));
601 if( !g.perm.History ){ login_needed(); return; }
602 if( rid1==0 ) fossil_redirect_home();
603 rid2 = atoi(PD("b","0"));
604 zPageName = PD("name","");
605 zTitle = mprintf("Changes To %s", zPageName);
606 style_header(zTitle);
@@ -642,11 +642,11 @@
642 void wcontent_page(void){
643 Stmt q;
644 int showAll = P("all")!=0;
645
646 login_check_credentials();
647 if( !g.perm.RdWiki ){ login_needed(); return; }
648 style_header("Available Wiki Pages");
649 if( showAll ){
650 style_submenu_element("Active", "Only Active Pages", "%s/wcontent", g.zTop);
651 }else{
652 style_submenu_element("All", "All", "%s/wcontent?all=1", g.zTop);
@@ -681,11 +681,11 @@
681 */
682 void wfind_page(void){
683 Stmt q;
684 const char * zTitle;
685 login_check_credentials();
686 if( !g.perm.RdWiki ){ login_needed(); return; }
687 zTitle = PD("title","*");
688 style_header("Wiki Pages Found");
689 @ <ul>
690 db_prepare(&q,
691 "SELECT substr(tagname, 6, 1000) FROM tag WHERE tagname like 'wiki-%%%q%%'"
692
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -1043,17 +1043,17 @@
10431043
|| strncmp(zTarget, "mailto:", 7)==0
10441044
){
10451045
blob_appendf(p->pOut, "<a href=\"%s\">", zTarget);
10461046
/* zTerm = "&#x27FE;</a>"; // doesn't work on windows */
10471047
}else if( zTarget[0]=='/' ){
1048
- if( 1 /* g.okHistory */ ){
1048
+ if( 1 /* g.perm.History */ ){
10491049
blob_appendf(p->pOut, "<a href=\"%s%h\">", g.zTop, zTarget);
10501050
}else{
10511051
zTerm = "";
10521052
}
10531053
}else if( zTarget[0]=='.' || zTarget[0]=='#' ){
1054
- if( 1 /* g.okHistory */ ){
1054
+ if( 1 /* g.perm.History */ ){
10551055
blob_appendf(p->pOut, "<a href=\"%h\">", zTarget);
10561056
}else{
10571057
zTerm = "";
10581058
}
10591059
}else if( is_valid_uuid(zTarget) ){
@@ -1061,11 +1061,11 @@
10611061
if( is_ticket(zTarget, &isClosed) ){
10621062
/* Special display processing for tickets. Display the hyperlink
10631063
** as crossed out if the ticket is closed.
10641064
*/
10651065
if( isClosed ){
1066
- if( g.okHistory ){
1066
+ if( g.perm.History ){
10671067
blob_appendf(p->pOut,
10681068
"<a href=\"%s/info/%s\"><span class=\"wikiTagCancelled\">[",
10691069
g.zTop, zTarget
10701070
);
10711071
zTerm = "]</span></a>";
@@ -1072,11 +1072,11 @@
10721072
}else{
10731073
blob_appendf(p->pOut,"<span class=\"wikiTagCancelled\">[");
10741074
zTerm = "]</span>";
10751075
}
10761076
}else{
1077
- if( g.okHistory ){
1077
+ if( g.perm.History ){
10781078
blob_appendf(p->pOut,"<a href=\"%s/info/%s\">[",
10791079
g.zTop, zTarget
10801080
);
10811081
zTerm = "]</a>";
10821082
}else{
@@ -1085,11 +1085,11 @@
10851085
}
10861086
}
10871087
}else if( !in_this_repo(zTarget) ){
10881088
blob_appendf(p->pOut, "<span class=\"brokenlink\">[", zTarget);
10891089
zTerm = "]</span>";
1090
- }else if( g.okHistory ){
1090
+ }else if( g.perm.History ){
10911091
blob_appendf(p->pOut, "<a href=\"%s/info/%s\">[", g.zTop, zTarget);
10921092
zTerm = "]</a>";
10931093
}
10941094
}else if( strlen(zTarget)>=10 && fossil_isdigit(zTarget[0]) && zTarget[4]=='-'
10951095
&& db_int(0, "SELECT datetime(%Q) NOT NULL", zTarget) ){
10961096
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -1043,17 +1043,17 @@
1043 || strncmp(zTarget, "mailto:", 7)==0
1044 ){
1045 blob_appendf(p->pOut, "<a href=\"%s\">", zTarget);
1046 /* zTerm = "&#x27FE;</a>"; // doesn't work on windows */
1047 }else if( zTarget[0]=='/' ){
1048 if( 1 /* g.okHistory */ ){
1049 blob_appendf(p->pOut, "<a href=\"%s%h\">", g.zTop, zTarget);
1050 }else{
1051 zTerm = "";
1052 }
1053 }else if( zTarget[0]=='.' || zTarget[0]=='#' ){
1054 if( 1 /* g.okHistory */ ){
1055 blob_appendf(p->pOut, "<a href=\"%h\">", zTarget);
1056 }else{
1057 zTerm = "";
1058 }
1059 }else if( is_valid_uuid(zTarget) ){
@@ -1061,11 +1061,11 @@
1061 if( is_ticket(zTarget, &isClosed) ){
1062 /* Special display processing for tickets. Display the hyperlink
1063 ** as crossed out if the ticket is closed.
1064 */
1065 if( isClosed ){
1066 if( g.okHistory ){
1067 blob_appendf(p->pOut,
1068 "<a href=\"%s/info/%s\"><span class=\"wikiTagCancelled\">[",
1069 g.zTop, zTarget
1070 );
1071 zTerm = "]</span></a>";
@@ -1072,11 +1072,11 @@
1072 }else{
1073 blob_appendf(p->pOut,"<span class=\"wikiTagCancelled\">[");
1074 zTerm = "]</span>";
1075 }
1076 }else{
1077 if( g.okHistory ){
1078 blob_appendf(p->pOut,"<a href=\"%s/info/%s\">[",
1079 g.zTop, zTarget
1080 );
1081 zTerm = "]</a>";
1082 }else{
@@ -1085,11 +1085,11 @@
1085 }
1086 }
1087 }else if( !in_this_repo(zTarget) ){
1088 blob_appendf(p->pOut, "<span class=\"brokenlink\">[", zTarget);
1089 zTerm = "]</span>";
1090 }else if( g.okHistory ){
1091 blob_appendf(p->pOut, "<a href=\"%s/info/%s\">[", g.zTop, zTarget);
1092 zTerm = "]</a>";
1093 }
1094 }else if( strlen(zTarget)>=10 && fossil_isdigit(zTarget[0]) && zTarget[4]=='-'
1095 && db_int(0, "SELECT datetime(%Q) NOT NULL", zTarget) ){
1096
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -1043,17 +1043,17 @@
1043 || strncmp(zTarget, "mailto:", 7)==0
1044 ){
1045 blob_appendf(p->pOut, "<a href=\"%s\">", zTarget);
1046 /* zTerm = "&#x27FE;</a>"; // doesn't work on windows */
1047 }else if( zTarget[0]=='/' ){
1048 if( 1 /* g.perm.History */ ){
1049 blob_appendf(p->pOut, "<a href=\"%s%h\">", g.zTop, zTarget);
1050 }else{
1051 zTerm = "";
1052 }
1053 }else if( zTarget[0]=='.' || zTarget[0]=='#' ){
1054 if( 1 /* g.perm.History */ ){
1055 blob_appendf(p->pOut, "<a href=\"%h\">", zTarget);
1056 }else{
1057 zTerm = "";
1058 }
1059 }else if( is_valid_uuid(zTarget) ){
@@ -1061,11 +1061,11 @@
1061 if( is_ticket(zTarget, &isClosed) ){
1062 /* Special display processing for tickets. Display the hyperlink
1063 ** as crossed out if the ticket is closed.
1064 */
1065 if( isClosed ){
1066 if( g.perm.History ){
1067 blob_appendf(p->pOut,
1068 "<a href=\"%s/info/%s\"><span class=\"wikiTagCancelled\">[",
1069 g.zTop, zTarget
1070 );
1071 zTerm = "]</span></a>";
@@ -1072,11 +1072,11 @@
1072 }else{
1073 blob_appendf(p->pOut,"<span class=\"wikiTagCancelled\">[");
1074 zTerm = "]</span>";
1075 }
1076 }else{
1077 if( g.perm.History ){
1078 blob_appendf(p->pOut,"<a href=\"%s/info/%s\">[",
1079 g.zTop, zTarget
1080 );
1081 zTerm = "]</a>";
1082 }else{
@@ -1085,11 +1085,11 @@
1085 }
1086 }
1087 }else if( !in_this_repo(zTarget) ){
1088 blob_appendf(p->pOut, "<span class=\"brokenlink\">[", zTarget);
1089 zTerm = "]</span>";
1090 }else if( g.perm.History ){
1091 blob_appendf(p->pOut, "<a href=\"%s/info/%s\">[", g.zTop, zTarget);
1092 zTerm = "]</a>";
1093 }
1094 }else if( strlen(zTarget)>=10 && fossil_isdigit(zTarget[0]) && zTarget[4]=='-'
1095 && db_int(0, "SELECT datetime(%Q) NOT NULL", zTarget) ){
1096
+16 -16
--- src/xfer.c
+++ src/xfer.c
@@ -129,11 +129,11 @@
129129
blob_extract(pXfer->pIn, n, &content);
130130
if( !cloneFlag && uuid_is_shunned(blob_str(&pXfer->aToken[1])) ){
131131
/* Ignore files that have been shunned */
132132
return;
133133
}
134
- if( isPriv && !g.okPrivate ){
134
+ if( isPriv && !g.perm.Private ){
135135
/* Do not accept private files if not authorized */
136136
return;
137137
}
138138
if( cloneFlag ){
139139
if( pXfer->nToken==4 ){
@@ -227,11 +227,11 @@
227227
|| (pXfer->nToken==5 && !blob_is_uuid(&pXfer->aToken[2]))
228228
){
229229
blob_appendf(&pXfer->err, "malformed cfile line");
230230
return;
231231
}
232
- if( isPriv && !g.okPrivate ){
232
+ if( isPriv && !g.perm.Private ){
233233
/* Do not accept private files if not authorized */
234234
return;
235235
}
236236
blob_zero(&content);
237237
blob_extract(pXfer->pIn, szC, &content);
@@ -908,11 +908,11 @@
908908
&& blob_is_uuid(&xfer.aToken[1])
909909
){
910910
if( isPush ){
911911
if( xfer.nToken==2 || blob_eq(&xfer.aToken[2],"1")==0 ){
912912
rid_from_uuid(&xfer.aToken[1], 1, 0);
913
- }else if( g.okPrivate ){
913
+ }else if( g.perm.Private ){
914914
rid_from_uuid(&xfer.aToken[1], 1, 1);
915915
}else{
916916
server_private_xfer_not_authorized();
917917
}
918918
}
@@ -941,19 +941,19 @@
941941
nErr++;
942942
break;
943943
}
944944
login_check_credentials();
945945
if( blob_eq(&xfer.aToken[0], "pull") ){
946
- if( !g.okRead ){
946
+ if( !g.perm.Read ){
947947
cgi_reset_content();
948948
@ error not\sauthorized\sto\sread
949949
nErr++;
950950
break;
951951
}
952952
isPull = 1;
953953
}else{
954
- if( !g.okWrite ){
954
+ if( !g.perm.Write ){
955955
if( !isPull ){
956956
cgi_reset_content();
957957
@ error not\sauthorized\sto\swrite
958958
nErr++;
959959
}else{
@@ -970,11 +970,11 @@
970970
** The client knows nothing. Tell all.
971971
*/
972972
if( blob_eq(&xfer.aToken[0], "clone") ){
973973
int iVers;
974974
login_check_credentials();
975
- if( !g.okClone ){
975
+ if( !g.perm.Clone ){
976976
cgi_reset_content();
977977
@ push %s(db_get("server-code", "x")) %s(db_get("project-code", "x"))
978978
@ error not\sauthorized\sto\sclone
979979
nErr++;
980980
break;
@@ -1014,11 +1014,11 @@
10141014
*/
10151015
if( blob_eq(&xfer.aToken[0], "login")
10161016
&& xfer.nToken==4
10171017
){
10181018
if( disableLogin ){
1019
- g.okRead = g.okWrite = g.okPrivate = g.okAdmin = 1;
1019
+ g.perm.Read = g.perm.Write = g.perm.Private = g.perm.Admin = 1;
10201020
}else{
10211021
if( check_tail_hash(&xfer.aToken[2], xfer.pIn)
10221022
|| check_login(&xfer.aToken[1], &xfer.aToken[2], &xfer.aToken[3])
10231023
){
10241024
cgi_reset_content();
@@ -1034,17 +1034,17 @@
10341034
** Request a configuration value
10351035
*/
10361036
if( blob_eq(&xfer.aToken[0], "reqconfig")
10371037
&& xfer.nToken==2
10381038
){
1039
- if( g.okRead ){
1039
+ if( g.perm.Read ){
10401040
char *zName = blob_str(&xfer.aToken[1]);
10411041
if( zName[0]=='/' ){
10421042
/* New style configuration transfer */
10431043
int groupMask = configure_name_to_mask(&zName[1], 0);
1044
- if( !g.okAdmin ) groupMask &= ~CONFIGSET_USER;
1045
- if( !g.okRdAddr ) groupMask &= ~CONFIGSET_ADDR;
1044
+ if( !g.perm.Admin ) groupMask &= ~CONFIGSET_USER;
1045
+ if( !g.perm.RdAddr ) groupMask &= ~CONFIGSET_ADDR;
10461046
configure_send_group(xfer.pOut, groupMask, 0);
10471047
}else if( configure_is_exportable(zName) ){
10481048
/* Old style configuration transfer */
10491049
send_legacy_config_card(&xfer, zName);
10501050
}
@@ -1060,11 +1060,11 @@
10601060
&& blob_is_int(&xfer.aToken[2], &size) ){
10611061
const char *zName = blob_str(&xfer.aToken[1]);
10621062
Blob content;
10631063
blob_zero(&content);
10641064
blob_extract(xfer.pIn, size, &content);
1065
- if( !g.okAdmin ){
1065
+ if( !g.perm.Admin ){
10661066
cgi_reset_content();
10671067
@ error not\sauthorized\sto\spush\sconfiguration
10681068
nErr++;
10691069
break;
10701070
}
@@ -1105,11 +1105,11 @@
11051105
**
11061106
** This card indicates that the next "file" or "cfile" will contain
11071107
** private content.
11081108
*/
11091109
if( blob_eq(&xfer.aToken[0], "private") ){
1110
- if( !g.okPrivate ){
1110
+ if( !g.perm.Private ){
11111111
server_private_xfer_not_authorized();
11121112
}else{
11131113
xfer.nextIsPrivate = 1;
11141114
}
11151115
}else
@@ -1128,11 +1128,11 @@
11281128
** it is not automatic with "a" or "s") then this pragma causes
11291129
** private information to be pulled in addition to public records.
11301130
*/
11311131
if( blob_eq(&xfer.aToken[1], "send-private") ){
11321132
login_check_credentials();
1133
- if( !g.okPrivate ){
1133
+ if( !g.perm.Private ){
11341134
server_private_xfer_not_authorized();
11351135
}else{
11361136
xfer.syncPrivate = 1;
11371137
}
11381138
}
@@ -1266,11 +1266,11 @@
12661266
memset(&xfer, 0, sizeof(xfer));
12671267
xfer.pIn = &recv;
12681268
xfer.pOut = &send;
12691269
xfer.mxSend = db_get_int("max-upload", 250000);
12701270
if( privateFlag ){
1271
- g.okPrivate = 1;
1271
+ g.perm.Private = 1;
12721272
xfer.syncPrivate = 1;
12731273
}
12741274
12751275
assert( pushFlag | pullFlag | cloneFlag | configRcvMask | configSendMask );
12761276
db_begin_transaction();
@@ -1508,11 +1508,11 @@
15081508
int rid;
15091509
int isPriv = xfer.nToken>=3 && blob_eq(&xfer.aToken[2],"1");
15101510
rid = rid_from_uuid(&xfer.aToken[1], 0, 0);
15111511
if( rid>0 ){
15121512
if( !isPriv ) content_make_public(rid);
1513
- }else if( isPriv && !g.okPrivate ){
1513
+ }else if( isPriv && !g.perm.Private ){
15141514
/* ignore private files */
15151515
}else if( pullFlag || cloneFlag ){
15161516
rid = content_new(blob_str(&xfer.aToken[1]), isPriv);
15171517
if( rid ) newPhantom = 1;
15181518
}
@@ -1553,11 +1553,11 @@
15531553
&& blob_is_int(&xfer.aToken[2], &size) ){
15541554
const char *zName = blob_str(&xfer.aToken[1]);
15551555
Blob content;
15561556
blob_zero(&content);
15571557
blob_extract(xfer.pIn, size, &content);
1558
- g.okAdmin = g.okRdAddr = 1;
1558
+ g.perm.Admin = g.perm.RdAddr = 1;
15591559
configure_receive(zName, &content, origConfigRcvMask);
15601560
nCardSent++;
15611561
blob_reset(&content);
15621562
blob_seek(xfer.pIn, 1, BLOB_SEEK_CUR);
15631563
}else
15641564
--- src/xfer.c
+++ src/xfer.c
@@ -129,11 +129,11 @@
129 blob_extract(pXfer->pIn, n, &content);
130 if( !cloneFlag && uuid_is_shunned(blob_str(&pXfer->aToken[1])) ){
131 /* Ignore files that have been shunned */
132 return;
133 }
134 if( isPriv && !g.okPrivate ){
135 /* Do not accept private files if not authorized */
136 return;
137 }
138 if( cloneFlag ){
139 if( pXfer->nToken==4 ){
@@ -227,11 +227,11 @@
227 || (pXfer->nToken==5 && !blob_is_uuid(&pXfer->aToken[2]))
228 ){
229 blob_appendf(&pXfer->err, "malformed cfile line");
230 return;
231 }
232 if( isPriv && !g.okPrivate ){
233 /* Do not accept private files if not authorized */
234 return;
235 }
236 blob_zero(&content);
237 blob_extract(pXfer->pIn, szC, &content);
@@ -908,11 +908,11 @@
908 && blob_is_uuid(&xfer.aToken[1])
909 ){
910 if( isPush ){
911 if( xfer.nToken==2 || blob_eq(&xfer.aToken[2],"1")==0 ){
912 rid_from_uuid(&xfer.aToken[1], 1, 0);
913 }else if( g.okPrivate ){
914 rid_from_uuid(&xfer.aToken[1], 1, 1);
915 }else{
916 server_private_xfer_not_authorized();
917 }
918 }
@@ -941,19 +941,19 @@
941 nErr++;
942 break;
943 }
944 login_check_credentials();
945 if( blob_eq(&xfer.aToken[0], "pull") ){
946 if( !g.okRead ){
947 cgi_reset_content();
948 @ error not\sauthorized\sto\sread
949 nErr++;
950 break;
951 }
952 isPull = 1;
953 }else{
954 if( !g.okWrite ){
955 if( !isPull ){
956 cgi_reset_content();
957 @ error not\sauthorized\sto\swrite
958 nErr++;
959 }else{
@@ -970,11 +970,11 @@
970 ** The client knows nothing. Tell all.
971 */
972 if( blob_eq(&xfer.aToken[0], "clone") ){
973 int iVers;
974 login_check_credentials();
975 if( !g.okClone ){
976 cgi_reset_content();
977 @ push %s(db_get("server-code", "x")) %s(db_get("project-code", "x"))
978 @ error not\sauthorized\sto\sclone
979 nErr++;
980 break;
@@ -1014,11 +1014,11 @@
1014 */
1015 if( blob_eq(&xfer.aToken[0], "login")
1016 && xfer.nToken==4
1017 ){
1018 if( disableLogin ){
1019 g.okRead = g.okWrite = g.okPrivate = g.okAdmin = 1;
1020 }else{
1021 if( check_tail_hash(&xfer.aToken[2], xfer.pIn)
1022 || check_login(&xfer.aToken[1], &xfer.aToken[2], &xfer.aToken[3])
1023 ){
1024 cgi_reset_content();
@@ -1034,17 +1034,17 @@
1034 ** Request a configuration value
1035 */
1036 if( blob_eq(&xfer.aToken[0], "reqconfig")
1037 && xfer.nToken==2
1038 ){
1039 if( g.okRead ){
1040 char *zName = blob_str(&xfer.aToken[1]);
1041 if( zName[0]=='/' ){
1042 /* New style configuration transfer */
1043 int groupMask = configure_name_to_mask(&zName[1], 0);
1044 if( !g.okAdmin ) groupMask &= ~CONFIGSET_USER;
1045 if( !g.okRdAddr ) groupMask &= ~CONFIGSET_ADDR;
1046 configure_send_group(xfer.pOut, groupMask, 0);
1047 }else if( configure_is_exportable(zName) ){
1048 /* Old style configuration transfer */
1049 send_legacy_config_card(&xfer, zName);
1050 }
@@ -1060,11 +1060,11 @@
1060 && blob_is_int(&xfer.aToken[2], &size) ){
1061 const char *zName = blob_str(&xfer.aToken[1]);
1062 Blob content;
1063 blob_zero(&content);
1064 blob_extract(xfer.pIn, size, &content);
1065 if( !g.okAdmin ){
1066 cgi_reset_content();
1067 @ error not\sauthorized\sto\spush\sconfiguration
1068 nErr++;
1069 break;
1070 }
@@ -1105,11 +1105,11 @@
1105 **
1106 ** This card indicates that the next "file" or "cfile" will contain
1107 ** private content.
1108 */
1109 if( blob_eq(&xfer.aToken[0], "private") ){
1110 if( !g.okPrivate ){
1111 server_private_xfer_not_authorized();
1112 }else{
1113 xfer.nextIsPrivate = 1;
1114 }
1115 }else
@@ -1128,11 +1128,11 @@
1128 ** it is not automatic with "a" or "s") then this pragma causes
1129 ** private information to be pulled in addition to public records.
1130 */
1131 if( blob_eq(&xfer.aToken[1], "send-private") ){
1132 login_check_credentials();
1133 if( !g.okPrivate ){
1134 server_private_xfer_not_authorized();
1135 }else{
1136 xfer.syncPrivate = 1;
1137 }
1138 }
@@ -1266,11 +1266,11 @@
1266 memset(&xfer, 0, sizeof(xfer));
1267 xfer.pIn = &recv;
1268 xfer.pOut = &send;
1269 xfer.mxSend = db_get_int("max-upload", 250000);
1270 if( privateFlag ){
1271 g.okPrivate = 1;
1272 xfer.syncPrivate = 1;
1273 }
1274
1275 assert( pushFlag | pullFlag | cloneFlag | configRcvMask | configSendMask );
1276 db_begin_transaction();
@@ -1508,11 +1508,11 @@
1508 int rid;
1509 int isPriv = xfer.nToken>=3 && blob_eq(&xfer.aToken[2],"1");
1510 rid = rid_from_uuid(&xfer.aToken[1], 0, 0);
1511 if( rid>0 ){
1512 if( !isPriv ) content_make_public(rid);
1513 }else if( isPriv && !g.okPrivate ){
1514 /* ignore private files */
1515 }else if( pullFlag || cloneFlag ){
1516 rid = content_new(blob_str(&xfer.aToken[1]), isPriv);
1517 if( rid ) newPhantom = 1;
1518 }
@@ -1553,11 +1553,11 @@
1553 && blob_is_int(&xfer.aToken[2], &size) ){
1554 const char *zName = blob_str(&xfer.aToken[1]);
1555 Blob content;
1556 blob_zero(&content);
1557 blob_extract(xfer.pIn, size, &content);
1558 g.okAdmin = g.okRdAddr = 1;
1559 configure_receive(zName, &content, origConfigRcvMask);
1560 nCardSent++;
1561 blob_reset(&content);
1562 blob_seek(xfer.pIn, 1, BLOB_SEEK_CUR);
1563 }else
1564
--- src/xfer.c
+++ src/xfer.c
@@ -129,11 +129,11 @@
129 blob_extract(pXfer->pIn, n, &content);
130 if( !cloneFlag && uuid_is_shunned(blob_str(&pXfer->aToken[1])) ){
131 /* Ignore files that have been shunned */
132 return;
133 }
134 if( isPriv && !g.perm.Private ){
135 /* Do not accept private files if not authorized */
136 return;
137 }
138 if( cloneFlag ){
139 if( pXfer->nToken==4 ){
@@ -227,11 +227,11 @@
227 || (pXfer->nToken==5 && !blob_is_uuid(&pXfer->aToken[2]))
228 ){
229 blob_appendf(&pXfer->err, "malformed cfile line");
230 return;
231 }
232 if( isPriv && !g.perm.Private ){
233 /* Do not accept private files if not authorized */
234 return;
235 }
236 blob_zero(&content);
237 blob_extract(pXfer->pIn, szC, &content);
@@ -908,11 +908,11 @@
908 && blob_is_uuid(&xfer.aToken[1])
909 ){
910 if( isPush ){
911 if( xfer.nToken==2 || blob_eq(&xfer.aToken[2],"1")==0 ){
912 rid_from_uuid(&xfer.aToken[1], 1, 0);
913 }else if( g.perm.Private ){
914 rid_from_uuid(&xfer.aToken[1], 1, 1);
915 }else{
916 server_private_xfer_not_authorized();
917 }
918 }
@@ -941,19 +941,19 @@
941 nErr++;
942 break;
943 }
944 login_check_credentials();
945 if( blob_eq(&xfer.aToken[0], "pull") ){
946 if( !g.perm.Read ){
947 cgi_reset_content();
948 @ error not\sauthorized\sto\sread
949 nErr++;
950 break;
951 }
952 isPull = 1;
953 }else{
954 if( !g.perm.Write ){
955 if( !isPull ){
956 cgi_reset_content();
957 @ error not\sauthorized\sto\swrite
958 nErr++;
959 }else{
@@ -970,11 +970,11 @@
970 ** The client knows nothing. Tell all.
971 */
972 if( blob_eq(&xfer.aToken[0], "clone") ){
973 int iVers;
974 login_check_credentials();
975 if( !g.perm.Clone ){
976 cgi_reset_content();
977 @ push %s(db_get("server-code", "x")) %s(db_get("project-code", "x"))
978 @ error not\sauthorized\sto\sclone
979 nErr++;
980 break;
@@ -1014,11 +1014,11 @@
1014 */
1015 if( blob_eq(&xfer.aToken[0], "login")
1016 && xfer.nToken==4
1017 ){
1018 if( disableLogin ){
1019 g.perm.Read = g.perm.Write = g.perm.Private = g.perm.Admin = 1;
1020 }else{
1021 if( check_tail_hash(&xfer.aToken[2], xfer.pIn)
1022 || check_login(&xfer.aToken[1], &xfer.aToken[2], &xfer.aToken[3])
1023 ){
1024 cgi_reset_content();
@@ -1034,17 +1034,17 @@
1034 ** Request a configuration value
1035 */
1036 if( blob_eq(&xfer.aToken[0], "reqconfig")
1037 && xfer.nToken==2
1038 ){
1039 if( g.perm.Read ){
1040 char *zName = blob_str(&xfer.aToken[1]);
1041 if( zName[0]=='/' ){
1042 /* New style configuration transfer */
1043 int groupMask = configure_name_to_mask(&zName[1], 0);
1044 if( !g.perm.Admin ) groupMask &= ~CONFIGSET_USER;
1045 if( !g.perm.RdAddr ) groupMask &= ~CONFIGSET_ADDR;
1046 configure_send_group(xfer.pOut, groupMask, 0);
1047 }else if( configure_is_exportable(zName) ){
1048 /* Old style configuration transfer */
1049 send_legacy_config_card(&xfer, zName);
1050 }
@@ -1060,11 +1060,11 @@
1060 && blob_is_int(&xfer.aToken[2], &size) ){
1061 const char *zName = blob_str(&xfer.aToken[1]);
1062 Blob content;
1063 blob_zero(&content);
1064 blob_extract(xfer.pIn, size, &content);
1065 if( !g.perm.Admin ){
1066 cgi_reset_content();
1067 @ error not\sauthorized\sto\spush\sconfiguration
1068 nErr++;
1069 break;
1070 }
@@ -1105,11 +1105,11 @@
1105 **
1106 ** This card indicates that the next "file" or "cfile" will contain
1107 ** private content.
1108 */
1109 if( blob_eq(&xfer.aToken[0], "private") ){
1110 if( !g.perm.Private ){
1111 server_private_xfer_not_authorized();
1112 }else{
1113 xfer.nextIsPrivate = 1;
1114 }
1115 }else
@@ -1128,11 +1128,11 @@
1128 ** it is not automatic with "a" or "s") then this pragma causes
1129 ** private information to be pulled in addition to public records.
1130 */
1131 if( blob_eq(&xfer.aToken[1], "send-private") ){
1132 login_check_credentials();
1133 if( !g.perm.Private ){
1134 server_private_xfer_not_authorized();
1135 }else{
1136 xfer.syncPrivate = 1;
1137 }
1138 }
@@ -1266,11 +1266,11 @@
1266 memset(&xfer, 0, sizeof(xfer));
1267 xfer.pIn = &recv;
1268 xfer.pOut = &send;
1269 xfer.mxSend = db_get_int("max-upload", 250000);
1270 if( privateFlag ){
1271 g.perm.Private = 1;
1272 xfer.syncPrivate = 1;
1273 }
1274
1275 assert( pushFlag | pullFlag | cloneFlag | configRcvMask | configSendMask );
1276 db_begin_transaction();
@@ -1508,11 +1508,11 @@
1508 int rid;
1509 int isPriv = xfer.nToken>=3 && blob_eq(&xfer.aToken[2],"1");
1510 rid = rid_from_uuid(&xfer.aToken[1], 0, 0);
1511 if( rid>0 ){
1512 if( !isPriv ) content_make_public(rid);
1513 }else if( isPriv && !g.perm.Private ){
1514 /* ignore private files */
1515 }else if( pullFlag || cloneFlag ){
1516 rid = content_new(blob_str(&xfer.aToken[1]), isPriv);
1517 if( rid ) newPhantom = 1;
1518 }
@@ -1553,11 +1553,11 @@
1553 && blob_is_int(&xfer.aToken[2], &size) ){
1554 const char *zName = blob_str(&xfer.aToken[1]);
1555 Blob content;
1556 blob_zero(&content);
1557 blob_extract(xfer.pIn, size, &content);
1558 g.perm.Admin = g.perm.RdAddr = 1;
1559 configure_receive(zName, &content, origConfigRcvMask);
1560 nCardSent++;
1561 blob_reset(&content);
1562 blob_seek(xfer.pIn, 1, BLOB_SEEK_CUR);
1563 }else
1564
+1 -1
--- src/zip.c
+++ src/zip.c
@@ -426,11 +426,11 @@
426426
char *zName, *zRid;
427427
int nName, nRid;
428428
Blob zip;
429429
430430
login_check_credentials();
431
- if( !g.okZip ){ login_needed(); return; }
431
+ if( !g.perm.Zip ){ login_needed(); return; }
432432
zName = mprintf("%s", PD("name",""));
433433
nName = strlen(zName);
434434
zRid = mprintf("%s", PD("uuid",""));
435435
nRid = strlen(zRid);
436436
for(nName=strlen(zName)-1; nName>5; nName--){
437437
--- src/zip.c
+++ src/zip.c
@@ -426,11 +426,11 @@
426 char *zName, *zRid;
427 int nName, nRid;
428 Blob zip;
429
430 login_check_credentials();
431 if( !g.okZip ){ login_needed(); return; }
432 zName = mprintf("%s", PD("name",""));
433 nName = strlen(zName);
434 zRid = mprintf("%s", PD("uuid",""));
435 nRid = strlen(zRid);
436 for(nName=strlen(zName)-1; nName>5; nName--){
437
--- src/zip.c
+++ src/zip.c
@@ -426,11 +426,11 @@
426 char *zName, *zRid;
427 int nName, nRid;
428 Blob zip;
429
430 login_check_credentials();
431 if( !g.perm.Zip ){ login_needed(); return; }
432 zName = mprintf("%s", PD("name",""));
433 nName = strlen(zName);
434 zRid = mprintf("%s", PD("uuid",""));
435 nRid = strlen(zRid);
436 for(nName=strlen(zName)-1; nName>5; nName--){
437

Keyboard Shortcuts

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