Jump to main content
Expand
Package Access

Package Access

package_access

Introduced in version 42

Summary: POST /v1/auth/package-access

UNSTABLE: Return permissions for specified packages for the authenticated user.

Authenticates the request and checks the principals authorization status for requested packages. Returns the data pertaining to the account and the auth token as well as authorization data for packages.

This endpoint is considered unstable and it may see compatibility breaking changes.

Request JSON Schema

{
  "additionalProperties": false,
  "properties": {
    "filters": {
      "items": {
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string"
          },
          "type": {
            "enum": [
              "bin",
              "charm-bundle",
              "charm",
              "rock",
              "rockcraft",
              "snap",
              "snapcraft",
              "bincraft",
              "charmcraft",
              "sdk",
              "image",
              "kernos"
            ],
            "type": "string"
          }
        },
        "required": [
          "type",
          "name"
        ],
        "type": "object"
      },
      "minItems": 1,
      "type": "array"
    }
  },
  "required": [
    "filters"
  ],
  "type": "object"
}

Response JSON Schema

{
  "additionalProperties": false,
  "properties": {
    "authentication": {
      "additionalProperties": false,
      "properties": {
        "account": {
          "additionalProperties": false,
          "properties": {
            "display-name": {
              "oneOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "email": {
              "type": "string"
            },
            "id": {
              "type": "string"
            },
            "username": {
              "oneOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "validation": {
              "type": "string"
            }
          },
          "required": [
            "display-name",
            "id",
            "username"
          ],
          "type": "object"
        },
        "channels": {
          "oneOf": [
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ]
        },
        "packages": {
          "oneOf": [
            {
              "items": {
                "anyOf": [
                  {
                    "required": [
                      "id",
                      "type"
                    ]
                  },
                  {
                    "required": [
                      "name",
                      "type"
                    ]
                  }
                ],
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "type": {
                    "enum": [
                      "bin",
                      "bundle",
                      "charm",
                      "rock",
                      "snap",
                      "sdk",
                      "image",
                      "kernos"
                    ],
                    "type": "string"
                  }
                },
                "type": "object"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ]
        },
        "permissions": {
          "oneOf": [
            {
              "items": {
                "enum": [
                  "account-manage-keys",
                  "account-manage-metadata",
                  "account-register-package",
                  "account-view-packages",
                  "package-manage",
                  "package-manage-acl",
                  "package-manage-metadata",
                  "package-manage-releases",
                  "package-manage-revisions",
                  "package-view",
                  "package-view-acl",
                  "package-view-metadata",
                  "package-view-metrics",
                  "package-view-releases",
                  "package-view-revisions",
                  "store-manage",
                  "store-view",
                  "account-post-messages"
                ],
                "type": "string"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "account",
        "channels",
        "packages",
        "permissions"
      ],
      "type": "object"
    },
    "authorization": {
      "additionalProperties": false,
      "properties": {
        "packages": {
          "items": {
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "permissions": {
                "items": {
                  "enum": [
                    "publisher",
                    "package-collaborator"
                  ],
                  "type": "string"
                },
                "type": "array"
              },
              "source-workflow": {
                "type": "object"
              },
              "type": {
                "enum": [
                  "bin",
                  "charm-bundle",
                  "charm",
                  "rock",
                  "rockcraft",
                  "snap",
                  "snapcraft",
                  "bincraft",
                  "charmcraft",
                  "sdk",
                  "image",
                  "kernos"
                ],
                "type": "string"
              }
            },
            "required": [
              "type",
              "id",
              "name",
              "permissions",
              "source-workflow"
            ],
            "type": "object"
          },
          "type": "array"
        }
      },
      "required": [
        "packages"
      ],
      "type": "object"
    }
  },
  "required": [
    "authentication",
    "authorization"
  ],
  "type": "object"
}