gitea/routers/api/v1/repo
zeripath 01c10a951b
Fix ssh deploy and user key constraints (#1357) (#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-03 23:56:53 +00:00
..
branch.go Fixes repo branch endpoint summary (#4893) 2018-09-09 11:36:08 +08:00
collaborators.go Restrict permission check on repositories and fix some problems (#5314) 2018-11-28 19:26:14 +08:00
commits.go Add single commit API support (#5843) 2019-02-02 22:35:17 -05:00
file.go Refactor repo.isBare to repo.isEmpty #5629 (#5714) 2019-01-17 19:01:04 -05:00
fork.go Restrict permission check on repositories and fix some problems (#5314) 2018-11-28 19:26:14 +08:00
git_ref.go Implement git refs API for listing references (branches, tags and other) (#5354) 2018-11-27 16:52:20 -05:00
hook_test.go API endpoint for testing webhook (#3550) 2018-04-29 14:21:33 +08:00
hook.go Fix Swagger JSON autogeneration issues. (#4845) 2018-10-20 23:40:42 -04:00
issue_comment.go Refactor notification for indexer (#5111) 2019-01-17 22:23:22 +08:00
issue_label.go Restrict permission check on repositories and fix some problems (#5314) 2018-11-28 19:26:14 +08:00
issue_tracked_time.go Fix Swagger JSON autogeneration issues. (#4845) 2018-10-20 23:40:42 -04:00
issue.go Issue is not overdue when it is on the same date #5566 (#5568) 2019-01-01 18:56:47 +01:00
key.go Fix ssh deploy and user key constraints (#1357) (#5939) 2019-02-03 23:56:53 +00:00
label.go Restrict permission check on repositories and fix some problems (#5314) 2018-11-28 19:26:14 +08:00
main_test.go API endpoint for testing webhook (#3550) 2018-04-29 14:21:33 +08:00
milestone.go show only opened milestones on issues page milestone filter (#5051) 2018-11-26 16:45:42 +08:00
pull.go Improve performance of dashboard (#4977) 2018-12-13 10:55:43 -05:00
release_attachment.go Fix Swagger JSON autogeneration issues. (#4845) 2018-10-20 23:40:42 -04:00
release.go Fix new release creation API to allow empty target (#5870) 2019-01-30 11:33:00 -05:00
repo.go admin should be able to delete repos even if he is not a member of the organization (#5443) 2018-12-02 11:08:33 -05:00
star.go refactor: import order. (#3736) 2018-03-29 21:32:40 +08:00
status.go refactor: import order. (#3736) 2018-03-29 21:32:40 +08:00
subscriber.go refactor: import order. (#3736) 2018-03-29 21:32:40 +08:00
tree.go Added docs for the tree api (#5834) 2019-01-24 13:13:30 -05:00