mirror of https://github.com/veypi/OneAuth.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
804 B
Go
26 lines
804 B
Go
|
1 week ago
|
//
|
||
|
|
// Copyright (C) 2024 veypi <i@veypi.com>
|
||
|
|
// 2025-03-04 16:08:06
|
||
|
|
// Distributed under terms of the MIT license.
|
||
|
|
//
|
||
|
|
|
||
|
|
package policy
|
||
|
|
|
||
|
|
import (
|
||
|
|
"github.com/veypi/vbase/api/middleware"
|
||
|
|
"github.com/veypi/vigo"
|
||
|
|
)
|
||
|
|
|
||
|
|
var Router = vigo.NewRouter()
|
||
|
|
|
||
|
|
func init() {
|
||
|
|
// 列表和详情 - 需要读取权限
|
||
|
|
Router.Get("/", middleware.Permission("policy", "list"), "策略列表", list)
|
||
|
|
Router.Get("/{policy_id}", middleware.Permission("policy", "read"), "获取策略详情", get)
|
||
|
|
|
||
|
|
// 创建、更新、删除 - 需要管理权限
|
||
|
|
Router.Post("/", middleware.Permission("policy", "create"), "创建策略", create)
|
||
|
|
Router.Patch("/{policy_id}", middleware.Permission("policy", "update"), "更新策略", patch)
|
||
|
|
Router.Delete("/{policy_id}", middleware.Permission("policy", "delete"), "删除策略", del)
|
||
|
|
}
|