Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability to assign a feature to a user group #2666

Closed
2 of 3 tasks
matthewelwell opened this issue Aug 21, 2023 · 3 comments · Fixed by #3112 or #3176
Closed
2 of 3 tasks

Add the ability to assign a feature to a user group #2666

matthewelwell opened this issue Aug 21, 2023 · 3 comments · Fixed by #3112 or #3176
Assignees
Labels
feature New feature or request

Comments

@matthewelwell
Copy link
Contributor

matthewelwell commented Aug 21, 2023

Functionality should be as per the current functionality to assign a feature to a user, but for groups. A feature should be able to be assigned to multiple users and multiple groups.

Acceptance Criteria

  • When creating a feature via the UI or the API, multiple groups can be assigned to the feature
  • When updating a feature via the UI or the API, groups can be removed or changed
  • Users can filter the list of features by assigned group
@dabeeeenster dabeeeenster added the feature New feature or request label Sep 5, 2023
@zachaysan
Copy link
Contributor

zachaysan commented Oct 31, 2023

The third criteria was moved into a new ticket by @dabeeeenster the remaining functionality is here:

#2908

@zachaysan
Copy link
Contributor

zachaysan commented Nov 29, 2023

The API endpoints are in the following format.

To list the groups in an organisation to retrieve the group id and name pair.

HTTP GET
/api/v1/organisations/<organisation_id>/groups/summaries/
[
    {
        "id": 1,
        "name": "TestGroup",
    },
    {
        "id": 2,
        "name": "TestGroup2",
    }
]

Adding a group to an assigned feature:

HTTP POST
/api/v1/projects/<project_id>/features/<feature_id>/add-group-owners/
{"group_ids": [1, 2]}

Removing a group from being assigned to a feature:

HTTP POST
/api/v1/projects/<project_id>/features/<feature_id>/remove-group-owners/
{"group_ids": [1, 2]}

For both endpoints, the response body looks the same, which represents all the now-existing group owners for the feature.

{
  "group_owners": [
    {
      "id": 1,
      "name": "GroupName1"
    },
    {
      "id": 2,
      "name": "GroupName2"
    }
  ]
}

To pre-load the group owners for a list of features, find the existing URL structure for the following pattern, with an abbreviated response body for brevity:

HTTP GET
/api/v1/projects/<project_pk>/features/
{
  "count": 2,
  "next": null,
  "previous": null,
  "results": [
    {
      "id": 77,
      "name": "test_feature_empty",
      "group_owners": [],
    },
    {
      "id": 78,
      "name": "test_feature",
      "group_owners": [
        {
          "id": 6,
          "name": "Test Group"
        },
        {
          "id": 7,
          "name": "Second Group"
        }
      ],
    }
  ]
}

@kyle-ssg kyle-ssg self-assigned this Dec 7, 2023
@kyle-ssg kyle-ssg linked a pull request Dec 7, 2023 that will close this issue
5 tasks
@matthewelwell matthewelwell reopened this Dec 11, 2023
@matthewelwell
Copy link
Contributor Author

@kyle-ssg just noticed that (unless I'm missing something) this isn't using the new endpoint to retrieve the groups, which will mean that only organisation admins can use this feature.

GET /api/v1/organisations/<organisation_id>/groups/summaries/
[
    {
        "id": 1,
        "name": "TestGroup",
    },
    {
        "id": 2,
        "name": "TestGroup2",
    }
]

Please use the above endpoint for this purpose. All users of an organisation will have access to this data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
4 participants