| 
														
															@@ -57,7 +57,15 @@ export default class GetModelPermissions extends DataModuleJob { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		if (modelId && !model) throw new Error("Model not found"); 
														 | 
														
														 | 
														
															 		if (modelId && !model) throw new Error("Model not found"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-		const jobs = (await forEachIn( 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		const modelPermissions = Object.fromEntries( 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+			Object.entries(permissions).filter( 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+				([permission]) => 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+					permission.startsWith(`data.${modelName}.`) || 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+					permission.startsWith(`event.data.${modelName}.`) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+			) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		await forEachIn( 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			Object.entries( 
														 | 
														
														 | 
														
															 			Object.entries( 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 				ModuleManager.getModule("data")?.getJobs() ?? {} 
														 | 
														
														 | 
														
															 				ModuleManager.getModule("data")?.getJobs() ?? {} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			).filter( 
														 | 
														
														 | 
														
															 			).filter( 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -75,17 +83,19 @@ export default class GetModelPermissions extends DataModuleJob { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 						permissions[`${jobName}.*`] || 
														 | 
														
														 | 
														
															 						permissions[`${jobName}.*`] || 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 						permissions[`${jobName}.${modelId}`]; 
														 | 
														
														 | 
														
															 						permissions[`${jobName}.${modelId}`]; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-				if (hasPermission) return [jobName, true]; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+				if (hasPermission) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+					modelPermissions[jobName] = true; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+					return; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+				} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 				if (typeof Job.hasPermission === "function") { 
														 | 
														
														 | 
														
															 				if (typeof Job.hasPermission === "function") { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 					hasPermission = await Job.hasPermission(model, user); 
														 | 
														
														 | 
														
															 					hasPermission = await Job.hasPermission(model, user); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 				} 
														 | 
														
														 | 
														
															 				} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-				return [jobName, !!hasPermission]; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+				modelPermissions[jobName] = !!hasPermission; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			} 
														 | 
														
														 | 
														
															 			} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-		)) as [string, boolean][]; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-		const modelPermissions = Object.fromEntries(jobs); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		await CacheModule.set(cacheKey, modelPermissions, 360); 
														 | 
														
														 | 
														
															 		await CacheModule.set(cacheKey, modelPermissions, 360); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 |