Skip to content

feat: Add group owners, user lookup, and enforce_feature_owners support#19

Merged
gagantrivedi merged 2 commits intomainfrom
feat/group-owners-and-user-lookup
Apr 3, 2026
Merged

feat: Add group owners, user lookup, and enforce_feature_owners support#19
gagantrivedi merged 2 commits intomainfrom
feat/group-owners-and-user-lookup

Conversation

@gagantrivedi
Copy link
Copy Markdown
Member

Summary

  • Add GroupOwners *[]int64 to Feature model with custom UnmarshalJSON (extracts IDs from {id, name} objects)
  • Add AddFeatureGroupOwners / RemoveFeatureGroupOwners client methods (mirror existing owner management pattern)
  • Add User model and GetOrganisationUsers / GetOrganisationUserByEmail methods for user lookup by email
  • Add EnforceFeatureOwners bool to Project model
  • Add UserNotFoundError error type

Companion PR: Flagsmith/terraform-provider-flagsmith (to follow)

Resolves Flagsmith/terraform-provider-flagsmith#214

Test plan

  • Unit tests for AddFeatureGroupOwners and RemoveFeatureGroupOwners
  • Unit tests for GetOrganisationUsers and GetOrganisationUserByEmail (happy path + not found)
  • Updated TestGetFeature to assert GroupOwners deserialization
  • Updated TestGetProject to assert EnforceFeatureOwners deserialization
  • All existing tests still pass

- Add GroupOwners field to Feature model with custom UnmarshalJSON
- Add AddFeatureGroupOwners/RemoveFeatureGroupOwners client methods
- Add User model and GetOrganisationUsers/GetOrganisationUserByEmail methods
- Add EnforceFeatureOwners field to Project model
- Add UserNotFoundError type
@gagantrivedi gagantrivedi marked this pull request as ready for review April 2, 2026 06:13
@gagantrivedi gagantrivedi requested a review from a team as a code owner April 2, 2026 06:13
@gagantrivedi gagantrivedi requested review from emyller and removed request for a team April 2, 2026 06:13
Copy link
Copy Markdown

@Zaimwa9 Zaimwa9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly minor comments but otherwise looks good

- Add parameter validation to manageFeatureGroupOwners (return error if
  feature.ProjectID or feature.ID is nil)
- Add error path test for AddFeatureGroupOwners/RemoveFeatureGroupOwners
  with missing params
- Pre-allocate GroupOwners slice in UnmarshalJSON for efficiency
- Return copy of user in GetOrganisationUserByEmail to avoid pinning
  the slice in memory
- Add missing date_joined field to User model and assert in tests

https://claude.ai/code/session_01V7MNgv5pxkpz4chuJBzLcZ
Copy link
Copy Markdown

@Zaimwa9 Zaimwa9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@gagantrivedi gagantrivedi merged commit b7b3f09 into main Apr 3, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enforce ownership for flagsmith_feature resources

3 participants