Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions api/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ toolchain go1.26.4

require (
github.com/Jeffail/gabs/v2 v2.7.0
github.com/NethServer/nethsecurity-api v0.0.0-20251002102226-f648b9d1b42b
github.com/Showmax/go-fqdn v1.0.0
github.com/appleboy/gin-jwt/v2 v2.10.3
github.com/appleboy/gin-jwt/v3 v3.5.1
github.com/fatih/structs v1.1.0
github.com/gin-contrib/cors v1.7.7
github.com/gin-contrib/gzip v1.2.6
Expand All @@ -20,7 +18,6 @@ require (
github.com/mattn/go-sqlite3 v1.14.47
github.com/nqd/flat v0.2.0
github.com/oschwald/geoip2-golang v1.13.0
github.com/oschwald/geoip2-golang/v2 v2.0.1
github.com/pquerna/otp v1.5.0
github.com/stretchr/testify v1.11.1
golang.org/x/crypto v0.53.0
Expand All @@ -47,7 +44,6 @@ require (
github.com/jackc/puddle/v2 v2.2.2 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
Expand All @@ -62,12 +58,10 @@ require (
github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 // indirect
go.mongodb.org/mongo-driver/v2 v2.5.0 // indirect
golang.org/x/arch v0.23.0 // indirect
golang.org/x/mod v0.36.0 // indirect
golang.org/x/net v0.55.0 // indirect
golang.org/x/sync v0.21.0 // indirect
golang.org/x/sys v0.46.0 // indirect
golang.org/x/text v0.38.0 // indirect
golang.org/x/tools v0.45.0 // indirect
google.golang.org/protobuf v1.36.11 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
168 changes: 4 additions & 164 deletions api/go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"github.com/gin-contrib/gzip"
"github.com/gin-gonic/gin"

"github.com/NethServer/nethsecurity-api/response"
"github.com/NethServer/nethsecurity-controller/api/response"
"github.com/NethServer/nethsecurity-controller/api/configuration"
"github.com/NethServer/nethsecurity-controller/api/logs"
"github.com/NethServer/nethsecurity-controller/api/methods"
Expand Down
2 changes: 1 addition & 1 deletion api/methods/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"strings"
"time"

"github.com/NethServer/nethsecurity-api/response"
"github.com/NethServer/nethsecurity-controller/api/response"
"github.com/NethServer/nethsecurity-controller/api/configuration"
"github.com/NethServer/nethsecurity-controller/api/models"
"github.com/NethServer/nethsecurity-controller/api/storage"
Expand Down
2 changes: 1 addition & 1 deletion api/methods/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ package methods
import (
"net/http"

"github.com/NethServer/nethsecurity-api/response"
"github.com/NethServer/nethsecurity-controller/api/response"
"github.com/NethServer/nethsecurity-controller/api/configuration"
"github.com/fatih/structs"
"github.com/gin-gonic/gin"
Expand Down
2 changes: 1 addition & 1 deletion api/methods/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"net/http"
"time"

"github.com/NethServer/nethsecurity-api/response"
"github.com/NethServer/nethsecurity-controller/api/response"
"github.com/NethServer/nethsecurity-controller/api/logs"
"github.com/NethServer/nethsecurity-controller/api/models"
"github.com/NethServer/nethsecurity-controller/api/storage"
Expand Down
2 changes: 1 addition & 1 deletion api/methods/unit.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"strings"
"time"

"github.com/NethServer/nethsecurity-api/response"
"github.com/NethServer/nethsecurity-controller/api/response"
"github.com/NethServer/nethsecurity-controller/api/configuration"
"github.com/NethServer/nethsecurity-controller/api/logs"
"github.com/NethServer/nethsecurity-controller/api/models"
Expand Down
4 changes: 2 additions & 2 deletions api/middleware/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import (

jwt "github.com/appleboy/gin-jwt/v2"

"github.com/NethServer/nethsecurity-api/models"
"github.com/NethServer/nethsecurity-api/response"
"github.com/NethServer/nethsecurity-controller/api/models"
"github.com/NethServer/nethsecurity-controller/api/response"
"github.com/NethServer/nethsecurity-controller/api/configuration"
"github.com/NethServer/nethsecurity-controller/api/logs"
"github.com/NethServer/nethsecurity-controller/api/methods"
Expand Down
2 changes: 1 addition & 1 deletion api/middleware/middleware_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/assert"

"github.com/NethServer/nethsecurity-api/models"
"github.com/NethServer/nethsecurity-controller/api/models"
"github.com/NethServer/nethsecurity-controller/api/configuration"
"github.com/NethServer/nethsecurity-controller/api/logs"
"github.com/NethServer/nethsecurity-controller/api/methods"
Expand Down
7 changes: 7 additions & 0 deletions api/models/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,10 @@ type OTPJson struct {
Token string `json:"token" structs:"token"`
OTP string `json:"otp" structs:"otp"`
}

type UserAuthorizations struct {
Username string `json:"username" structs:"username"`
Role string `json:"role" structs:"role"`
Actions []string `json:"actions" structs:"actions"`
SudoRequested bool `json:"sudo_requested" structs:"sudo_requested"`
}
30 changes: 30 additions & 0 deletions api/response/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,33 @@ type StatusNotFound struct {
Message string `json:"message" example:"Not found" structs:"message"`
Data interface{} `json:"data" structs:"data"`
}

type StatusCreated struct {
Code int `json:"code" example:"201" structs:"code"`
Message string `json:"message" example:"Created" structs:"message"`
Data interface{} `json:"data" structs:"data"`
}

type StatusUnauthorized struct {
Code int `json:"code" example:"401" structs:"code"`
Message string `json:"message" example:"Unauthorized" structs:"message"`
Data interface{} `json:"data" structs:"data"`
}

type StatusForbidden struct {
Code int `json:"code" example:"403" structs:"code"`
Message string `json:"message" example:"Forbidden" structs:"message"`
Data interface{} `json:"data" structs:"data"`
}

type StatusConflict struct {
Code int `json:"code" example:"409" structs:"code"`
Message string `json:"message" example:"Not found" structs:"message"`
Data interface{} `json:"data" structs:"data"`
}

type StatusInternalServerError struct {
Code int `json:"code" example:"500" structs:"code"`
Message string `json:"message" example:"Internal server error" structs:"message"`
Data interface{} `json:"data" structs:"data"`
}
Loading