MCPcopy Index your code
hub / github.com/dataease/SQLBot / statusChange

Function statusChange

backend/apps/system/api/user.py:313–321  ·  view source on GitHub ↗
(session: SessionDep, current_user: CurrentUser, trans: Trans, statusDto: UserStatus)

Source from the content-addressed store, hash-verified

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"))
313async 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)

Callers

nothing calls this directly

Calls 2

get_db_userFunction · 0.90
addMethod · 0.65

Tested by

no test coverage detected