Story #3968

Updated by almost 2 years ago

This epic is to introduce the concept of ContentGuards in Pulp 3.0. ContentGuards are objects with attributes (ie settings) and logic that users can leverage to protect their content in Pulp. These ContentGuards—their fields and functionality—are defined by plugin writers. Examples might include a BasicAuthContentGuard or a DockerAuthContentGuard. These ContentGuards might be specific to certain content plugins but they also could be shipped independently in a plugin.

Pulpcore will provide the basic functionality around creating/updating/reading/deleting ContentGuards along with integration between the ContentGuard and the content app. The plugins will extend this functionality to add their own specific settings, routes to expose these ContentGuards, and code to authorize/deny any request based on the state of the applicable ContentGuard.

Distributions will have a foreign key to ContentGuards. A ContentGuard could belong to many Distributions. Also, a ContentGuard is not required for a Distribution meaning that a user doesn't have to enable content protection for their distribution.

h1. Design

h2. Model

*ContentGuard (MasterModel)*
- name (unique)
- description (optional)

*Distirbution* (new fields)
- content_guard (foreign key, optional)

h2. Routes

GET /pulp/api/v3/content-guards/<type>/ /pulp/api/v3/content_guards/<type>/

POST /pulp/api/v3/content-guards/<type>/ /pulp/api/v3/content_guards/<type>/

GET /pulp/api/v3/content-guards/<type>/<id>/ /pulp/api/v3/content_guards/<type>/<id>/

PUT/PATCH /pulp/api/v3/content-guards/<type>/<id>/ /pulp/api/v3/content_guards/<type>/<id>/

DELETE /pulp/api/v3/content-guards/<type>/<id>/ /pulp/api/v3/content_guards/<type>/<id>/