Update GraphQL mutation to support multi-level permissions
Created by: unknwon
Context: https://github.com/sourcegraph/sourcegraph/pull/10774#discussion_r427416571
This GraphQL mutation says it "sets...a full set", implying it overwrites all previous permissions for the repository. That makes sense and feels right.
However, what about when we support multiple permission levels (not just
READ
)? Then this no longer makes sense (because if you wanted to set some users asREAD
and some asADMIN
, then the 2nd operation to setADMIN
users would clear theREAD
users). I think we would need the API to be something like:type Mutation { setRepositoryPermissionsForUsers( repository: ID! userPermissions: [UserPermission!]! ) } input UserPermission { user: ID! permission: RepositoryPermission! }
This might not seem like a problem now because we only support
READ
, but it will create confusion and extra work for our customers, so I think we should fix it ASAP.