Check-in [d3e711fd2f]
Not logged in
Overview

SHA1 Hash:d3e711fd2fd664e54610498a49b6ad6ee0ad5f8a
Date: 2008-07-15 16:42:48
User: drh
Comment:Work toward getting bug-tracking working well.
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified src/login.c from [43d8acf6c2] to [0aeb275746].

@@ -308,11 +308,11 @@
 void login_set_capabilities(const char *zCap){
   int i;
   for(i=0; zCap[i]; i++){
     switch( zCap[i] ){
       case 's':   g.okSetup = 1;
-      case 'a':   g.okAdmin = g.okRdTkt = g.okWrTkt = g.okQuery =
+      case 'a':   g.okAdmin = g.okRdTkt = g.okWrTkt =
                               g.okRdWiki = g.okWrWiki = g.okNewWiki =
                               g.okApndWiki = g.okHistory = g.okClone =
                               g.okNewTkt = g.okPassword = g.okRdAddr =
                               g.okTktFmt = 1;
       case 'i':   g.okRead = g.okWrite = 1;                     break;
@@ -320,11 +320,10 @@
 
       case 'd':   g.okDelete = 1;                               break;
       case 'h':   g.okHistory = 1;                              break;
       case 'g':   g.okClone = 1;                                break;
       case 'p':   g.okPassword = 1;                             break;
-      case 'q':   g.okQuery = 1;                                break;
 
       case 'j':   g.okRdWiki = 1;                               break;
       case 'k':   g.okWrWiki = g.okRdWiki = g.okApndWiki =1;    break;
       case 'm':   g.okApndWiki = 1;                             break;
       case 'f':   g.okNewWiki = 1;                              break;
@@ -363,11 +362,10 @@
       case 'k':  rc = g.okWrWiki;    break;
       case 'm':  rc = g.okApndWiki;  break;
       case 'n':  rc = g.okNewTkt;    break;
       case 'o':  rc = g.okRead;      break;
       case 'p':  rc = g.okPassword;  break;
-      case 'q':  rc = g.okQuery;     break;
       case 'r':  rc = g.okRdTkt;     break;
       case 's':  rc = g.okSetup;     break;
       case 't':  rc = g.okTktFmt;    break;
       case 'w':  rc = g.okWrTkt;     break;
       default:   rc = 0;             break;

Modified src/report.c from [6a7885da53] to [1a3b1f6f03].

@@ -35,19 +35,20 @@
 ** WEBPAGE: /reportlist
 */
 void view_list(void){
   Stmt q;
   int rn = 0;
-  int cnt = 1;
+  int cnt = 0;
 
   login_check_credentials();
   if( !g.okRdTkt && !g.okNewTkt ){ login_needed(); return; }
   style_header("Bug Report Main Menu");
   if( g.okNewTkt ){
     @ <p>Enter a new bug report:</p>
     @ <ol><li value="1"><a href="tktnew">New bug report</a></li></ol>
     @
+    cnt++;
   }
   if( !g.okRdTkt ){
     @ <p>You are not authorized to view existing bug reports.</p>
   }else{
     db_prepare(&q, "SELECT rn, title, owner FROM reportfmt ORDER BY title");
@@ -67,11 +68,13 @@
         @ [<a href="rptedit?rn=%d(rn)&amp;copy=1" rel="nofollow">copy</a>]
       }
       if( g.okAdmin || (g.okWrTkt && zOwner && strcmp(g.zLogin,zOwner)==0) ){
         @ [<a href="rptedit?rn=%d(rn)" rel="nofollow">edit</a>]
       }
-      @ [<a href="rptsql?rn=%d(rn)" rel="nofollow">sql</a>]
+      if( g.okTktFmt ){
+        @ [<a href="rptsql?rn=%d(rn)" rel="nofollow">sql</a>]
+      }
       @ </li>
     }
   }
   @ </ol>
   if( g.okTktFmt ){
@@ -252,11 +255,11 @@
   const char *zOwner;
   const char *zClrKey;
   Stmt q;
 
   login_check_credentials();
-  if( !g.okQuery ){
+  if( !g.okTktFmt ){
     login_needed();
     return;
   }
   rn = atoi(PD("rn","0"));
   db_prepare(&q, "SELECT title, sqlcode, owner, cols "
@@ -300,11 +303,11 @@
   const char *zClrKey;
   char *zSQL;
   char *zErr = 0;
 
   login_check_credentials();
-  if( !g.okQuery ){
+  if( !g.okTktFmt ){
     login_needed();
     return;
   }
   /*view_add_functions(0);*/
   rn = atoi(PD("rn","0"));
@@ -434,10 +437,14 @@
 ** formats
 */
 static void report_format_hints(void){
   char *zSchema;
   zSchema = db_text(0,"SELECT sql FROM sqlite_master WHERE name='ticket'");
+  if( zSchema==0 ){
+    zSchema = db_text(0,"SELECT sql FROM repository.sqlite_master"
+                        " WHERE name='ticket'");
+  }
   @ <hr><h3>TICKET Schema</h3>
   @ <blockquote><pre>
   @ %h(zSchema)
   @ </pre></blockquote>
   @ <h3>Notes</h3>
@@ -913,14 +920,16 @@
 
     db_multi_exec("PRAGMA empty_result_callbacks=ON");
     style_submenu_element("Raw", "Raw",
       "rptview?tablist=1&%s", PD("QUERY_STRING",""));
     if( g.okAdmin
-       || (g.okQuery && g.zLogin && zOwner && strcmp(g.zLogin,zOwner)==0) ){
+       || (g.okTktFmt && g.zLogin && zOwner && strcmp(g.zLogin,zOwner)==0) ){
       style_submenu_element("Edit", "Edit", "rptedit?rn=%d", rn);
     }
-    style_submenu_element("SQL", "SQL", "rptsql?rn=%d",rn);
+    if( g.okTktFmt ){
+      style_submenu_element("SQL", "SQL", "rptsql?rn=%d",rn);
+    }
     style_header(zTitle);
     output_color_key(zClrKey, 1,
         "border=0 cellpadding=3 cellspacing=0 class=\"report\"");
     @ <table border=1 cellpadding=2 cellspacing=0 class="report">
     sState.rn = rn;

Modified src/setup.c from [020ff2a0d6] to [5f5b17c105].

@@ -147,11 +147,10 @@
   @ <li value="11"><b>Write-Wiki</b>: Edit wiki pages</li>
   @ <li value="13"><b>Append-Wiki</b>: Append to wiki pages</li>
   @ <li value="14"><b>New-Tkt</b>: Create new tickets</li>
   @ <li value="15"><b>Check-Out</b>: Check out versions</li>
   @ <li value="16"><b>Password</b>: Change your own password</li>
-  @ <li value="17"><b>Query</b>: Create new queries against tickets</li>
   @ <li value="18"><b>Read-Tkt</b>: View tickets</li>
   @ <li value="19"><b>Setup:</b> Setup and configure this website</li>
   @ <li value="20"><b>Tkt-Report:</b> Create new bug summary reports</li>
   @ <li value="23"><b>Write-Tkt</b>: Edit tickets</li>
   @ </ol>
@@ -173,11 +172,11 @@
 ** WEBPAGE: /setup_uedit
 */
 void user_edit(void){
   const char *zId, *zLogin, *zInfo, *zCap;
   char *oaa, *oas, *oar, *oaw, *oan, *oai, *oaj, *oao, *oap;
-  char *oak, *oad, *oaq, *oac, *oaf, *oam, *oah, *oag, *oae;
+  char *oak, *oad, *oac, *oaf, *oam, *oah, *oag, *oae;
   char *oat;
   int doWrite;
   int uid;
   int higherUser = 0;  /* True if user being edited is SETUP and the */
                        /* user doing the editing is ADMIN.  Disallow editing */
@@ -220,11 +219,10 @@
     int aj = P("aj")!=0;
     int ak = P("ak")!=0;
     int an = P("an")!=0;
     int ao = P("ao")!=0;
     int ap = P("ap")!=0;
-    int aq = P("aq")!=0;
     int ar = P("ar")!=0;
     int as = g.okSetup && P("as")!=0;
     int aw = P("aw")!=0;
     int ac = P("ac")!=0;
     int af = P("af")!=0;
@@ -244,11 +242,10 @@
     if( ak ){ zCap[i++] = 'k'; }
     if( am ){ zCap[i++] = 'm'; }
     if( an ){ zCap[i++] = 'n'; }
     if( ao ){ zCap[i++] = 'o'; }
     if( ap ){ zCap[i++] = 'p'; }
-    if( aq ){ zCap[i++] = 'q'; }
     if( ar ){ zCap[i++] = 'r'; }
     if( as ){ zCap[i++] = 's'; }
     if( at ){ zCap[i++] = 't'; }
     if( aw ){ zCap[i++] = 'w'; }
 
@@ -282,11 +279,11 @@
   */
   zLogin = "";
   zInfo = "";
   zCap = "";
   oaa = oac = oad = oae = oaf = oag = oah = oai = oaj = oak = oam =
-        oan = oao = oap = oaq = oar = oas = oat = oaw = "";
+        oan = oao = oap = oar = oas = oat = oaw = "";
   if( uid ){
     zLogin = db_text("", "SELECT login FROM user WHERE uid=%d", uid);
     zInfo = db_text("", "SELECT info FROM user WHERE uid=%d", uid);
     zCap = db_text("", "SELECT cap FROM user WHERE uid=%d", uid);
     if( strchr(zCap, 'a') ) oaa = " checked";
@@ -301,11 +298,10 @@
     if( strchr(zCap, 'k') ) oak = " checked";
     if( strchr(zCap, 'm') ) oam = " checked";
     if( strchr(zCap, 'n') ) oan = " checked";
     if( strchr(zCap, 'o') ) oao = " checked";
     if( strchr(zCap, 'p') ) oap = " checked";
-    if( strchr(zCap, 'q') ) oaq = " checked";
     if( strchr(zCap, 'r') ) oar = " checked";
     if( strchr(zCap, 's') ) oas = " checked";
     if( strchr(zCap, 't') ) oat = " checked";
     if( strchr(zCap, 'w') ) oaw = " checked";
   }
@@ -345,11 +341,10 @@
   }
   @     <input type="checkbox" name="aa"%s(oaa)>Admin</input><br>
   @     <input type="checkbox" name="ad"%s(oad)>Delete</input><br>
   @     <input type="checkbox" name="ae"%s(oad)>Email</input><br>
   @     <input type="checkbox" name="ap"%s(oap)>Password</input><br>
-  @     <input type="checkbox" name="aq"%s(oaq)>Query</input><br>
   @     <input type="checkbox" name="ai"%s(oai)>Check-In</input><br>
   @     <input type="checkbox" name="ao"%s(oao)>Check-Out</input><br>
   @     <input type="checkbox" name="ah"%s(oah)>History</input><br>
   @     <input type="checkbox" name="ag"%s(oag)>Clone</input><br>
   @     <input type="checkbox" name="aj"%s(oaj)>Read Wiki</input><br>
@@ -391,16 +386,10 @@
   @ delete capability is only in effect for 24 hours after the item
   @ is first posted.  The Setup user can delete anything at any time.
   @ </p></li>
   @
   @ <li><p>
-  @ The <b>Query</b> privilege allows the user to create or edit
-  @ report formats by specifying appropriate SQL.  Users can run
-  @ existing reports without the Query privilege.
-  @ </p></li>
-  @
-  @ <li><p>
   @ An <b>Admin</b> user can add other users, create new ticket report
   @ formats, and change system defaults.  But only the <b>Setup</b> user
   @ is able to change the repository to
   @ which this program is linked.
   @ </p></li>
@@ -407,10 +396,19 @@
   @
   @ <li><p>
   @ The <b>History</b> privilege allows a user to see a timeline
   @ with hyperlinks to version information, to download ZIP archives
   @ of individual versions.
+  @ </p></li>
+  @
+  @ <li><p>
+  @ The <b>Read Wiki</b>, <b>New Wiki</b>, <b>Append Wiki</b>, and
+  @ <b>Write Wiki</b> privileges control access to wiki pages.  The
+  @ <b>Read Tkt</b>, <b>New Tkt</b>, <b>Append Tkt</b>, and
+  @ <b>Write Tkt</b> privileges control access to trouble tickets.
+  @ The <b>Tkt Report</b> privilege allows the user to create or edit
+  @ ticket report formats.
   @ </p></li>
   @
   @ <li><p>
   @ No login is required for user "<b>nobody</b>".  The capabilities
   @ of this user are available to anyone without supplying a username or

Modified src/style.c from [d4b64100f2] to [7071fb1a0f].

@@ -182,11 +182,11 @@
 @ if {[hascap o]} {
 @   html "<a href='$baseurl/leaves'>Leaves</a>"
 @   html "<a href='$baseurl/timeline'>Timeline</a>"
 @   # html "<a href='$baseurl/tagview'>Tags</a>"
 @ }
-@ if {[hascap hr]} {
+@ if {[hascap r]} {
 @   html "<a href='$baseurl/reportlist'>Bugs</a>"
 @ }
 @ if {[hascap j]} {
 @   html "<a href='$baseurl/wiki'>Wiki</a>"
 @ }

Modified src/wiki.c from [627ea9c43a] to [185275fa54].

@@ -89,10 +89,11 @@
     g.okWrWiki = 0;
     g.okHistory = 0;
     wiki_page();
     return;
   }
+  login_check_credentials();
   style_header("Home");
   @ <p>This is a stub home-page for the project.
   @ To fill in this page, first go to
   @ <a href="%s(g.zBaseURL)/setup_config">setup/config</a>
   @ and establish a "Project Name".  Then create a