mirror of
https://github.com/IceWhaleTech/CasaOS.git
synced 2025-11-06 22:59:44 +00:00
get samba users
This commit is contained in:
parent
85a72a6a15
commit
873e2a5ac7
@ -176,6 +176,11 @@ func InitV1Router() http.Handler {
|
|||||||
v1SharesGroup.DELETE("/:id", v1.DeleteSambaShares)
|
v1SharesGroup.DELETE("/:id", v1.DeleteSambaShares)
|
||||||
v1SharesGroup.GET("/status", v1.GetSambaStatus)
|
v1SharesGroup.GET("/status", v1.GetSambaStatus)
|
||||||
}
|
}
|
||||||
|
v1SharesGroup := v1SambaGroup.Group("/users")
|
||||||
|
v1SharesGroup.Use()
|
||||||
|
{
|
||||||
|
v1SharesGroup.GET("", v1.ListSambaUsers)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
v1NotifyGroup := v1Group.Group("/notify")
|
v1NotifyGroup := v1Group.Group("/notify")
|
||||||
v1NotifyGroup.Use()
|
v1NotifyGroup.Use()
|
||||||
|
|||||||
@ -17,6 +17,8 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
"os/exec"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/IceWhaleTech/CasaOS-Common/utils/logger"
|
"github.com/IceWhaleTech/CasaOS-Common/utils/logger"
|
||||||
"github.com/IceWhaleTech/CasaOS-Common/utils/systemctl"
|
"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})
|
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 {
|
func PostSambaSharesCreate(ctx echo.Context) error {
|
||||||
shares := []model.Shares{}
|
shares := []model.Shares{}
|
||||||
ctx.Bind(&shares)
|
ctx.Bind(&shares)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user