|
|
|
@ -68,6 +68,7 @@ type writestore interface { |
|
|
|
|
GetTemporaryAccessToken(userID int64, validSecs int) (string, error) |
|
|
|
|
GetTemporaryOneTimeAccessToken(userID int64, validSecs int, oneTime bool) (string, error) |
|
|
|
|
DeleteAccount(userID int64) error |
|
|
|
|
SilenceAccount(userID int64) error |
|
|
|
|
ChangeSettings(app *App, u *User, s *userSettings) error |
|
|
|
|
ChangePassphrase(userID int64, sudo bool, curPass string, hashedPass []byte) error |
|
|
|
|
|
|
|
|
@ -2329,6 +2330,33 @@ func (db *datastore) DeleteAccount(userID int64) error { |
|
|
|
|
return nil |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (db *datastore) SilenceAccount(userID int64) error { |
|
|
|
|
// Start transaction
|
|
|
|
|
t, err := db.Begin() |
|
|
|
|
if err != nil { |
|
|
|
|
log.Error("Unable to begin: %v", err) |
|
|
|
|
return err |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Update user state
|
|
|
|
|
_, err = t.Exec("UPDATE users SET state=1 WHERE id=?", userID) |
|
|
|
|
if err != nil { |
|
|
|
|
t.Rollback() |
|
|
|
|
return fmt.Errorf("Unable to update user state: %s", err) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Commit all changes to the database
|
|
|
|
|
err = t.Commit() |
|
|
|
|
if err != nil { |
|
|
|
|
t.Rollback() |
|
|
|
|
log.Error("Unable to commit: %v", err) |
|
|
|
|
return err |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// TODO: federate delete actor here too?
|
|
|
|
|
return nil |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (db *datastore) GetAPActorKeys(collectionID int64) ([]byte, []byte) { |
|
|
|
|
var pub, priv []byte |
|
|
|
|
err := db.QueryRow("SELECT public_key, private_key FROM collectionkeys WHERE collection_id = ?", collectionID).Scan(&pub, &priv) |
|
|
|
|