Fossil

Check-in [03f0a495]
Login

Check-in [03f0a495]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add 'contact' subcommand to the 'fossil user' command. This enables changing contact information for a given user. If no argument is passed, this displays the current contact info of the passed in username.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 03f0a4950ccf45eac312194185ff81027f3604b432116e41e4cbb014fee9b6ee
User & Date: jamsek 2020-11-04 00:43:56
Context
2020-11-04
14:25
More gitusers.md doc improvements: promoted the "detached HEAD state" paragraph in Case Study 1 to a new section; clarified "fossil update" vs "fossil checkout" in relation to "git checkout"; applied forum feedback on Case Study 1. ... (check-in: 7e03f7b4 user: wyoung tags: trunk)
00:43
Add 'contact' subcommand to the 'fossil user' command. This enables changing contact information for a given user. If no argument is passed, this displays the current contact info of the passed in username. ... (check-in: 03f0a495 user: jamsek tags: trunk)
2020-11-02
18:11
Improvements to the URL-to-repository-filename converter. ... (check-in: 23679d72 user: drh tags: trunk)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/user.c.

333
334
335
336
337
338
339




340
341
342
343
344
345
346
** Run various subcommands on users of the open repository or of
** the repository identified by the -R or --repository option.
**
** > fossil user capabilities USERNAME ?STRING?
**
**        Query or set the capabilities for user USERNAME
**




** > fossil user default ?USERNAME?
**
**        Query or set the default user.  The default user is the
**        user for command-line interaction.
**
** > fossil user list
** > fossil user ls







>
>
>
>







333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
** Run various subcommands on users of the open repository or of
** the repository identified by the -R or --repository option.
**
** > fossil user capabilities USERNAME ?STRING?
**
**        Query or set the capabilities for user USERNAME
**
** > fossil user contact USERNAME ?CONTACT-INFO?
**
**        Query or set contact information for user USERNAME
**
** > fossil user default ?USERNAME?
**
**        Query or set the default user.  The default user is the
**        user for command-line interaction.
**
** > fossil user list
** > fossil user ls
456
457
458
459
460
461
462


















463
464
465
466
467
468
469
470
471
472
      db_multi_exec(
        "UPDATE user SET cap=%Q, mtime=now() WHERE uid=%d",
        g.argv[4], uid
      );
      db_protect_pop();
    }
    fossil_print("%s\n", db_text(0, "SELECT cap FROM user WHERE uid=%d", uid));


















  }else{
    fossil_fatal("user subcommand should be one of: "
                 "capabilities default list new password");
  }
}

/*
** Attempt to set the user to zLogin
*/
static int attempt_user(const char *zLogin){







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


|







460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
      db_multi_exec(
        "UPDATE user SET cap=%Q, mtime=now() WHERE uid=%d",
        g.argv[4], uid
      );
      db_protect_pop();
    }
    fossil_print("%s\n", db_text(0, "SELECT cap FROM user WHERE uid=%d", uid));
  }else if( n>=2 && strncmp(g.argv[2], "contact", 2)==0 ){
    int uid;
    if( g.argc!=4 && g.argc!=5 ){
      usage("contact USERNAME ?CONTACT-INFO?");
    }
    uid = db_int(0, "SELECT uid FROM user WHERE login=%Q", g.argv[3]);
    if( uid==0 ){
      fossil_fatal("no such user: %s", g.argv[3]);
    }
    if( g.argc==5 ){
      db_unprotect(PROTECT_USER);
      db_multi_exec(
        "UPDATE user SET info=%Q, mtime=now() WHERE uid=%d",
        g.argv[4], uid
      );
      db_protect_pop();
    }
    fossil_print("%s\n", db_text(0, "SELECT info FROM user WHERE uid=%d", uid));
  }else{
    fossil_fatal("user subcommand should be one of: "
                 "capabilities contact default list new password");
  }
}

/*
** Attempt to set the user to zLogin
*/
static int attempt_user(const char *zLogin){