跳到主要内容

import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';

用户资源

用户资源用于管理 BMC 本地账号、角色权限和密码策略。

认证与权限

本页接口支持 HTTP Basic Auth 和会话 Token。Token 通过请求头 X-Xsrf-Token 携带。查询或管理其他账号时,当前用户通常需要 ConfigureUsers 权限。

1 角色管理资源

当前实现使用账号的 Role 字段区分角色,并通过 /Privileges 资源查询或配置具体权限。

Roles 资源当前不可用

/redfish/v1/AccountService 响应中包含 /redfish/v1/AccountService/Roles/redfish/v1/AccountService/PrivilegeMap 链接,但当前后端没有注册这两组路由。实机请求会返回 404 page not found,客户端不应继续跟随这两个链接。

1.1 查询角色可用权限

查询 AdministratorCommonUser 角色可配置的权限参数。管理员角色返回功能权限,普通用户角色返回可访问的板卡核心 ID。

项目内容
方法GET
路径/redfish/v1/AccountService/Privileges/Help
认证HTTP Basic Auth 或 X-Xsrf-Token
请求体
成功状态码200 OK

<Tabs defaultValue="basic-auth" values={[{"label": "Basic Auth", "value": "basic-auth"}, {"label": "Token", "value": "token"}]}>

查询角色可用权限
curl --user '<username>:<password>' \
--header 'Accept: application/json' \
'<protocol>://<device-ip>:<port>/redfish/v1/AccountService/Privileges/Help'
使用 Token 查询角色可用权限
curl --header 'X-Xsrf-Token: <token>' \
--header 'Accept: application/json' \
'<protocol>://<device-ip>:<port>/redfish/v1/AccountService/Privileges/Help'

响应示例

200 OK·结构示例
{
"Parameters": {
"Administrator": [
"Login",
"ConfigureComponents",
"ConfigureSelf",
"ConfigureUsers",
"OemConfigureRemote",
"OemConfigureNetwork",
"OemConfigureFirewall",
"OemPowerControl",
"OemUpgrade",
"OemDebug",
"OemConfigureNtp"
],
"CommonUser": [
"<core-id>"
]
}
}

响应字段

字段类型说明
Parametersobject按角色分类的可用权限。
Parameters.Administratorarray管理员可配置的功能权限字符串列表。
Parameters.CommonUserarray当前设备上可分配给普通用户的板卡核心 ID 列表。

1.2 查询账号权限合集

项目内容
方法GET
路径/redfish/v1/AccountService/Privileges
成功状态码200 OK
使用 Token 查询账号权限合集
curl --header 'X-Xsrf-Token: <token>' \
--header 'Accept: application/json' \
'<protocol>://<device-ip>:<port>/redfish/v1/AccountService/Privileges'

响应示例

200 OK
{
"@odata.context": "/redfish/v1/$metadata#ManagerPrivilegeCollection.ManagerPrivilegeCollection",
"@odata.id": "/redfish/v1/AccountService/Privileges",
"@odata.type": "#ManagerPrivilegeCollection.ManagerPrivilegeCollection",
"Members": [
{
"@odata.id": "/redfish/v1/AccountService/Privileges/admin"
}
],
"Members@odata.count": 1,
"Name": "Privilege Collection"
}

响应字段

字段类型说明
@odata.contextstring权限合集的 OData 元数据上下文。
@odata.idstring权限合集路径。
@odata.typestring权限合集类型。
Membersarray账号权限资源链接列表。
Members[].@odata.idstring指定账号的权限资源路径。
Members@odata.countinteger权限资源数量。
Namestring权限合集名称。

1.3 查询指定账号权限

项目内容
方法GET
路径/redfish/v1/AccountService/Privileges/{account-id}
路径参数account-id,账号名
成功状态码200 OK
使用 Token 查询指定账号权限
curl --header 'X-Xsrf-Token: <token>' \
--header 'Accept: application/json' \
'<protocol>://<device-ip>:<port>/redfish/v1/AccountService/Privileges/<account-id>'

响应示例

200 OK·Administrator
{
"@odata.context": "/redfish/v1/$metadata#ManagerPrivilege.ManagerPrivilege",
"@odata.id": "/redfish/v1/AccountService/Privileges/<account-id>",
"@odata.type": "#ManagerPrivilege.v1_0_0.ManagerPrivilege",
"AssignedPrivileges": [
"Login",
"ConfigureSelf",
"ConfigureUsers"
],
"Description": "Privilege",
"Name": "Privilege",
"Oem": {
"Firefly": {
"Role": "Administrator",
"UserName": "<account-id>"
}
}
}

响应字段

字段类型说明
@odata.contextstring账号权限资源的 OData 上下文。
@odata.idstring当前账号权限资源路径。
@odata.typestring账号权限资源类型。
AssignedPrivilegesarray | null已分配权限。Administrator 返回功能权限,CommonUser 返回板卡核心 ID,未分配时可为 null
Descriptionstring资源描述。
Namestring资源名称。
OemobjectOEM 扩展信息。
Oem.FireflyobjectFirefly 账号权限信息。
Oem.Firefly.Rolestring账号角色。
Oem.Firefly.UserNamestring账号名。

1.4 配置指定账号权限

Administrator 账号传入功能权限列表;CommonUser 账号传入板卡核心 ID 列表。请先调用 1.1 获取当前可用值。

项目内容
方法PATCH
路径/redfish/v1/AccountService/Privileges/{account-id}
请求体JSON 字符串数组
成功状态码200 OK
使用 Token 配置普通用户可访问板卡
curl --request PATCH \
--header 'X-Xsrf-Token: <token>' \
--header 'Content-Type: application/json' \
--data '["<core-id>"]' \
'<protocol>://<device-ip>:<port>/redfish/v1/AccountService/Privileges/<account-id>'

请求字段

字段类型必填说明
请求体array权限字符串列表。数组元素必须来自 1.1 返回的对应角色列表。

响应示例

200 OK
{
"@odata.type": "#Message.v1_1_1.Message",
"Timestamp": "1785836138",
"MessageId": "Base.1.11.0.Success",
"Message": "The request completed successfully.",
"MessageArgs": [],
"MessageSeverity": "OK",
"Severity": "",
"Oem": null,
"RelatedProperties": null,
"Resolution": "None"
}

响应字段

字段类型说明
@odata.typestringRedfish Message 类型。
Timestampstring服务端生成消息时的时间戳字符串。
MessageIdstring消息标识;成功时为 Base.1.11.0.Success
Messagestring操作结果描述。
MessageArgsarray消息格式化参数;成功时为空数组。
MessageSeveritystring消息严重程度;成功时为 OK
Severitystring兼容严重程度字段。
Oemobject | nullOEM 扩展信息。
RelatedPropertiesarray | null与消息相关的资源属性。
Resolutionstring后续处理建议。

2 账号管理资源

2.1 查询账号合集

项目内容
方法GET
路径/redfish/v1/AccountService/Accounts
成功状态码200 OK

<Tabs defaultValue="basic-auth" values={[{"label": "Basic Auth", "value": "basic-auth"}, {"label": "Token", "value": "token"}]}>

查询账号合集
curl --user '<username>:<password>' \
--header 'Accept: application/json' \
'<protocol>://<device-ip>:<port>/redfish/v1/AccountService/Accounts'
使用 Token 查询账号合集
curl --header 'X-Xsrf-Token: <token>' \
--header 'Accept: application/json' \
'<protocol>://<device-ip>:<port>/redfish/v1/AccountService/Accounts'

响应示例

200 OK
{
"@odata.context": "/redfish/v1/$metadata#ManagerAccountCollection.ManagerAccountCollection",
"@odata.id": "/redfish/v1/AccountService/Accounts",
"@odata.type": "#ManagerAccountCollection.ManagerAccountCollection",
"Members": [
{
"@odata.id": "/redfish/v1/AccountService/Accounts/admin"
}
],
"Members@odata.count": 1,
"Name": "Accounts Collection"
}

响应字段

字段类型说明
@odata.contextstring账号合集的 OData 上下文。
@odata.idstring账号合集路径。
@odata.typestring账号合集类型。
Membersarray账号资源链接列表。
Members[].@odata.idstring指定账号的资源路径。
Members@odata.countinteger账号数量。
Namestring账号合集名称。

2.2 查询指定账号

项目内容
方法GET
路径/redfish/v1/AccountService/Accounts/{account-id}
成功状态码200 OK
使用 Token 查询指定账号
curl --header 'X-Xsrf-Token: <token>' \
--header 'Accept: application/json' \
'<protocol>://<device-ip>:<port>/redfish/v1/AccountService/Accounts/<account-id>'

响应示例

200 OK·实机结构
{
"@odata.context": "/redfish/v1/$metadata#ManagerAccount.ManagerAccount",
"@odata.id": "/redfish/v1/AccountService/Accounts/<account-id>",
"@odata.type": "#ManagerAccount.v1_10_0.ManagerAccount",
"CreateTime": "2026-08-05T13:20:59.197+08:00",
"Description": "User Account",
"Email": "user@example.com",
"Enabled": true,
"Locked": false,
"Name": "User Account",
"Password": "",
"RoleId": "CommonUser",
"UpdateTime": "2026-08-05T13:20:59.197+08:00",
"UserName": "<account-id>"
}

响应字段

字段类型说明
@odata.contextstring账号资源的 OData 上下文。
@odata.idstring当前账号资源路径。
@odata.typestring账号资源类型。
CreateTimestring账号创建时间。
Descriptionstring账号资源描述。
Emailstring账号邮箱。
Enabledboolean账号是否启用。
Lockedboolean账号是否锁定。
Namestring账号资源名称。
Passwordstring密码字段。查询时固定返回空字符串,不会返回密码或密码哈希。
RoleIdstring账号角色,例如 AdministratorCommonUser
UpdateTimestring账号最后更新时间。
UserNamestring账号名。

2.3 创建账号

项目内容
方法POST
路径/redfish/v1/AccountService/Accounts
成功状态码200 OK

<Tabs defaultValue="basic-auth" values={[{"label": "Basic Auth", "value": "basic-auth"}, {"label": "Token", "value": "token"}]}>

创建账号
curl --request POST \
--user '<username>:<password>' \
--header 'Content-Type: application/json' \
--data '{
"UserName": "api-user",
"Password": "<new-password>",
"Role": "CommonUser",
"Email": "user@example.com",
"Locked": false,
"Enabled": true
}' \
'<protocol>://<device-ip>:<port>/redfish/v1/AccountService/Accounts'
使用 Token 创建账号
curl --request POST \
--header 'X-Xsrf-Token: <token>' \
--header 'Content-Type: application/json' \
--data '{
"UserName": "api-user",
"Password": "<new-password>",
"Role": "CommonUser",
"Email": "user@example.com",
"Locked": false,
"Enabled": true
}' \
'<protocol>://<device-ip>:<port>/redfish/v1/AccountService/Accounts'

请求字段

字段类型必填说明
UserNamestring新账号名,不能与已有账号重复。
Passwordstring新账号密码,必须满足当前用户服务的长度和复杂度策略。
Rolestring账号角色。当前创建参数支持 AdministratorCommonUser
Emailstring账号邮箱。
Lockedboolean初始是否锁定。
Enabledboolean初始是否启用。

响应示例

200 OK
{
"@odata.type": "#Message.v1_1_1.Message",
"Timestamp": "1785836138",
"MessageId": "Base.1.11.0.Success",
"Message": "The request completed successfully.",
"MessageArgs": [],
"MessageSeverity": "OK",
"Severity": "",
"Oem": null,
"RelatedProperties": null,
"Resolution": "None"
}

响应字段

字段类型说明
@odata.typestringRedfish Message 类型。
Timestampstring服务端生成消息时的时间戳字符串。
MessageIdstring消息标识;成功时为 Base.1.11.0.Success
Messagestring操作结果描述。
MessageArgsarray消息格式化参数;成功时为空数组。
MessageSeveritystring消息严重程度;成功时为 OK
Severitystring兼容严重程度字段。
Oemobject | nullOEM 扩展信息。
RelatedPropertiesarray | null与消息相关的资源属性。
Resolutionstring后续处理建议。

2.4 修改指定账号

可修改账号的密码、角色、邮箱、启用状态和锁定状态。接口不允许修改用户名。

项目内容
方法PATCH
路径/redfish/v1/AccountService/Accounts/{account-id}
成功状态码200 OK
使用 Token 修改账号
curl --request PATCH \
--header 'X-Xsrf-Token: <token>' \
--header 'Content-Type: application/json' \
--data '{
"Email": "updated@example.com",
"Enabled": true,
"Locked": false
}' \
'<protocol>://<device-ip>:<port>/redfish/v1/AccountService/Accounts/<account-id>'

请求字段

字段类型必填说明
Passwordstring新密码。修改后该账号现有会话会被撤销。
Rolestring新角色。角色变更时,不适用于新角色的旧权限会被清理。
Emailstring新邮箱。当前实现不使用空字符串清空邮箱。
Lockedboolean是否锁定账号。
Enabledboolean是否启用账号。
UserNamestring禁止用户名由 URL 中的 account-id 确定;请求体中不得传入非空 UserName
修改自身账号的限制

当前账号修改自身时,只能修改密码或邮箱;不允许修改自身角色、EnabledLocked

响应示例

200 OK
{
"@odata.type": "#Message.v1_1_1.Message",
"Timestamp": "1785836138",
"MessageId": "Base.1.11.0.Success",
"Message": "The request completed successfully.",
"MessageArgs": [],
"MessageSeverity": "OK",
"Severity": "",
"Oem": null,
"RelatedProperties": null,
"Resolution": "None"
}

响应字段

字段类型说明
@odata.typestringRedfish Message 类型。
Timestampstring服务端生成消息时的时间戳字符串。
MessageIdstring消息标识;成功时为 Base.1.11.0.Success
Messagestring操作结果描述。
MessageArgsarray消息格式化参数;成功时为空数组。
MessageSeveritystring消息严重程度;成功时为 OK
Severitystring兼容严重程度字段。
Oemobject | nullOEM 扩展信息。
RelatedPropertiesarray | null与消息相关的资源属性。
Resolutionstring后续处理建议。

2.5 删除指定账号

项目内容
方法DELETE
路径/redfish/v1/AccountService/Accounts/{account-id}
请求体
成功状态码200 OK
使用 Token 删除账号
curl --request DELETE \
--header 'X-Xsrf-Token: <token>' \
'<protocol>://<device-ip>:<port>/redfish/v1/AccountService/Accounts/<account-id>'
内置账号不可删除

后端会拒绝删除保留的内置账号。删除账号后,该账号的现有会话也会失效。

响应示例

200 OK
{
"@odata.type": "#Message.v1_1_1.Message",
"Timestamp": "1785836138",
"MessageId": "Base.1.11.0.Success",
"Message": "The request completed successfully.",
"MessageArgs": [],
"MessageSeverity": "OK",
"Severity": "",
"Oem": null,
"RelatedProperties": null,
"Resolution": "None"
}

响应字段

字段类型说明
@odata.typestringRedfish Message 类型。
Timestampstring服务端生成消息时的时间戳字符串。
MessageIdstring消息标识;成功时为 Base.1.11.0.Success
Messagestring操作结果描述。
MessageArgsarray消息格式化参数;成功时为空数组。
MessageSeveritystring消息严重程度;成功时为 OK
Severitystring兼容严重程度字段。
Oemobject | nullOEM 扩展信息。
RelatedPropertiesarray | null与消息相关的资源属性。
Resolutionstring后续处理建议。

2.6 查询账号请求参数

查询后端生成的账号参数帮助信息。

项目内容
方法GET
路径/redfish/v1/AccountService/Accounts/Help
成功状态码200 OK
使用 Token 查询账号请求参数
curl --header 'X-Xsrf-Token: <token>' \
--header 'Accept: application/json' \
'<protocol>://<device-ip>:<port>/redfish/v1/AccountService/Accounts/Help'

响应示例

200 OK·当前实现
{
"Parameters": [
{
"DisallowedInput": false,
"AllowablePattern": "",
"DataType": "String",
"Name": "Enabled",
"Required": true
},
{
"DisallowedInput": false,
"AllowablePattern": "",
"DataType": "String",
"Name": "Enabled",
"Required": true
},
{
"DisallowedInput": false,
"AllowablePattern": "",
"AllowableValues": [
"Administrator",
"CommonUser"
],
"DataType": "String",
"Name": "Role",
"Required": true
},
{
"DisallowedInput": false,
"AllowablePattern": "",
"DataType": "String",
"Name": "Email",
"Required": true
},
{
"DisallowedInput": false,
"AllowablePattern": "",
"DataType": "Boolean",
"Name": "Locked",
"Required": true
},
{
"DisallowedInput": false,
"AllowablePattern": "",
"DataType": "Boolean",
"Name": "Enabled",
"Required": true
}
]
}

响应字段

字段类型说明
Parametersarray账号请求参数元数据列表。
Parameters[].DisallowedInputboolean是否禁止输入该参数。
Parameters[].AllowablePatternstring允许值的匹配模式。
Parameters[].AllowableValuesarray可选值列表;仅部分参数返回。
Parameters[].DataTypestring参数数据类型。
Parameters[].Namestring参数名。
Parameters[].Requiredboolean是否必填。
Help 响应的已知问题

当前 Help 响应中前两个字符串参数被错误标记为 Enabled,实际创建账号请求字段为 UserNamePassword。调用时应以 2.3 的请求字段表为准。

3 用户服务资源

3.1 查询用户服务配置

项目内容
方法GET
路径/redfish/v1/AccountService
成功状态码200 OK

<Tabs defaultValue="basic-auth" values={[{"label": "Basic Auth", "value": "basic-auth"}, {"label": "Token", "value": "token"}]}>

查询用户服务配置
curl --user '<username>:<password>' \
--header 'Accept: application/json' \
'<protocol>://<device-ip>:<port>/redfish/v1/AccountService'
使用 Token 查询用户服务配置
curl --header 'X-Xsrf-Token: <token>' \
--header 'Accept: application/json' \
'<protocol>://<device-ip>:<port>/redfish/v1/AccountService'

响应示例

200 OK·实机响应
{
"@odata.context": "/redfish/v1/$metadata#AccountService",
"@odata.id": "/redfish/v1/AccountService",
"@odata.type": "#AccountService.v1_12_0.AccountService",
"AccountLockoutDuration": 5,
"AccountLockoutThreshold": 5,
"Accounts": {
"@odata.id": "/redfish/v1/AccountService/Accounts"
},
"Id": "AccountService",
"MaxPasswordLength": 20,
"MinPasswordLength": 5,
"Name": "Account Service",
"Oem": {
"PasswordComplexityCheckEnabled": false,
"PasswordComplexitynumber": false,
"PasswordHistoryRecords": true,
"PasswordLowercaseletters": false,
"PasswordSpecialcharacters": false,
"PasswordUppercaseletters": false
},
"PrivilegeMap": {
"@odata.id": "/redfish/v1/AccountService/PrivilegeMap"
},
"Roles": {
"@odata.id": "/redfish/v1/AccountService/Roles"
}
}

响应字段

字段类型说明
@odata.contextstringAccountService 的 OData 上下文。
@odata.idstring用户服务资源路径。
@odata.typestringAccountService 资源类型。
AccountLockoutDurationinteger达到锁定阈值后的锁定持续时间。
AccountLockoutThresholdinteger触发账号锁定的失败尝试次数。
Accountsobject账号合集资源链接。
Accounts.@odata.idstring账号合集路径。
Idstring资源标识。
MaxPasswordLengthinteger密码最大长度。
MinPasswordLengthinteger密码最小长度。
Namestring资源名称。
OemobjectFirefly 密码策略扩展。
Oem.PasswordComplexityCheckEnabledboolean是否启用密码复杂度检查。
Oem.PasswordComplexitynumberboolean密码是否必须包含数字。
Oem.PasswordHistoryRecordsboolean是否启用密码历史记录策略。
Oem.PasswordLowercaselettersboolean密码是否必须包含小写字母。
Oem.PasswordSpecialcharactersboolean密码是否必须包含特殊字符。
Oem.PasswordUppercaselettersboolean密码是否必须包含大写字母。
PrivilegeMapobject权限映射资源链接;当前链接目标未注册。
PrivilegeMap.@odata.idstring权限映射资源路径。
Rolesobject角色合集资源链接;当前链接目标未注册。
Roles.@odata.idstring角色合集资源路径。

3.2 配置用户服务

修改密码长度、账号锁定和密码复杂度策略。该接口支持部分更新,仅需传入要修改的字段。

项目内容
方法PATCH
路径/redfish/v1/AccountService
成功状态码200 OK
使用 Token 配置用户服务
curl --request PATCH \
--header 'X-Xsrf-Token: <token>' \
--header 'Content-Type: application/json' \
--data '{
"MinPasswordLength": 8,
"MaxPasswordLength": 20,
"AccountLockoutThreshold": 5,
"AccountLockoutDuration": 5,
"Oem": {
"PasswordHistoryRecords": true,
"PasswordComplexityCheckEnabled": true,
"PasswordUppercaseletters": true,
"PasswordLowercaseletters": true,
"PasswordComplexitynumber": true,
"PasswordSpecialcharacters": true
}
}' \
'<protocol>://<device-ip>:<port>/redfish/v1/AccountService'

请求字段

字段类型必填说明
MinPasswordLengthinteger密码最小长度。
MaxPasswordLengthinteger密码最大长度。
AccountLockoutThresholdinteger触发账号锁定的失败尝试次数。
AccountLockoutDurationinteger账号锁定持续时间。
OemobjectFirefly 密码策略扩展。
Oem.PasswordHistoryRecordsboolean是否启用密码历史记录。
Oem.PasswordComplexityCheckEnabledboolean是否启用密码复杂度检查。
Oem.PasswordUppercaselettersboolean是否要求大写字母。
Oem.PasswordLowercaselettersboolean是否要求小写字母。
Oem.PasswordComplexitynumberboolean是否要求数字。
Oem.PasswordSpecialcharactersboolean是否要求特殊字符。

响应示例

配置成功后不返回通用 Message,而是返回更新后的完整 AccountService 资源。

200 OK·实机响应
{
"@odata.context": "/redfish/v1/$metadata#AccountService",
"@odata.id": "/redfish/v1/AccountService",
"@odata.type": "#AccountService.v1_12_0.AccountService",
"AccountLockoutDuration": 5,
"AccountLockoutThreshold": 5,
"Accounts": {
"@odata.id": "/redfish/v1/AccountService/Accounts"
},
"Id": "AccountService",
"MaxPasswordLength": 20,
"MinPasswordLength": 5,
"Name": "Account Service",
"Oem": {
"PasswordComplexityCheckEnabled": false,
"PasswordComplexitynumber": false,
"PasswordHistoryRecords": true,
"PasswordLowercaseletters": false,
"PasswordSpecialcharacters": false,
"PasswordUppercaseletters": false
},
"PrivilegeMap": {
"@odata.id": "/redfish/v1/AccountService/PrivilegeMap"
},
"Roles": {
"@odata.id": "/redfish/v1/AccountService/Roles"
}
}

响应字段与 3.1 的“响应字段”相同,各策略字段为更新后的值。

密码复杂度生效方式

PasswordComplexityCheckEnabledtrue 时,后端才会根据其他密码策略字段检查新密码。新建账号和修改密码前,建议先查询当前用户服务配置。