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

feat: subcontrol permissions via control, cli for subcontrol #266

Merged
merged 5 commits into from
Dec 4, 2024

Conversation

golanglemonade
Copy link
Member

@golanglemonade golanglemonade commented Dec 4, 2024

  • Updates the fga model for subcontrol's to inherit their permissions from the a required control
  • Updates the subcontrol schema to require a control edge on creation, and a hook to ensure all controls are not removed from the subcontrol
  • Adds permissions for creation, edit and query access to subcontrols
  • Adds the cli commands for subcontrols

Creation of subcontrol:

go run cmd/cli/main.go subcontrol create -n sc-2 -c 01JE7AZAT26T7QE5M91F5MNP1M -z json
{
  "createSubcontrol": {
    "subcontrol": {
      "class": "",
      "controls": [
        {
          "id": "01JE7AZAT26T7QE5M91F5MNP1M",
          "name": "sc2"
        }
      ],
      "createdAt": "2024-12-04T00:38:55.237217-07:00",
      "createdBy": "01JE57Y4YZ6A1TA1ZE7MV47E94",
      "description": "",
      "family": "",
      "id": "01JE89Q4VZC3DYBXDTV7PPSC4N",
      "implementationEvidence": "",
      "implementationStatus": "",
      "implementationVerification": "",
      "mappedFrameworks": "",
      "name": "sc-2",
      "source": "",
      "status": "",
      "subcontrolNumber": "",
      "subcontrolType": "",
      "updatedAt": "2024-12-04T00:38:55.231634-07:00",
      "updatedBy": "01JE57Y4YZ6A1TA1ZE7MV47E94",
      "version": ""
    }
  }
}

Controls now returns the subcontrol in the client:

go run cmd/cli/main.go control get -i 01JE7AZAT26T7QE5M91F5MNP1M -z json 
{
  "control": {
    "class": "",
    "controlNumber": "",
    "controlType": "",
    "createdAt": "2024-12-03T15:41:37.609989-07:00",
    "createdBy": "01JE57Y4YZ6A1TA1ZE7MV47E94",
    "description": "",
    "family": "sc",
    "id": "01JE7AZAT26T7QE5M91F5MNP1M",
    "mappedFrameworks": "",
    "name": "sc2",
    "programs": [
      {
        "id": "01JE580Q9NEJ04322ETB5NWR70",
        "name": "mitb program"
      }
    ],
    "satisfies": "",
    "source": "",
    "status": "",
    "subcontrols": [
      {
        "id": "01JE89PS7TH3PQXAAH2VAFX3N1",
        "name": "sc-2"
      },
      {
        "id": "01JE89Q21RH3K77P2WNXHTPBNB",
        "name": "sc-3"
      },
      {
        "id": "01JE89Q4VZC3DYBXDTV7PPSC4N",
        "name": "sc-4"
      }
    ],
    "updatedAt": "2024-12-03T15:41:37.602096-07:00",
    "updatedBy": "01JE57Y4YZ6A1TA1ZE7MV47E94",
    "version": ""
  }
}

Users with permissions to the control, can also view all (and update if they have edit permissions) the subcontrols

Signed-off-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com>
Signed-off-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com>
Signed-off-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com>
@golanglemonade golanglemonade marked this pull request as ready for review December 4, 2024 18:20
Signed-off-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com>
Copy link

sonarcloud bot commented Dec 4, 2024

@golanglemonade golanglemonade enabled auto-merge (squash) December 4, 2024 20:04
@golanglemonade golanglemonade merged commit d1e131d into main Dec 4, 2024
17 checks passed
@golanglemonade golanglemonade deleted the feat-subcontrol-take-2 branch December 4, 2024 23:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants