@@ -168,6 +168,14 @@ async def create_new_prompt(
168168 detail = ERROR_MESSAGES .UNAUTHORIZED ,
169169 )
170170
171+ form_data .access_grants = filter_allowed_access_grants (
172+ request .app .state .config .USER_PERMISSIONS ,
173+ user .id ,
174+ user .role ,
175+ form_data .access_grants ,
176+ 'sharing.public_prompts' ,
177+ )
178+
171179 prompt = Prompts .get_prompt_by_command (form_data .command , db = db )
172180 if prompt is None :
173181 prompt = Prompts .insert_new_prompt (user .id , form_data , db = db )
@@ -275,6 +283,7 @@ async def get_prompt_by_id(prompt_id: str, user=Depends(get_verified_user), db:
275283
276284@router .post ('/id/{prompt_id}/update' , response_model = Optional [PromptModel ])
277285async def update_prompt_by_id (
286+ request : Request ,
278287 prompt_id : str ,
279288 form_data : PromptForm ,
280289 user = Depends (get_verified_user ),
@@ -314,6 +323,14 @@ async def update_prompt_by_id(
314323 detail = f"Command '/{ form_data .command } ' is already in use by another prompt" ,
315324 )
316325
326+ form_data .access_grants = filter_allowed_access_grants (
327+ request .app .state .config .USER_PERMISSIONS ,
328+ user .id ,
329+ user .role ,
330+ form_data .access_grants ,
331+ 'sharing.public_prompts' ,
332+ )
333+
317334 # Use the ID from the found prompt
318335 updated_prompt = Prompts .update_prompt_by_id (prompt .id , form_data , user .id , db = db )
319336 if updated_prompt :
0 commit comments