# `Fun_GetLoginUser` (function) > 获取客户查看权限 - **Type:** FUNCTION - **Returns:** `longtext` - **Deterministic:** NO - **SQL data access:** CONTAINS SQL ## Parameters | # | Mode | Name | Type | |---|---|---|---| | 1 | IN | `sLogin_id` | `varchar(255)` | | 2 | IN | `sBr_id` | `varchar(255)` | | 3 | IN | `sSu_id` | `varchar(255)` | ## Body _Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE FUNCTION `Fun_GetLoginUser`'`._ ## Narrative **Business context:** Login-id resolver. Looks up a user in `sftlogininfo` by either username or sId (`sUserName = sLogin_id OR sId = sLogin_id`) scoped to `(sBrandsId, sSubsidiaryId)`, and returns the canonical `sId`. Used both by the workflow/messaging Java layer to normalize todo-list user ids and by the embedded SQL of the 采购管理 / 生产管理 detail forms. **What it does:** `SELECT sId INTO p_sReturn FROM sftlogininfo WHERE sBrandsId = … AND sSubsidiaryId = … AND (sUserName = sLogin_id OR sId = sLogin_id) LIMIT 1`. Returns the value (or `NULL`). **Invocation:** invoked from `SysWebSocketOffLineMsgServiceImpl` (resolves `todo_user_id` and `copyto_user_id` to user sIds when assembling offline workflow messages); embedded in form-master sSqlStr for 采购申请明细, 采购订单明细, 生产补料明细, 生产领料明细, 生产退料明细 under 采购管理 / 生产管理. Also reused by the workflow `Sp_Apply_Flow_*` and `Sp_Add_Flow` family.