refactor(core): Ensure getSharedWorkflowIds returns string[] instead of number[] (#4971)
* 🔨 - getSharedWorkflowIds returns string[] * 🔨 - update the sharedWorkflow function in public api * 🔨 - update existing code to handle new data type * simplify code Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
@@ -55,7 +55,7 @@ export class ExecutionsService {
|
||||
* Function to get the workflow Ids for a User
|
||||
* Overridden in EE version to ignore roles
|
||||
*/
|
||||
static async getWorkflowIdsForUser(user: User): Promise<number[]> {
|
||||
static async getWorkflowIdsForUser(user: User): Promise<string[]> {
|
||||
// Get all workflows using owner role
|
||||
return getSharedWorkflowIds(user, ['owner']);
|
||||
}
|
||||
@@ -160,18 +160,16 @@ export class ExecutionsService {
|
||||
}
|
||||
|
||||
// safeguard against querying workflowIds not shared with the user
|
||||
if (filter?.workflowId !== undefined) {
|
||||
const workflowId = parseInt(filter.workflowId.toString());
|
||||
if (workflowId && !sharedWorkflowIds.includes(workflowId)) {
|
||||
LoggerProxy.verbose(
|
||||
`User ${req.user.id} attempted to query non-shared workflow ${workflowId}`,
|
||||
);
|
||||
return {
|
||||
count: 0,
|
||||
estimated: false,
|
||||
results: [],
|
||||
};
|
||||
}
|
||||
const workflowId = filter?.workflowId?.toString();
|
||||
if (workflowId !== undefined && !sharedWorkflowIds.includes(workflowId)) {
|
||||
LoggerProxy.verbose(
|
||||
`User ${req.user.id} attempted to query non-shared workflow ${workflowId}`,
|
||||
);
|
||||
return {
|
||||
count: 0,
|
||||
estimated: false,
|
||||
results: [],
|
||||
};
|
||||
}
|
||||
|
||||
const limit = req.query.limit
|
||||
|
||||
Reference in New Issue
Block a user