mirror of
https://github.com/IceWhaleTech/CasaOS.git
synced 2025-09-18 01:25:54 +00:00
get samba users
This commit is contained in:
parent
00e17b5b6c
commit
9e7619b481
@ -176,6 +176,11 @@ func InitV1Router() http.Handler {
|
||||
v1SharesGroup.DELETE("/:id", v1.DeleteSambaShares)
|
||||
v1SharesGroup.GET("/status", v1.GetSambaStatus)
|
||||
}
|
||||
v1SharesGroup := v1SambaGroup.Group("/users")
|
||||
v1SharesGroup.Use()
|
||||
{
|
||||
v1SharesGroup.GET("", v1.ListSambaUsers)
|
||||
}
|
||||
}
|
||||
v1NotifyGroup := v1Group.Group("/notify")
|
||||
v1NotifyGroup.Use()
|
||||
|
@ -17,6 +17,8 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"os/exec"
|
||||
"strings"
|
||||
|
||||
"github.com/IceWhaleTech/CasaOS-Common/utils/logger"
|
||||
"github.com/IceWhaleTech/CasaOS-Common/utils/systemctl"
|
||||
@ -67,6 +69,18 @@ func GetSambaSharesList(ctx echo.Context) error {
|
||||
return ctx.JSON(common_err.SUCCESS, model.Result{Success: common_err.SUCCESS, Message: common_err.GetMsg(common_err.SUCCESS), Data: shareList})
|
||||
}
|
||||
|
||||
func ListSambaUsers(ctx echo.Context) error {
|
||||
out, err := exec.Command("pdbedit -L").Output()
|
||||
|
||||
if err != nil {
|
||||
return ctx.JSON(common_err.SERVICE_ERROR, model.Result{Success: common_err.Failed, Message: common_err.GetMsg(common_err.Failed)})
|
||||
}
|
||||
|
||||
users := strings.Split("\n")
|
||||
|
||||
return ctx.JSON(common_err.SUCCESS, model.Result{Success: common_err.SUCCESS, Message: common_err.GetMsg(common_err.SUCCESS), Data: users})
|
||||
}
|
||||
|
||||
func PostSambaSharesCreate(ctx echo.Context) error {
|
||||
shares := []model.Shares{}
|
||||
ctx.Bind(&shares)
|
||||
|
Loading…
x
Reference in New Issue
Block a user