gitea/routers/api/v1
zeripath 6416f06508
Fix ssh deploy and user key constraints (#1357) (#5939) (#5966)
Backport of #5939 

1. A key can either be an ssh user key or a deploy key. It cannot be both.
2. If a key is a user key - it can only be associated with one user.
3. If a key is a deploy key - it can be used in multiple repositories and the permissions it has on those repositories can be different.
4. If a repository is deleted, its deploy keys must be deleted too.

We currently don't enforce any of this and multiple repositories access with different permissions doesn't work at all. This PR enforces the following constraints:

- [x] You should not be able to add the same user key as another user
- [x] You should not be able to add a ssh user key which is being used as a deploy key
- [x] You should not be able to add a ssh deploy key which is being used as a user key
- [x] If you add an ssh deploy key to another repository you should be able to use it in different modes without losing the ability to use it in the other mode.
- [x] If you delete a repository you must delete all its deploy keys.

Fix #1357
2019-02-04 21:41:03 +00:00
..
admin Fix Swagger JSON autogeneration issues. (#4845) 2018-10-20 23:40:42 -04:00
convert Fix create team, update team missing units (#5188) 2018-11-10 14:45:32 -05:00
misc Swagger.v1.json template (#3572) 2018-07-28 03:19:01 +03:00
org Delete organization endpoint added (#5601) 2018-12-27 16:36:58 +01:00
repo Fix ssh deploy and user key constraints (#1357) (#5939) (#5966) 2019-02-04 21:41:03 +00:00
swagger Added docs for the tree api (#5835) 2019-01-24 20:40:54 +02:00
user Restrict permission check on repositories and fix some problems (#5314) 2018-11-28 19:26:14 +08:00
utils Slack webhook channel name cannot be empty or just contain an hashtag (#4786) 2018-09-10 10:31:08 -04:00
api.go API: Fix null pointer in attempt to Sudo if not logged in (#5872) (#5884) 2019-01-28 20:26:55 +00:00