feat(admin): enable multi-users (#67)

* feat(userstore): support ListUsers

* feat(userstore): support del users

* feat(multiusers): support list users and delete user apis

* feat(client/web): add new apis to web client

* fix(ui/panes): move each pane out of the container

* feat(ui): add admin pane

* feat(users): support force set password api

* feat(ui/admin-pane): add functions to admin pane

* feat(users): support self API and move uploading folder to home

* fix(users): remove home folder when deleting user

* fix(ui): remove useless function

* feat(ui/panes): hide admin menu if user is not admin

* fix(server/files): list home path is incorrect

* fix(server): 1.listHome return incorrect cwd 2.addUser init folder with incorrect uid 3.check ns before using

* test(server): add regression test cases

* test(users, files): add e2e test for concurrent operations

* fix(test): clean ups
This commit is contained in:
Hexxa 2021-07-30 21:59:33 -05:00 committed by GitHub
parent 916ec7c2dc
commit aefaca98b3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 1562 additions and 478 deletions

View file

@ -72,6 +72,18 @@ func (bp *BoltPvd) DelNamespace(nsName string) error {
})
}
func (bp *BoltPvd) HasNamespace(nsName string) bool {
err := bp.db.View(func(tx *bolt.Tx) error {
b := tx.Bucket([]byte(nsName))
if b == nil {
return ErrBucketNotFound
}
return nil
})
return err == nil
}
func (bp *BoltPvd) Close() error {
return bp.db.Close()
}

View file

@ -8,6 +8,7 @@ var ErrNoLock = errors.New("no lock to unlock")
type IKVStore interface {
AddNamespace(nsName string) error
DelNamespace(nsName string) error
HasNamespace(nsName string) bool
GetBool(key string) (bool, bool)
GetBoolIn(ns, key string) (bool, bool)
SetBool(key string, val bool) error