hypothesis / hypothesis/product-backlog

Eliminate the permissions data structure from the API

Open
#386 3 comments 0 reactions 0 assignees View on GitHub
API
Dominant language
No language data
Stars
122
Forks
7
PR merge metrics
No merged PRs in 30d

Description

## Problem you are trying to address with this feature

In the current API, one of the fields we expect clients to pass in is the `permissions` field. This structure takes the form:

```json
{
"read": ["group:__world__"],
"admin": ["acct:bob@example.com"],
"update": ["acct:bob@example.com"],
"delete": ["acct:bob@example.com"]
}
```

Or, for an annotation only visible to its author:

```json
{
"read": ["acct:bob@example.com"],
"admin": ["acct:bob@example.com"],
"update": ["acct:bob@example.com"],
"delete": ["acct:bob@example.com"]
}
```

Internally, we throw the vast majority of this away and reduce it to a single `shared` Boolean, then recreate this data structure to pass the annotation back out through the API.

This is one of the issues @sean-roberts brought up in #252 when trying to build an API client. It makes the API needlessly complicated, and the documentation doesn’t give nearly enough information for someone to be able to recreate this data structure without spelunking through the source code.

## Your solution

I can see two options here:

* Introduce a Boolean `shared` field into the API, and deprecate the `permissions` data structure. We can still leave it in as a fallback for a while, so as not to break existing clients, but once our metrics indicate that few enough people are using it that we can drop support, we should do that.
* If we migrate our API design such that [groups are our top-level resource](https://notes.wtk.io/2017/07/24/api-scribblings), we can potentially eliminate the concept of explicit annotation permissions entirely, and have everything specified by the permissions on the group.

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue names no files, tests, or entry points. Start by reviewing the current API implementation and client usage of the permissions structure, then resolve whether the shared-field migration or group-based redesign is in scope; done requires an agreed API change and compatibility or deprecation plan.

Written by the indexing model from the issue text.

Assessment

Domain
api, backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.