mirror of
				https://gitlab.com/comunic/comunicapiv2
				synced 2025-11-04 11:34:04 +00:00 
			
		
		
		
	Can reuse function for multiple levels
This commit is contained in:
		@@ -314,10 +314,10 @@ export class RequestHandler {
 | 
				
			|||||||
	 * 
 | 
						 * 
 | 
				
			||||||
	 * @param name The name of the POST field containing the ID of the target post
 | 
						 * @param name The name of the POST field containing the ID of the target post
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	public async postPostIDWithAccess(name: string) : Promise<number> {
 | 
						public async postPostIDWithAccess(name: string, minLevel: PostAccessLevel = PostAccessLevel.BASIC_ACCESS) : Promise<number> {
 | 
				
			||||||
		const postID = await this.postPostID(name);
 | 
							const postID = await this.postPostID(name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if(await PostsHelper.GetAccessLevelFromPostID(this.optionnalUserID, postID) == PostAccessLevel.NO_ACCESS)
 | 
							if(await PostsHelper.GetAccessLevelFromPostID(this.optionnalUserID, postID) < minLevel)
 | 
				
			||||||
			this.error(401, "Your are not allowed to access this post information!");
 | 
								this.error(401, "Your are not allowed to access this post information!");
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		return postID;
 | 
							return postID;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user