feat: 换到 Gin 主流栈并补齐运维能力
HTTP 用 Gin,配置用 Viper,日志用 zap,数据用 sqlx;保留原有接口与会商行为。 顺带补上就绪探活、请求号、滚动日志、systemd 与 Dockerfile。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
0c45b86d67
commit
bd427b57a1
26 files changed
+1213
-302
No files matched your search
@@ -33,6 +33,11 @@ type AccessService struct {
|
||||
AuthEnabled bool
|
||||
}
|
||||
|
||||
// CanMutate 谁可以续跑、改计划、注入。
|
||||
//
|
||||
// 鉴权关闭时一律放行(联调)。打开后:没账号拒绝;管理员、任务责任人角色、作业拥有者、
|
||||
// access.taskOwnerAccountIds / adminAccountIds 里的账号可以改。
|
||||
// 岗位责任人只有绑了席位才能改本场,取消权另见 CanCancel。
|
||||
func (a *AccessService) CanMutate(job *domain.AnalysisJob, c Caller) bool {
|
||||
if !a.AuthEnabled {
|
||||
return true
|
||||
@@ -52,6 +57,8 @@ func (a *AccessService) CanMutate(job *domain.AnalysisJob, c Caller) bool {
|
||||
return c.Role == RolePositionOwner && len(a.boundSeats(job, c.AccountID)) > 0
|
||||
}
|
||||
|
||||
// CanCancel 谁可以取消。岗位责任人默认不能取消,除非他同时是作业拥有者或名单里的任务责任人。
|
||||
// 这条比 CanMutate 更严:席位上的人可以插话,但不能把整场停掉。
|
||||
func (a *AccessService) CanCancel(job *domain.AnalysisJob, c Caller) bool {
|
||||
if c.Role == RolePositionOwner {
|
||||
if c.AccountID == strings.TrimSpace(job.OwnerAccountID) || a.isListedTaskOwner(job, c.AccountID) {
|
||||
@@ -74,6 +81,7 @@ func (a *AccessService) CanCancel(job *domain.AnalysisJob, c Caller) bool {
|
||||
return a.isListedTaskOwner(job, c.AccountID)
|
||||
}
|
||||
|
||||
// CanRead 谁可以看。能改或能取消的人可以看;只绑了席位、没有写权限的账号也可以看(随后会被裁剪)。
|
||||
func (a *AccessService) CanRead(job *domain.AnalysisJob, c Caller) bool {
|
||||
if !a.AuthEnabled {
|
||||
return true
|
||||
|
||||
Reference in new issue
Block a user