Skip to content

17744 policies backend#18564

Merged
mostlikelee merged 7 commits into15605-merge-inherited-queries-and-policiesfrom
17744-policies-backend
Apr 30, 2024
Merged

17744 policies backend#18564
mostlikelee merged 7 commits into15605-merge-inherited-queries-and-policiesfrom
17744-policies-backend

Conversation

@mostlikelee
Copy link
Copy Markdown
Contributor

#17744

This change implements a new query parameter on /teams/%d/policies to merge inherited policies into the policies array instead of listing them separately. The frontend will key off the existing team_id field to mark policies as "inherited" in theUI.

I opted for an additive approach in adding a datastore method rather than modifying the existing ListTeamPolicies to avoid a large test refactor.

  • Changes file added for user-visible changes in changes/, orbit/changes/ or ee/fleetd-chrome/changes.
    See Changes files for more information.
  • Input data is properly validated, SELECT * is avoided, SQL injection is prevented (using placeholders for values in statements)
  • Added/updated tests
  • Manual QA for all new/changed functionality

s.lastActivityMatches(fleet.ActivityTypeEditedMacOSMinVersion{}.ActivityName(), `{"deadline":"2022-01-01", "minimum_version":"12.3.1", "team_id": null, "team_name": null}`, 0)
s.assertMacOSUpdatesDeclaration(nil, &fleet.MacOSUpdates{
MinimumVersion: optjson.SetString("12.3.1"), Deadline: optjson.SetString("2022-01-01")})
MinimumVersion: optjson.SetString("12.3.1"), Deadline: optjson.SetString("2022-01-01"),
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

unrelated gofmt

@mostlikelee mostlikelee mentioned this pull request Apr 26, 2024
4 tasks
@jacobshandling jacobshandling force-pushed the 15605-merge-inherited-queries-and-policies branch from 7b734e8 to 8d4ee1b Compare April 27, 2024 03:48
Copy link
Copy Markdown
Member

@getvictor getvictor left a comment

Choose a reason for hiding this comment

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

What about the new query param:

| query | string | query | Search query keywords. Searchable fields include `name`. |

Is that needed? If so, it can be a separate PR.

@mostlikelee
Copy link
Copy Markdown
Contributor Author

What about the new query param:

| query | string | query | Search query keywords. Searchable fields include `name`. |

Is that needed? If so, it can be a separate PR.

Matchquery should be implemented in searchLike

query, args = searchLike(query, args, match, policySearchColumns...)

@mostlikelee mostlikelee merged commit 122b352 into 15605-merge-inherited-queries-and-policies Apr 30, 2024
@mostlikelee mostlikelee deleted the 17744-policies-backend branch April 30, 2024 15:03
mostlikelee added a commit that referenced this pull request May 1, 2024
#17744 

This adds the `merged_inherited` query param to
`/teams/:id/policies/count` related to
#18564

- [ ] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [X] Input data is properly validated, `SELECT *` is avoided, SQL
injection is prevented (using placeholders for values in statements)
- [X] Added/updated tests
- [X] Manual QA for all new/changed functionality

---------

Co-authored-by: RachelElysia <rachel@fleetdm.com>
RachelElysia added a commit that referenced this pull request May 6, 2024
#17744 

This change implements a new query parameter on `/teams/%d/policies` to
merge inherited policies into the policies array instead of listing them
separately. The frontend will key off the existing `team_id` field to
mark policies as "inherited" in theUI.

I opted for an additive approach in adding a datastore method rather
than modifying the existing ListTeamPolicies to avoid a large test
refactor.

- [ ] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [X] Input data is properly validated, `SELECT *` is avoided, SQL
injection is prevented (using placeholders for values in statements)
- [X] Added/updated tests
- [X] Manual QA for all new/changed functionality

---------

Co-authored-by: RachelElysia <rachel@fleetdm.com>
RachelElysia added a commit that referenced this pull request May 6, 2024
#17744 

This adds the `merged_inherited` query param to
`/teams/:id/policies/count` related to
#18564

- [ ] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [X] Input data is properly validated, `SELECT *` is avoided, SQL
injection is prevented (using placeholders for values in statements)
- [X] Added/updated tests
- [X] Manual QA for all new/changed functionality

---------

Co-authored-by: RachelElysia <rachel@fleetdm.com>
RachelElysia added a commit that referenced this pull request May 7, 2024
#17744 

This change implements a new query parameter on `/teams/%d/policies` to
merge inherited policies into the policies array instead of listing them
separately. The frontend will key off the existing `team_id` field to
mark policies as "inherited" in theUI.

I opted for an additive approach in adding a datastore method rather
than modifying the existing ListTeamPolicies to avoid a large test
refactor.

- [ ] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [X] Input data is properly validated, `SELECT *` is avoided, SQL
injection is prevented (using placeholders for values in statements)
- [X] Added/updated tests
- [X] Manual QA for all new/changed functionality

---------

Co-authored-by: RachelElysia <rachel@fleetdm.com>
RachelElysia added a commit that referenced this pull request May 7, 2024
#17744 

This adds the `merged_inherited` query param to
`/teams/:id/policies/count` related to
#18564

- [ ] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [X] Input data is properly validated, `SELECT *` is avoided, SQL
injection is prevented (using placeholders for values in statements)
- [X] Added/updated tests
- [X] Manual QA for all new/changed functionality

---------

Co-authored-by: RachelElysia <rachel@fleetdm.com>
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.

3 participants