@@ -132,7 +132,7 @@ async def process_data_limit(event: Message, state: FSMContext):
132132
133133
134134@router .message (forms .CreateUser .expire )
135- async def process_expire (event : Message , state : FSMContext , db : AsyncSession ):
135+ async def process_expire (event : Message , state : FSMContext , db : AsyncSession , admin : AdminDetails ):
136136 await delete_messages (event , state )
137137 await add_to_messages_to_delete (state , event )
138138
@@ -153,13 +153,17 @@ async def process_expire(event: Message, state: FSMContext, db: AsyncSession):
153153 else :
154154 await state .update_data (status = UserStatus .active .value )
155155 await state .set_state (forms .CreateUser .group_ids )
156- groups = await group_operations .get_all_groups (db , GroupListQuery ())
156+ groups = await group_operations .get_all_groups (db , GroupListQuery (), admin )
157157 return await event .answer (Texts .select_groups , reply_markup = GroupsSelector (groups ).as_markup ())
158158
159159
160160@router .callback_query (ChooseStatus .Callback .filter ())
161161async def process_status (
162- event : CallbackQuery , db : AsyncSession , state : FSMContext , callback_data : ChooseStatus .Callback
162+ event : CallbackQuery ,
163+ db : AsyncSession ,
164+ state : FSMContext ,
165+ callback_data : ChooseStatus .Callback ,
166+ admin : AdminDetails ,
163167):
164168 await state .update_data (status = callback_data .status )
165169
@@ -172,12 +176,12 @@ async def process_status(
172176 await add_to_messages_to_delete (state , msg )
173177 else :
174178 await state .set_state (forms .CreateUser .group_ids )
175- groups = await group_operations .get_all_groups (db , GroupListQuery ())
179+ groups = await group_operations .get_all_groups (db , GroupListQuery (), admin )
176180 await event .message .answer (Texts .select_groups , reply_markup = GroupsSelector (groups ).as_markup ())
177181
178182
179183@router .message (forms .CreateUser .on_hold_timeout )
180- async def process_on_hold_timeout (event : Message , state : FSMContext , db : AsyncSession ):
184+ async def process_on_hold_timeout (event : Message , state : FSMContext , db : AsyncSession , admin : AdminDetails ):
181185 await delete_messages (event , state )
182186 await add_to_messages_to_delete (state , event )
183187
@@ -191,7 +195,7 @@ async def process_on_hold_timeout(event: Message, state: FSMContext, db: AsyncSe
191195 return
192196
193197 await state .update_data (on_hold_timeout = timeout )
194- groups = await group_operations .get_all_groups (db , GroupListQuery ())
198+ groups = await group_operations .get_all_groups (db , GroupListQuery (), admin )
195199
196200 await add_to_messages_to_delete (state , event )
197201 await delete_messages (event , state )
@@ -201,7 +205,11 @@ async def process_on_hold_timeout(event: Message, state: FSMContext, db: AsyncSe
201205
202206@router .callback_query (GroupsSelector .Callback .filter (SelectGroupAction .select == F .action ))
203207async def select_groups (
204- event : CallbackQuery , db : AsyncSession , state : FSMContext , callback_data : GroupsSelector .Callback
208+ event : CallbackQuery ,
209+ db : AsyncSession ,
210+ state : FSMContext ,
211+ callback_data : GroupsSelector .Callback ,
212+ admin : AdminDetails ,
205213):
206214 group_ids = await state .get_value ("group_ids" )
207215 if isinstance (group_ids , list ):
@@ -213,7 +221,7 @@ async def select_groups(
213221 group_ids = [callback_data .group_id ]
214222
215223 await state .update_data (group_ids = group_ids )
216- all_groups = await group_operations .get_all_groups (db , GroupListQuery ())
224+ all_groups = await group_operations .get_all_groups (db , GroupListQuery (), admin )
217225
218226 await event .message .edit_reply_markup (
219227 reply_markup = GroupsSelector (
@@ -269,7 +277,7 @@ async def modify_groups(
269277 return await event .answer (Texts .user_not_found )
270278
271279 groups = await user_operations .validate_all_groups (db , user )
272- all_groups = await group_operations .get_all_groups (db , GroupListQuery ())
280+ all_groups = await group_operations .get_all_groups (db , GroupListQuery (), admin )
273281 await state .clear ()
274282 await state .update_data (user_id = user .id , group_ids = [group .id for group in groups ])
275283 await event .message .edit_text (
0 commit comments