diff --git a/service/admin/response.go b/service/admin/response.go index 1b2a8f6..25de571 100644 --- a/service/admin/response.go +++ b/service/admin/response.go @@ -30,6 +30,7 @@ type ListTaskResponse struct { type GetTaskResponse struct { *ent.Task UserHashID string `json:"user_hash_id,omitempty"` + TaskHashID string `json:"task_hash_id,omitempty"` Summary *queue.Summary `json:"summary,omitempty"` Node *ent.Node `json:"node,omitempty"` } diff --git a/service/admin/task.go b/service/admin/task.go index 07c2202..610da41 100644 --- a/service/admin/task.go +++ b/service/admin/task.go @@ -178,6 +178,7 @@ func (s *AdminListService) Tasks(c *gin.Context) (*ListTaskResponse, error) { return GetTaskResponse{ Task: task, + TaskHashID: hashid.EncodeTaskID(hasher, task.ID), UserHashID: uid, Node: node, Summary: summary, @@ -228,6 +229,7 @@ func (s *SingleTaskService) Get(c *gin.Context) (*GetTaskResponse, error) { Summary: summary, Node: node, UserHashID: userHashID, + TaskHashID: hashid.EncodeTaskID(hasher, task.ID), }, nil } diff --git a/service/explorer/workflows.go b/service/explorer/workflows.go index c108754..7d54bfc 100644 --- a/service/explorer/workflows.go +++ b/service/explorer/workflows.go @@ -386,7 +386,7 @@ func TaskPhaseProgress(c *gin.Context, taskID int) (queue.Progresses, error) { u := inventory.UserFromContext(c) r := dep.TaskRegistry() t, found := r.Get(taskID) - if !found || t.Owner().ID != u.ID { + if !found || (t.Owner().ID != u.ID && !u.Edges.Group.Permissions.Enabled(int(types.GroupPermissionIsAdmin))) { return queue.Progresses{}, nil }