初始化
This commit is contained in:
60
server/dto/permission_dto.go
Normal file
60
server/dto/permission_dto.go
Normal file
@@ -0,0 +1,60 @@
|
||||
package dto
|
||||
|
||||
// RoleCreateRequest 创建角色请求
|
||||
type RoleCreateRequest struct {
|
||||
Name string `json:"name" binding:"required,max=64"` // 角色标识
|
||||
DisplayName string `json:"display_name" binding:"required,max=64"` // 显示名称
|
||||
Description string `json:"description" binding:"max=256"` // 描述
|
||||
}
|
||||
|
||||
// RoleUpdateRequest 更新角色请求
|
||||
type RoleUpdateRequest struct {
|
||||
DisplayName string `json:"display_name" binding:"required,max=64"`
|
||||
Description string `json:"description" binding:"max=256"`
|
||||
}
|
||||
|
||||
// RoleVO 角色视图对象
|
||||
type RoleVO struct {
|
||||
ID uint64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
DisplayName string `json:"display_name"`
|
||||
Description string `json:"description"`
|
||||
IsSystem int8 `json:"is_system"`
|
||||
Status int8 `json:"status"`
|
||||
Permissions []PermissionVO `json:"permissions,omitempty"`
|
||||
}
|
||||
|
||||
// PermissionCreateRequest 创建权限请求
|
||||
type PermissionCreateRequest struct {
|
||||
Code string `json:"code" binding:"required,max=64"` // 权限标识: file:upload
|
||||
Name string `json:"name" binding:"required,max=64"` // 显示名称
|
||||
Resource string `json:"resource" binding:"required"` // 资源类型
|
||||
Action string `json:"action" binding:"required"` // 操作类型
|
||||
Description string `json:"description" binding:"max=256"`
|
||||
}
|
||||
|
||||
// PermissionVO 权限视图对象
|
||||
type PermissionVO struct {
|
||||
ID uint64 `json:"id"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Resource string `json:"resource"`
|
||||
Action string `json:"action"`
|
||||
Description string `json:"description"`
|
||||
}
|
||||
|
||||
// SetRolePermissionsRequest 设置角色权限请求
|
||||
type SetRolePermissionsRequest struct {
|
||||
PermissionIDs []uint64 `json:"permission_ids" binding:"required"` // 权限ID列表
|
||||
}
|
||||
|
||||
// SetUserRolesRequest 设置用户角色请求
|
||||
type SetUserRolesRequest struct {
|
||||
RoleIDs []uint64 `json:"role_ids" binding:"required"` // 角色ID列表
|
||||
}
|
||||
|
||||
// UserPermissionVO 用户权限视图对象
|
||||
type UserPermissionVO struct {
|
||||
Roles []RoleVO `json:"roles"` // 用户角色列表
|
||||
Permissions []string `json:"permissions"` // 权限标识列表
|
||||
}
|
||||
Reference in New Issue
Block a user