working commit
This commit is contained in:
+1
-1
@@ -24,7 +24,7 @@ func (hand *Handler) BlobExists(rctx *router.Context) {
|
||||
name, _ := rctx.GetSubpath("name")
|
||||
digest, _ := rctx.GetSubpath("digest")
|
||||
|
||||
hand.DumpHeaders("BlobExists", rctx)
|
||||
//hand.DumpHeaders("BlobExists", rctx)
|
||||
|
||||
params := &operator.BlobExistsParams{
|
||||
Name: name,
|
||||
|
||||
@@ -20,7 +20,8 @@ import (
|
||||
func (hand *Handler) GetVersion(rctx *router.Context) {
|
||||
params := &operator.GetVersionParams{}
|
||||
|
||||
hand.DumpHeaders("GetVersion", rctx)
|
||||
//hand.DumpHeaders("GetVersion", rctx)
|
||||
|
||||
authorization := rctx.GetHeader("Authorization")
|
||||
if authorization == "" {
|
||||
rctx.SetHeader("WWW-Authenticate", `Basic realm="mstore"`)
|
||||
|
||||
+32
-4
@@ -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,
|
||||
|
||||
@@ -190,7 +190,7 @@ func (srv *Server) Build() error {
|
||||
}
|
||||
srv.mdb = mdb
|
||||
|
||||
ctx, _ := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
ctx, _ := context.WithTimeout(context.Background(), 10*time.Second)
|
||||
// Created db scheme
|
||||
if !srv.stat.SchemeCreated {
|
||||
srv.logg.Infof("Initialize main database")
|
||||
|
||||
Reference in New Issue
Block a user