This is a mecanical change, which just lifts up the context.TODO()
calls from inside the DB implementations to the callers.
Future work involves properly wiring up the contexts when it makes
sense.
git-svn-id: file:///srv/svn/repo/suika/trunk@652 f0ae65fe-ee39-954e-97ec-027ff2717ef4
This refactors the SQLite-specific bits into db_sqlite.go. A future
patch will add PostgreSQL support.
git-svn-id: file:///srv/svn/repo/suika/trunk@531 f0ae65fe-ee39-954e-97ec-027ff2717ef4
When changing the password, checks if the user exists *before* prompting
for a password change, instead of after.
git-svn-id: file:///srv/svn/repo/suika/trunk@432 f0ae65fe-ee39-954e-97ec-027ff2717ef4
This makes sure we don't overwrite other fields, such as Admin.
Closes: https://todo.sr.ht/~emersion/soju/85
git-svn-id: file:///srv/svn/repo/suika/trunk@380 f0ae65fe-ee39-954e-97ec-027ff2717ef4
This adds a new flag, `-admin` for creating admin users, which can
access admin service commands, among which create-user to create other
users on-the-fly.
Since the person running the commands in the README will be the local
soju administrator, the user they create should be admin as well, hence
the README update.
git-svn-id: file:///srv/svn/repo/suika/trunk@330 f0ae65fe-ee39-954e-97ec-027ff2717ef4
Reading from stdin with Scanner.Scan() can either fail because of a read
error, or return no bytes because the EOF was reached.
This adds support for checking these cases before actually reading the
password.
git-svn-id: file:///srv/svn/repo/suika/trunk@326 f0ae65fe-ee39-954e-97ec-027ff2717ef4
For Network and Channel, the database only needed to define one Store
operation to create/update a record. However since User is missing an ID
we couldn't have a single StoreUser function like other types. We had
CreateUser and UpdatePassword. As new User fields get added (e.g. the
upcoming Admin flag) this isn't sustainable.
We could have CreateUser and UpdateUser, but this wouldn't be consistent
with other types. Instead, introduce User.Created which indicates
whether the record is already stored in the DB. This can be used in a
new StoreUser function to decide whether we need to UPDATE or INSERT
without relying on SQL constraints and INSERT OR UPDATE.
The ListUsers and GetUser functions set User.Created to true.
git-svn-id: file:///srv/svn/repo/suika/trunk@324 f0ae65fe-ee39-954e-97ec-027ff2717ef4