(ctx context.Context, arg database.UpdateTaskWorkspaceIDParams)
| 7216 | } |
| 7217 | |
| 7218 | func (q *querier) UpdateTaskWorkspaceID(ctx context.Context, arg database.UpdateTaskWorkspaceIDParams) (database.TaskTable, error) { |
| 7219 | // An actor is allowed to update the workspace ID of a task if they are the |
| 7220 | // owner of the task and workspace or have the appropriate permissions. |
| 7221 | task, err := q.db.GetTaskByID(ctx, arg.ID) |
| 7222 | if err != nil { |
| 7223 | return database.TaskTable{}, err |
| 7224 | } |
| 7225 | |
| 7226 | if err := q.authorizeContext(ctx, policy.ActionUpdate, task.RBACObject()); err != nil { |
| 7227 | return database.TaskTable{}, err |
| 7228 | } |
| 7229 | |
| 7230 | ws, err := q.db.GetWorkspaceByID(ctx, arg.WorkspaceID.UUID) |
| 7231 | if err != nil { |
| 7232 | return database.TaskTable{}, err |
| 7233 | } |
| 7234 | |
| 7235 | if err := q.authorizeContext(ctx, policy.ActionUpdate, ws.RBACObject()); err != nil { |
| 7236 | return database.TaskTable{}, err |
| 7237 | } |
| 7238 | |
| 7239 | return q.db.UpdateTaskWorkspaceID(ctx, arg) |
| 7240 | } |
| 7241 | |
| 7242 | func (q *querier) UpdateTemplateACLByID(ctx context.Context, arg database.UpdateTemplateACLByIDParams) error { |
| 7243 | fetch := func(ctx context.Context, arg database.UpdateTemplateACLByIDParams) (database.Template, error) { |
nothing calls this directly
no test coverage detected