新增三库第13号迁移和历史范围回填,保留已删除资源的任务与审计。补充仓储、调用链、身份来源及迁移失败重试回归,同步任务清单、支持矩阵和运维边界。项目成员授权与生产验收仍待完成。
33 lines
918 B
Go
33 lines
918 B
Go
package httpapi
|
|
|
|
import (
|
|
"git.pcux.cn/xuans/Scert/backend/internal/domain"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
// 归属由服务端会话填写,不能从请求体接受操作者或项目授权声明。
|
|
func (s *Server) currentOperatorID(c *gin.Context) string {
|
|
if session, ok := s.currentAuthSession(c); ok {
|
|
return session.UserID
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (s *Server) newResourceScope(c *gin.Context) domain.ResourceScope {
|
|
scope := domain.ResourceScope{ProjectID: domain.DefaultProjectID}
|
|
if session, ok := s.currentAuthSession(c); ok {
|
|
scope.OwnerID = session.UserID
|
|
scope.CreatedBy = session.UserID
|
|
scope.UpdatedBy = session.UserID
|
|
}
|
|
return scope
|
|
}
|
|
|
|
func (s *Server) updatedResourceScope(c *gin.Context, existing domain.ResourceScope) domain.ResourceScope {
|
|
existing.UpdatedBy = ""
|
|
if session, ok := s.currentAuthSession(c); ok {
|
|
existing.UpdatedBy = session.UserID
|
|
}
|
|
return existing.Normalize()
|
|
}
|