(session: SessionDep, current_user: CurrentUser, trans: Trans, statusDto: UserStatus)
| 311 | @clear_cache(namespace=CacheNamespace.AUTH_INFO, cacheName=CacheName.USER_INFO, keyExpression="statusDto.id") |
| 312 | @system_log(LogConfig(operation_type=OperationType.UPDATE_STATUS,module=OperationModules.USER, resource_id_expr="statusDto.id")) |
| 313 | async def statusChange(session: SessionDep, current_user: CurrentUser, trans: Trans, statusDto: UserStatus): |
| 314 | if not current_user.isAdmin: |
| 315 | raise Exception(trans('i18n_permission.no_permission', url = ", ", msg = trans('i18n_permission.only_admin'))) |
| 316 | status = statusDto.status |
| 317 | if status not in [0, 1]: |
| 318 | return {"message": "status not supported"} |
| 319 | db_user: UserModel = get_db_user(session=session, user_id=statusDto.id) |
| 320 | db_user.status = status |
| 321 | session.add(db_user) |
nothing calls this directly
no test coverage detected