Yeaury opened a new pull request, #3008:
URL: https://github.com/apache/hugegraph/pull/3008
## Purpose of the PR
Adapt API endpoints required by the Hubble 2.0 frontend to achieve feature
parity with the internal version. The community edition of HugeGraph Server
currently lacks several critical APIs that the Hubble frontend depends on
(graph profile listing, default graph management, default role management,
schema templates, etc.), preventing the Hubble frontend from properly using
core graph and role management features. This PR adds the missing APIs to
enable full integration between the Hubble 2.0 frontend and the community
edition Server.
## Main Changes
### 1. GraphsAPI — Graph Management Endpoint Enhancements (`GraphsAPI.java`)
- **`GET /graphspaces/{graphspace}/graphs/profile`** — New graph profile
listing endpoint with prefix filtering, default-graph-first sorting, and full
config info (nickname, create_time, default status, etc.)
- **`GET /graphspaces/{graphspace}/graphs/{name}/default`** — Set a graph as
default
- **`GET /graphspaces/{graphspace}/graphs/{name}/undefault`** — Unset a
graph as default
- **`GET /graphspaces/{graphspace}/graphs/default`** — Get current user's
default graph list
- **`PUT /graphspaces/{graphspace}/graphs/{name}`** — Graph management
operations (currently supports `update` action for nickname updates)
- **`POST /graphspaces/{graphspace}/graphs`** (form-urlencoded) — Hubble
frontend form-based graph creation compatibility
- Auto-fill HStore/PD mode defaults (`backend=hstore`, `serializer=binary`,
`store={name}`) during graph creation, and map frontend `schema` field to
`schema.init_template`
### 2. GraphSpaceAPI — Default Role Management (`GraphSpaceAPI.java`)
- **`POST /graphspaces/{graphspace}/role`** — Create default role (supports
SPACE/ANALYST/OBSERVER)
- **`GET /graphspaces/{graphspace}/role`** — Check if a user/group has a
specified default role
- **`DELETE /graphspaces/{graphspace}/role`** — Delete default role
- Remove unnecessary PD mode restriction from `listProfile` endpoint
- Add `@JsonIgnoreProperties(ignoreUnknown = true)` to tolerate unknown
fields from the frontend
### 3. ManagerAPI — Role Query (`ManagerAPI.java`)
- **`GET /auth/manager/default`** — New endpoint for Hubble frontend to
query if the current user has a specified default role
### 4. SchemaTemplateAPI — Schema Template CRUD (New File)
- **`GET /graphspaces/{graphspace}/schematemplates`** — List all schema
templates
- **`GET /graphspaces/{graphspace}/schematemplates/{name}`** — Get a
specific template
- **`POST /graphspaces/{graphspace}/schematemplates`** — Create template
- **`PUT /graphspaces/{graphspace}/schematemplates/{name}`** — Update
template
- **`DELETE /graphspaces/{graphspace}/schematemplates/{name}`** — Delete
template
### 5. Authentication & Authorization Layer (`AuthManager.java`,
`StandardAuthManager.java`, `StandardAuthManagerV2.java`,
`HugeGraphAuthProxy.java`)
- Added 10 new methods to `AuthManager` interface:
`setDefaultGraph`/`unsetDefaultGraph`/`getDefaultGraph` and
`createDefaultRole`/`createSpaceDefaultRole`/`isDefaultRole`/`deleteDefaultRole`,
etc.
- `StandardAuthManager` and `StandardAuthManagerV2` implement the above
interfaces using existing `HugeGroup`/`HugeBelong`/`HugeRole` metadata
mechanisms
- `HugeGraphAuthProxy.AuthManagerProxy` adds corresponding delegate methods
to properly forward calls to the underlying authManager
### 6. Utilities (`ConfigUtil.java`, `GraphManager.java`)
- `ConfigUtil.writeConfigToString()` — New utility method to serialize graph
configuration to string (used by the listProfile endpoint)
- `GraphManager` — Added graph management helper methods
## Verifying these changes
- [ ] Need tests and can be verified as follows:
- Verify the full graph management flow via Hubble frontend (create
graph, list, profile query)
- Verify default graph set/unset/query via Hubble frontend
- Verify Schema template CRUD operations
- Verify default role (SPACE/ANALYST/OBSERVER) creation, query, and
deletion
- Directly test all new endpoints via REST API
## Does this PR potentially affect the following parts?
- [ ] Dependencies (add/update license info &
regenerate_known_dependencies.sh)
- [ ] Modify configurations
- [x] The public API
- [ ] Other affects (typed here)
- [ ] Nope
## Documentation Status
- [x] `Doc - TODO`
- [ ] `Doc - Done`
- [ ] `Doc - No Need`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]