| 
									
										
										
										
											2020-06-24 14:09:43 +02:00
										 |  |  | 'use strict'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | module.exports = { | 
					
						
							|  |  |  |   conditions: [ | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2020-06-29 14:45:41 +02:00
										 |  |  |       displayName: 'Is creator', | 
					
						
							| 
									
										
										
										
											2020-06-24 14:09:43 +02:00
										 |  |  |       name: 'is-creator', | 
					
						
							|  |  |  |       plugin: 'admin', | 
					
						
							| 
									
										
										
										
											2022-08-08 23:33:39 +02:00
										 |  |  |       handler: (user) => ({ 'createdBy.id': user.id }), | 
					
						
							| 
									
										
										
										
											2020-06-29 14:45:41 +02:00
										 |  |  |     }, | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |       displayName: 'Has same role as creator', | 
					
						
							|  |  |  |       name: 'has-same-role-as-creator', | 
					
						
							|  |  |  |       plugin: 'admin', | 
					
						
							| 
									
										
										
										
											2022-08-08 23:33:39 +02:00
										 |  |  |       handler: (user) => ({ | 
					
						
							| 
									
										
										
										
											2021-09-22 17:04:57 +02:00
										 |  |  |         'createdBy.roles': { | 
					
						
							| 
									
										
										
										
											2020-06-29 14:45:41 +02:00
										 |  |  |           $elemMatch: { | 
					
						
							|  |  |  |             id: { | 
					
						
							| 
									
										
										
										
											2022-08-08 23:33:39 +02:00
										 |  |  |               $in: user.roles.map((r) => r.id), | 
					
						
							| 
									
										
										
										
											2020-06-29 14:45:41 +02:00
										 |  |  |             }, | 
					
						
							|  |  |  |           }, | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |       }), | 
					
						
							| 
									
										
										
										
											2020-06-24 14:09:43 +02:00
										 |  |  |     }, | 
					
						
							|  |  |  |   ], | 
					
						
							|  |  |  | }; |