feat(mixins/Tasks): inject userId in tasks
This commit is contained in:
@@ -56,9 +56,13 @@ export default class Tasks extends EventEmitter {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
#app
|
||||||
|
|
||||||
constructor(app) {
|
constructor(app) {
|
||||||
super()
|
super()
|
||||||
|
|
||||||
|
this.#app = app
|
||||||
|
|
||||||
app.hooks
|
app.hooks
|
||||||
.on('clean', () => this.#gc(app.config.getOptional('tasks.gc.keep') ?? 1e3))
|
.on('clean', () => this.#gc(app.config.getOptional('tasks.gc.keep') ?? 1e3))
|
||||||
.on('start', async () => {
|
.on('start', async () => {
|
||||||
@@ -131,10 +135,10 @@ export default class Tasks extends EventEmitter {
|
|||||||
*
|
*
|
||||||
* @returns {Task}
|
* @returns {Task}
|
||||||
*/
|
*/
|
||||||
create({ name, objectId, type }) {
|
create({ name, objectId, userId = this.#app.apiContext?.user.id, type }) {
|
||||||
const tasks = this.#tasks
|
const tasks = this.#tasks
|
||||||
|
|
||||||
const task = new Task({ properties: { name, objectId, type }, onProgress: this.#onProgress })
|
const task = new Task({ properties: { name, objectId, userId, type }, onProgress: this.#onProgress })
|
||||||
|
|
||||||
// Use a compact, sortable, string representation of the creation date
|
// Use a compact, sortable, string representation of the creation date
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
<!--packages-start-->
|
<!--packages-start-->
|
||||||
|
|
||||||
- @xen-orchestra/backups patch
|
- @xen-orchestra/backups patch
|
||||||
|
- @xen-orchestra/mixins minor
|
||||||
- xen-api patch
|
- xen-api patch
|
||||||
- xo-server patch
|
- xo-server patch
|
||||||
- xo-server-auth-ldap patch
|
- xo-server-auth-ldap patch
|
||||||
|
|||||||
Reference in New Issue
Block a user