13 Commits

Author SHA1 Message Date
contact
ef39ddf576 sojuctl: use background context
git-svn-id: file:///srv/svn/repo/suika/trunk@695 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-11-17 10:54:28 +00:00
contact
2748715183 Add context args to Database interface
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
2021-10-18 17:15:15 +00:00
hubert
bbe15df672 PostgreSQL support
git-svn-id: file:///srv/svn/repo/suika/trunk@620 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-10-11 13:21:04 +00:00
sir
2f5c2a2edd db: refactor into interface
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
2021-05-25 14:35:39 +00:00
contact
01b94a7327 sojuctl: don't use log.Fatalf in readPassword
git-svn-id: file:///srv/svn/repo/suika/trunk@503 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-04-19 12:11:25 +00:00
coder.kalyan
a17298eb3e sojuctl: change-password: check if user exists
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
2020-11-26 18:27:08 +00:00
contact
d000ec491a cmd/sojuctl: read user from DB before updating it
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
2020-08-11 08:21:49 +00:00
delthas
535e85051f sojuctl: Add support for creating admin users
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
2020-06-08 20:30:09 +00:00
delthas
7f49fa7971 Fix: Check the stdin scanner for errors when reading the password
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
2020-06-08 20:30:09 +00:00
contact
7c4131cbdb Introduce User.Created
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
2020-06-08 09:59:03 +00:00
admin
1f83ec54b1 Allow to read password when stdin is not a tty.
git-svn-id: file:///srv/svn/repo/suika/trunk@308 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-06-03 13:51:56 +00:00
admin
88284aa7de Add ability to change password
git-svn-id: file:///srv/svn/repo/suika/trunk@251 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-04-10 08:09:02 +00:00
contact
1a9d6a58a0 Rename project to soju
git-svn-id: file:///srv/svn/repo/suika/trunk@98 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-03-13 17:13:03 +00:00