如何创建用户以及设置密码对指定图有权限
Problem Type (问题类型)
None
Before submit
- [x] 我已经确认现有的 Issues 与 FAQ 中没有相同 / 重复问题 (I have confirmed and searched that there are no similar problems in the historical issue and documents)
Environment (环境信息)
- Server Version: 1.0.0 (Apache Release Version)
- Backend: RocksDB x nodes, HDD or SSD
- OS: xx CPUs, xx G RAM, Ubuntu 2x.x / CentOS 7.x
- Data Size: xx vertices, xx edges
Your Question (问题描述)
如何创建用户以及设置密码对指定图有权限
Vertex/Edge example (问题点 / 边数据举例)
Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构)
HugeGraph 支持通过 RESTful API 创建用户、设置密码,并为指定图分配权限。核心流程如下:
-
创建用户
使用POST /graphs/{graph}/auth/users,请求体为 JSON,例如:{ "user_name": "newuser", "user_password": "yourpassword", "user_phone": "1234567890", "user_email": "[email protected]" }密码会自动加密存储。接口实现详见 UserAPI。
-
修改用户密码
使用PUT /graphs/{graph}/auth/users/{id},请求体只需包含新密码字段:{ "user_password": "newpassword" }详情见 UserAPI update 方法。
-
分配权限
需先创建用户组(group)和目标(target),然后通过POST /graphs/{graph}/auth/accesses分配权限,示例请求体:{ "group": "groupId", "target": "targetId", "access_permission": "READ", // 或 WRITE、ADMIN 等 "access_description": "描述" }权限类型由
HugePermission枚举定义。接口实现见 AccessAPI。 -
认证方式
默认超级管理员为admin,认证采用 HTTP Basic Auth,格式为Authorization: Basic base64(admin:密码),如需示例可参考 相关 issue。
如需更详细的 API 字段说明,可直接参考源码中的 JsonUser 和 JsonAccess 类定义。实际操作建议用 Postman 或 curl 进行接口调用。
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other
Due to the lack of activity, the current issue is marked as stale and will be closed after 20 days, any update will remove the stale label