feat: Add authorizedExecutions to user model

This commit is contained in:
Faruk AYDIN
2024-03-03 18:51:50 +01:00
parent 92665d80d6
commit 6236ee8f6d

View File

@@ -149,6 +149,13 @@ class User extends Base {
return conditions.isCreator ? this.$relatedQuery('flows') : Flow.query();
}
get authorizedExecutions() {
const conditions = this.can('read', 'Execution');
return conditions.isCreator
? this.$relatedQuery('executions')
: Execution.query();
}
login(password) {
return bcrypt.compare(password, this.password);
}