Backend: Repository permissions for campaigns
Created by: mrnugget
Taken from RFC 157.
Status: Tasks are final.
Backend Tasks
-
Split up the PatchandExternalChangesettypes in the GraphQL schema intoPatch/HiddenPatchandExternalChangeset/HiddenExternalChangeset. The types should implement the same interface, respectively, which only has the fields that the "hidden" version should contain:-
HiddenPatch: only has theidfield -
HiddenExternalChangeset: only has theid,createdAt,updatedAt,nextSyncAt,campaigns
-
-
In every ChangesetsConnectionreturn aHiddenExternalChangesetwhen the user doesn't have access to the underlying repository -
In every PatchesConnectionreturn aHiddenPatchwhen the user doesn't have access to the underlying repository -
In ChangesetByID,PatchByIDreturn "not found" if the user doesn't have access to the repository -
In Campaign.status.errorsfilter out the errors if the user doesn't have access to the underlying repositories. -
In Campaign.diffStatdo not include stats for patches/changesets the user doesn't have access to -
In PatchSet.diffStatdo not include stats for patches/changesets the user doesn't have access to -
Updating a campaign: - filter out all the existing changesets the user does not have access to, keep them untouched.
- Do not close/update/create changesets the user does not have access to.
- Make sure that this applies to "update changeset with new title/description" too!
-
Check repository permissions for access in following mutations and return an error if user has no access: -
publishChangeset- return "not found" if user has no access -
publishCampaignChangesets- only publish the changesets the user has access to -
addChangesetsToCampaign- filter out changesets user doesn't have access to and return error (see existing error for "not found") -
(Invalid now that draft campaigns have been removed)createCampaign- Skip publication of all patches from patchset the user doesn't have access to. -
retryCampaign— same aspublishCampaignChangesets: only retry the changesets the user has access to -
updateCampaign- see previous task -
createChangesets- filter out repositories dosn't have access to and return error (see existing error for "not found") -
syncChangeset- return "not found" if user has no access -
closeCampaign- leave changesets untouched if user has no access to them -
deleteCampaign- leave changesets untouched if user has no access to them
-
-
Filter out hidden changesets when using filters other than status. -
Include hidden changesets in openChangesetsquery resolver. -
Filter out patches in CreatePatchSetFromPatches
Notes
authzFilter is the canonical way to filter a list of *types.Repo down to a subset of repositories a user has access to. See here