(ctx context.Context, projectID, userID, roleID string, restrictResources bool, resources []database.ResourceName)
| 2353 | } |
| 2354 | |
| 2355 | func (c *connection) InsertProjectMemberUser(ctx context.Context, projectID, userID, roleID string, restrictResources bool, resources []database.ResourceName) error { |
| 2356 | resJSON, err := marshalResourceNames(resources) |
| 2357 | if err != nil { |
| 2358 | return err |
| 2359 | } |
| 2360 | |
| 2361 | res, err := c.getDB(ctx).ExecContext(ctx, "INSERT INTO users_projects_roles (user_id, project_id, project_role_id, restrict_resources, resources) VALUES ($1, $2, $3, $4, $5)", userID, projectID, roleID, restrictResources, resJSON) |
| 2362 | if err != nil { |
| 2363 | return parseErr("project member", err) |
| 2364 | } |
| 2365 | rows, err := res.RowsAffected() |
| 2366 | if err != nil { |
| 2367 | return err |
| 2368 | } |
| 2369 | if rows == 0 { |
| 2370 | return fmt.Errorf("no rows affected when adding user to project") |
| 2371 | } |
| 2372 | return nil |
| 2373 | } |
| 2374 | |
| 2375 | // FindOrganizationMemberUsergroups returns org user groups as a collection of MemberUsergroup. |
| 2376 | // If a user group has no org role then RoleName is empty. |
nothing calls this directly
no test coverage detected