AS AgentScopeAPI 手册 / API Reference

UserRecord

@JsonIgnoreProperties(ignoreUnknown = true) record UserRecord(String userId, String username, String passwordHash, List<String> roles)
源码Source io/agentscope/builder/web/auth/UserStore.java:79–84

可 JSON 序列化的用户。位于 io.agentscope.builder.web.auth 包。核心成员包括 userId、username、passwordHash、roles、hasRole。

JSON-serializable user record.

记录组件摘要Record Component Summary

组件Component类型Type说明Description
userIdString
执行用户标识相关操作。
stable unique identifier (used as HarnessAgent namespace key)
usernameString
执行 `username` 方法。
display name
passwordHashString
执行 `passwordHash` 方法。
BCrypt hash
rolesList<String>
执行 `roles` 方法。
list of role strings (e.g. `["user"]`, `["user","admin"]`)

方法摘要Method Summary

方法Method说明Description
public boolean hasRole(String role)
判断是否具有角色。
Returns whether this has the role.

记录组件详情Record Component Detail

userId

String userId

执行用户标识相关操作。

stable unique identifier (used as HarnessAgent namespace key)

源码Source io/agentscope/builder/web/auth/UserStore.java:79–84

username

String username

执行 username 方法。

display name

源码Source io/agentscope/builder/web/auth/UserStore.java:79–84

passwordHash

String passwordHash

执行 passwordHash 方法。

BCrypt hash

源码Source io/agentscope/builder/web/auth/UserStore.java:79–84

roles

List<String> roles

执行 roles 方法。

list of role strings (e.g. ["user"], ["user","admin"])

源码Source io/agentscope/builder/web/auth/UserStore.java:79–84

方法详情Method Detail

hasRole

public boolean hasRole(String role)

判断是否具有角色。

Returns whether this has the role.

参数Parameters
名称Name类型Type说明Description
roleString角色(类型 `String`)。The role.
返回Returns boolean
返回布尔值,表示判断结果。Returns a boolean result.
源码Source io/agentscope/builder/web/auth/UserStore.java:81–83
基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.