getMyProcesses actually inspect all processes to find ours
This commit is contained in:
parent
a380ee4f29
commit
239ddae893
@ -1271,11 +1271,31 @@ export default class Services {
|
||||
}
|
||||
}
|
||||
|
||||
async getMyProcesses(): Promise<Set<>> {
|
||||
return this.myProcesses;
|
||||
}
|
||||
async getMyProcesses(): Promise<Set<string>> {
|
||||
try {
|
||||
const processes = await this.getProcesses();
|
||||
const userProcessSet = new Set<string>();
|
||||
|
||||
async getAllProcesses(): Promise<Set<>> {
|
||||
return this.processes;
|
||||
for (const [processId, process] of Object.entries(processes)) {
|
||||
// We use myProcesses attribute to not reevaluate all processes everytime
|
||||
if (this.myProcesses && this.myProcesses.has(processId)) {
|
||||
userProcessSet.add(processId);
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
const roles = await this.getRoles(process);
|
||||
|
||||
if (this.rolesContainsUs(roles)) {
|
||||
this.myProcesses.add(processId);
|
||||
userProcessSet.add(processId);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
return userProcessSet;
|
||||
} catch (e) {
|
||||
console.error("Failed to get processes:", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user