working commit

This commit is contained in:
2026-02-14 22:09:19 +02:00
parent 3b6be8033e
commit 1e03fa349f
7 changed files with 47 additions and 16 deletions
+32 -4
View File
@@ -74,7 +74,6 @@ func (db *Database) WriteAnonymous(ctx context.Context) error {
func (db *Database) WriteInituser(ctx context.Context) error {
var err error
now := auxtool.TimeNow()
passhash := auxpwd.MakeSHA256Hash([]byte(descr.InitUsername))
accountDescr := &descr.Account{
@@ -120,11 +119,11 @@ func (db *Database) WriteInituser(ctx context.Context) error {
if err != nil {
return err
}
// Images
// Accounts
grantDescr = &descr.Grant{
ID: auxuuid.NewUUID(),
AccountID: accountDescr.ID,
Right: descr.RightReadImages,
Right: descr.RightReadAccounts,
Pattern: ",*",
CreatedAt: now,
UpdatedAt: now,
@@ -138,7 +137,36 @@ func (db *Database) WriteInituser(ctx context.Context) error {
grantDescr = &descr.Grant{
ID: auxuuid.NewUUID(),
AccountID: accountDescr.ID,
Right: descr.RightWriteImages,
Right: descr.RightWriteAccounts,
Pattern: ".*",
CreatedAt: now,
UpdatedAt: now,
CreatedBy: descr.ServerID,
UpdatedBy: descr.ServerID,
}
err = db.InsertGrant(ctx, grantDescr)
if err != nil {
return err
}
// Grants
grantDescr = &descr.Grant{
ID: auxuuid.NewUUID(),
AccountID: accountDescr.ID,
Right: descr.RightReadGrants,
Pattern: ",*",
CreatedAt: now,
UpdatedAt: now,
CreatedBy: descr.ServerID,
UpdatedBy: descr.ServerID,
}
err = db.InsertGrant(ctx, grantDescr)
if err != nil {
return err
}
grantDescr = &descr.Grant{
ID: auxuuid.NewUUID(),
AccountID: accountDescr.ID,
Right: descr.RightWriteGrants,
Pattern: ".*",
CreatedAt: now,
UpdatedAt: now,