forked from lucasdillmann/nginx-ignition
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathroutes.go
More file actions
24 lines (20 loc) · 769 Bytes
/
Copy pathroutes.go
File metadata and controls
24 lines (20 loc) · 769 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package access_list
import (
"github.com/gin-gonic/gin"
"dillmann.com.br/nginx-ignition/api/common/authorization"
"dillmann.com.br/nginx-ignition/core/access_list"
"dillmann.com.br/nginx-ignition/core/user"
)
func Install(router *gin.Engine, commands *access_list.Commands, authorizer *authorization.ABAC) {
basePath := authorizer.ConfigureGroup(
router,
"/api/access-lists",
func(permissions user.Permissions) user.AccessLevel { return permissions.AccessLists },
)
basePath.GET("", listHandler{commands}.handle)
basePath.POST("", createHandler{commands}.handle)
byIdPath := basePath.Group("/:id")
byIdPath.GET("", getHandler{commands}.handle)
byIdPath.PUT("", updateHandler{commands}.handle)
byIdPath.DELETE("", deleteHandler{commands}.handle)
}