feat(oo): project team CRUD and user lifecycle (block/unblock/password/delete)
Release Please / Release Please (push) Skipped
Release / GoReleaser (push) Skipped
Tests / Secret scan (gitleaks) (push) Skipped
Tests / Test (Go 1.25) (push) Skipped
Tests / Test (Go stable) (push) Skipped
Tests / Secret scan (gitleaks) (pull_request) Successful in 4s
Tests / Test (Go 1.25) (pull_request) Successful in 1m2s
Tests / Test (Go stable) (pull_request) Successful in 1m40s

- project team: oo projects team list|add|remove|set (portal users)
- users: get|create|update|delete|block|unblock|password
- lib: CreateUser, DeleteUser (auto-suspend before delete), Add/Remove/
  SetProjectTeam, ListProjectTeam; deleteJSON reused; jsonBodyReader helper
- tests: unmarshalResponseArray
This commit is contained in:
2026-09-22 14:26:23 +01:00
parent b86d71211f
commit 1dc99d6997
7 changed files with 572 additions and 30 deletions
+39
View File
@@ -0,0 +1,39 @@
package onlyoffice
// Project team (portal users) CRUD. Team is distinct from CRM contacts,
// which are linked through project_contacts.go.
import (
"context"
"fmt"
)
// ListProjectTeam returns portal users on the project team.
// GET /api/2.0/project/{projectid}/team
func (c *Client) ListProjectTeam(ctx context.Context, projectID int) ([]map[string]any, error) {
return c.GetProjectTeam(ctx, projectID)
}
// AddProjectTeamUser adds a portal user to the project team.
// POST /api/2.0/project/{projectid}/team with {"userId": "..."}.
// Returns the resulting team list.
func (c *Client) AddProjectTeamUser(ctx context.Context, projectID int, userID string) ([]map[string]any, error) {
return c.postJSONArray(ctx, fmt.Sprintf("/api/2.0/project/%d/team", projectID),
map[string]any{"userId": userID})
}
// RemoveProjectTeamUser removes a portal user from the project team.
// DELETE /api/2.0/project/{projectid}/team with {"userId": "..."}.
// Returns the resulting team list.
func (c *Client) RemoveProjectTeamUser(ctx context.Context, projectID int, userID string) ([]map[string]any, error) {
return c.deleteJSONArray(ctx, fmt.Sprintf("/api/2.0/project/%d/team", projectID),
map[string]any{"userId": userID})
}
// SetProjectTeam replaces the project team with the given user IDs.
// PUT /api/2.0/project/{projectid}/team with participants + notify.
// This is the canonical way to register several members at once.
func (c *Client) SetProjectTeam(ctx context.Context, projectID int, participants []string, notify bool) ([]map[string]any, error) {
return c.putJSONArray(ctx, fmt.Sprintf("/api/2.0/project/%d/team", projectID),
map[string]any{"projectId": projectID, "participants": participants, "notify": notify})
}