|
@@ -1976,6 +1976,9 @@ void HttpServer::HandleListGroups(const httplib::Request& req, httplib::Response
|
|
|
if (IsSuperadmin(*auth_user) && req.has_param("include_deleted")) {
|
|
if (IsSuperadmin(*auth_user) && req.has_param("include_deleted")) {
|
|
|
include_deleted = req.get_param_value("include_deleted") == "true";
|
|
include_deleted = req.get_param_value("include_deleted") == "true";
|
|
|
}
|
|
}
|
|
|
|
|
+ bool include_system = IsSuperadmin(*auth_user) &&
|
|
|
|
|
+ req.has_param("include_system") &&
|
|
|
|
|
+ req.get_param_value("include_system") == "true";
|
|
|
|
|
|
|
|
auto result = groupService_->ListGroups(workspace_id, limit, offset, include_deleted);
|
|
auto result = groupService_->ListGroups(workspace_id, limit, offset, include_deleted);
|
|
|
|
|
|
|
@@ -1988,12 +1991,36 @@ void HttpServer::HandleListGroups(const httplib::Request& req, httplib::Response
|
|
|
|
|
|
|
|
// Build response
|
|
// Build response
|
|
|
nlohmann::json groups_array = nlohmann::json::array();
|
|
nlohmann::json groups_array = nlohmann::json::array();
|
|
|
|
|
+
|
|
|
|
|
+ // Add global system groups first if requested
|
|
|
|
|
+ if (include_system) {
|
|
|
|
|
+ auto global_result = groupService_->ListSystemGroups();
|
|
|
|
|
+ if (global_result.success) {
|
|
|
|
|
+ for (const auto& group : global_result.groups) {
|
|
|
|
|
+ nlohmann::json grp_json = {
|
|
|
|
|
+ {"id", group.id},
|
|
|
|
|
+ {"workspace_id", group.workspace_id},
|
|
|
|
|
+ {"name", group.name},
|
|
|
|
|
+ {"permissions", group.permissions},
|
|
|
|
|
+ {"is_system", group.is_system},
|
|
|
|
|
+ {"parent_group_id", group.parent_group_id},
|
|
|
|
|
+ {"created_at", group.created_at},
|
|
|
|
|
+ {"updated_at", group.updated_at},
|
|
|
|
|
+ {"deleted_at", group.deleted_at}
|
|
|
|
|
+ };
|
|
|
|
|
+ groups_array.push_back(grp_json);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
for (const auto& group : result.groups) {
|
|
for (const auto& group : result.groups) {
|
|
|
nlohmann::json grp_json = {
|
|
nlohmann::json grp_json = {
|
|
|
{"id", group.id},
|
|
{"id", group.id},
|
|
|
{"workspace_id", group.workspace_id},
|
|
{"workspace_id", group.workspace_id},
|
|
|
{"name", group.name},
|
|
{"name", group.name},
|
|
|
{"permissions", group.permissions},
|
|
{"permissions", group.permissions},
|
|
|
|
|
+ {"is_system", group.is_system},
|
|
|
|
|
+ {"parent_group_id", group.parent_group_id},
|
|
|
{"created_at", group.created_at},
|
|
{"created_at", group.created_at},
|
|
|
{"updated_at", group.updated_at}
|
|
{"updated_at", group.updated_at}
|
|
|
};
|
|
};
|