working commit

This commit is contained in:
2026-02-20 15:33:15 +02:00
parent 09f2125a4e
commit f973293315
18 changed files with 169 additions and 147 deletions
+34 -34
View File
@@ -16,7 +16,7 @@ import (
"mstore/pkg/auxpwd"
"mstore/pkg/auxtool"
"mstore/pkg/descr"
"mstore/pkg/terms"
"mstore/pkg/term"
"mstore/pkg/uuid"
)
@@ -27,14 +27,14 @@ func (db *Database) WriteAnonymous(ctx context.Context) error {
password := auxtool.RandomString(64)
passhash := auxpwd.MakeSHA256Hash([]byte(password))
accountDescr := &descr.Account{
ID: terms.AnonymousID,
Username: terms.AnonimousUsername,
ID: term.AnonymousID,
Username: term.AnonimousUsername,
Passhash: passhash,
Disabled: false,
CreatedAt: now,
UpdatedAt: now,
CreatedBy: terms.ServerID,
UpdatedBy: terms.ServerID,
CreatedBy: term.ServerID,
UpdatedBy: term.ServerID,
}
err = db.InsertAccount(ctx, accountDescr)
if err != nil {
@@ -43,12 +43,12 @@ func (db *Database) WriteAnonymous(ctx context.Context) error {
grantDescr := &descr.Grant{
ID: uuid.NewUUID(),
AccountID: accountDescr.ID,
Right: terms.RightReadFiles,
Right: term.RightReadFiles,
Pattern: ".*",
CreatedAt: now,
UpdatedAt: now,
CreatedBy: terms.ServerID,
UpdatedBy: terms.ServerID,
CreatedBy: term.ServerID,
UpdatedBy: term.ServerID,
}
err = db.InsertGrant(ctx, grantDescr)
if err != nil {
@@ -57,12 +57,12 @@ func (db *Database) WriteAnonymous(ctx context.Context) error {
grantDescr = &descr.Grant{
ID: uuid.NewUUID(),
AccountID: accountDescr.ID,
Right: terms.RightReadImages,
Right: term.RightReadImages,
Pattern: ".*",
CreatedAt: now,
UpdatedAt: now,
CreatedBy: terms.ServerID,
UpdatedBy: terms.ServerID,
CreatedBy: term.ServerID,
UpdatedBy: term.ServerID,
}
err = db.InsertGrant(ctx, grantDescr)
if err != nil {
@@ -76,16 +76,16 @@ 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(terms.InitUsername))
passhash := auxpwd.MakeSHA256Hash([]byte(term.InitUsername))
accountDescr := &descr.Account{
ID: terms.InitID,
Username: terms.InitUsername,
ID: term.InitID,
Username: term.InitUsername,
Passhash: passhash,
Disabled: false,
CreatedAt: now,
UpdatedAt: now,
CreatedBy: terms.ServerID,
UpdatedBy: terms.ServerID,
CreatedBy: term.ServerID,
UpdatedBy: term.ServerID,
}
err = db.InsertAccount(ctx, accountDescr)
if err != nil {
@@ -95,12 +95,12 @@ func (db *Database) WriteInituser(ctx context.Context) error {
grantDescr := &descr.Grant{
ID: uuid.NewUUID(),
AccountID: accountDescr.ID,
Right: terms.RightReadFiles,
Right: term.RightReadFiles,
Pattern: ".*",
CreatedAt: now,
UpdatedAt: now,
CreatedBy: terms.ServerID,
UpdatedBy: terms.ServerID,
CreatedBy: term.ServerID,
UpdatedBy: term.ServerID,
}
err = db.InsertGrant(ctx, grantDescr)
if err != nil {
@@ -109,12 +109,12 @@ func (db *Database) WriteInituser(ctx context.Context) error {
grantDescr = &descr.Grant{
ID: uuid.NewUUID(),
AccountID: accountDescr.ID,
Right: terms.RightWriteFiles,
Right: term.RightWriteFiles,
Pattern: ".*",
CreatedAt: now,
UpdatedAt: now,
CreatedBy: terms.ServerID,
UpdatedBy: terms.ServerID,
CreatedBy: term.ServerID,
UpdatedBy: term.ServerID,
}
err = db.InsertGrant(ctx, grantDescr)
if err != nil {
@@ -124,12 +124,12 @@ func (db *Database) WriteInituser(ctx context.Context) error {
grantDescr = &descr.Grant{
ID: uuid.NewUUID(),
AccountID: accountDescr.ID,
Right: terms.RightReadAccounts,
Right: term.RightReadAccounts,
Pattern: ".*",
CreatedAt: now,
UpdatedAt: now,
CreatedBy: terms.ServerID,
UpdatedBy: terms.ServerID,
CreatedBy: term.ServerID,
UpdatedBy: term.ServerID,
}
err = db.InsertGrant(ctx, grantDescr)
if err != nil {
@@ -138,12 +138,12 @@ func (db *Database) WriteInituser(ctx context.Context) error {
grantDescr = &descr.Grant{
ID: uuid.NewUUID(),
AccountID: accountDescr.ID,
Right: terms.RightWriteAccounts,
Right: term.RightWriteAccounts,
Pattern: ".*",
CreatedAt: now,
UpdatedAt: now,
CreatedBy: terms.ServerID,
UpdatedBy: terms.ServerID,
CreatedBy: term.ServerID,
UpdatedBy: term.ServerID,
}
err = db.InsertGrant(ctx, grantDescr)
if err != nil {
@@ -153,12 +153,12 @@ func (db *Database) WriteInituser(ctx context.Context) error {
grantDescr = &descr.Grant{
ID: uuid.NewUUID(),
AccountID: accountDescr.ID,
Right: terms.RightReadImages,
Right: term.RightReadImages,
Pattern: ".*",
CreatedAt: now,
UpdatedAt: now,
CreatedBy: terms.ServerID,
UpdatedBy: terms.ServerID,
CreatedBy: term.ServerID,
UpdatedBy: term.ServerID,
}
err = db.InsertGrant(ctx, grantDescr)
if err != nil {
@@ -167,12 +167,12 @@ func (db *Database) WriteInituser(ctx context.Context) error {
grantDescr = &descr.Grant{
ID: uuid.NewUUID(),
AccountID: accountDescr.ID,
Right: terms.RightWriteImages,
Right: term.RightWriteImages,
Pattern: ".*",
CreatedAt: now,
UpdatedAt: now,
CreatedBy: terms.ServerID,
UpdatedBy: terms.ServerID,
CreatedBy: term.ServerID,
UpdatedBy: term.ServerID,
}
err = db.InsertGrant(ctx, grantDescr)
if err != nil {