You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
forgejo/models
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
5 years ago
..
fixtures Ensure valid git author names passed in signatures (#5774) 6 years ago
migrations Fix failing migration v67 (#5849) 6 years ago
access.go Restrict permission check on repositories and fix some problems (#5314) 6 years ago
access_test.go Restrict permission check on repositories and fix some problems (#5314) 6 years ago
action.go Refactor repo.isBare to repo.isEmpty #5629 (#5714) 6 years ago
action_list.go refactor: reduce sql query in retrieveFeeds (#3547) 6 years ago
action_test.go Don't close issues via commits on non-default branch. (#5622) 6 years ago
admin.go Refactor struct's time to remove unnecessary memory usage (#3142) 7 years ago
admin_test.go Fix tests code to prevent some runtime errors (#2381) 7 years ago
attachment.go Added URL mapping for Release attachments like on github.com (#1707) 6 years ago
attachment_test.go Add Attachment API (#3478) 6 years ago
branches.go fix log output (#5938) 5 years ago
branches_test.go Add deleted_branch table fixture (#2832) 7 years ago
consistency.go Fix activity feed (#1779) 7 years ago
error.go Pull request review/approval and comment on code (#3748) 6 years ago
error_oauth2.go gofmt (#1662) 7 years ago
external_login_user.go Add primary key and index to external login user table (#1656) 7 years ago
git_diff.go Fix regex to support optional end line of old section in diff hunk (#5096) 6 years ago
git_diff_test.go Pull request review/approval and comment on code (#3748) 6 years ago
gpg_key.go Fix null pointer dereference in ParseCommitWithSignature (#4962) 6 years ago
gpg_key_test.go Refactor struct's time to remove unnecessary memory usage (#3142) 7 years ago
graph.go Make max commits in graph configurable (#4498) 6 years ago
graph_test.go Accept 'Data:' in commit graph (#4487) 6 years ago
helper.go Add reactions to issues/PR and comments (#2856) 7 years ago
issue.go Add the ability to use multiple labels as filters(#5786) 6 years ago
issue_assignees.go Fix sqlite deadlock when assigning to a PR (#5640) 6 years ago
issue_assignees_test.go Improve performance of dashboard (#4977) 6 years ago
issue_comment.go support reviewing on a deleted file path (#5880) 5 years ago
issue_comment_list.go Improve performance of dashboard (#4977) 6 years ago
issue_comment_test.go Pull request review/approval and comment on code (#3748) 6 years ago
issue_dependency.go fix sqlite lock (#5184) 6 years ago
issue_dependency_test.go Fix an error while adding a dependency via UI. (#5862) 6 years ago
issue_indexer.go Refactor notification for indexer (#5111) 6 years ago
issue_label.go Add the ability to use multiple labels as filters(#5786) 6 years ago
issue_label_test.go Fix tests code to prevent some runtime errors (#2381) 7 years ago
issue_list.go fix bugs when too many IN variables (#4594) 6 years ago
issue_list_test.go Shows total tracked time in issue and milestone list (#3341) 6 years ago
issue_mail.go Also ensure the repo is loaded (#5895) 5 years ago
issue_milestone.go Milestone issues and pull requests (#5293) 6 years ago
issue_milestone_test.go Add more webhooks support and refactor webhook templates directory (#3929) 6 years ago
issue_reaction.go Refactor struct's time to remove unnecessary memory usage (#3142) 7 years ago
issue_reaction_test.go Ensure valid git author names passed in signatures (#5774) 6 years ago
issue_stopwatch.go Improve performance of dashboard (#4977) 6 years ago
issue_stopwatch_test.go Refactor struct's time to remove unnecessary memory usage (#3142) 7 years ago
issue_test.go Add the ability to use multiple labels as filters(#5786) 6 years ago
issue_tracked_time.go Improve performance of dashboard (#4977) 6 years ago
issue_tracked_time_test.go Feature: Timetracking (#2211) 7 years ago
issue_user.go Fix sqlite deadlock when assigning to a PR (#5640) 6 years ago
issue_user_test.go Multiple assignees (#3705) 6 years ago
issue_watch.go Update xorm to latest version and fix correct `user` table referencing in sql (#4473) 6 years ago
issue_watch_test.go Hide unactive on explore users and some refactors (#2741) 7 years ago
lfs.go Pooled and buffered gzip implementation (#5722) 6 years ago
lfs_lock.go Restrict permission check on repositories and fix some problems (#5314) 6 years ago
login_source.go Only allow local login if password is non-empty (#5906) 5 years ago
mail.go Improve performance of dashboard (#4977) 6 years ago
main_test.go Unit tests for wiki routers (#3022) 7 years ago
models.go Added test environment for mssql (#4282) 6 years ago
models_sqlite.go go vet 10 years ago
models_test.go Change parsing of postgresql settings (#4275) 6 years ago
notification.go Fix sqlite lock (#5176) 6 years ago
notification_test.go Add 'mark all read' option to notifications (#3097) 7 years ago
oauth2.go Discord Oauth2 support (#4476) 6 years ago
org.go api: Add missing GET teams endpoints (#5382) 6 years ago
org_team.go Config option to disable automatic repo watching (#5852) 6 years ago
org_team_test.go api: Add missing GET teams endpoints (#5382) 6 years ago
org_test.go Restrict permission check on repositories and fix some problems (#5314) 6 years ago
pull.go fix delete correct temp directory (#5839) 6 years ago
pull_test.go Disable merging a WIP Pull request (#4529) 6 years ago
release.go Added URL mapping for Release attachments like on github.com (#1707) 6 years ago
release_test.go mirror: Delete tags in mirror which are removed for original repo. (#5609) 6 years ago
repo.go Fix ssh deploy and user key constraints (#1357) (#5939) 5 years ago
repo_activity.go Add issue closed time column to fix activity closed issues list (#3537) 6 years ago
repo_branch.go Create new branch from branch selection dropdown (#2130) 7 years ago
repo_collaboration.go Fix not removed watches on unallowed repositories (#4201) 6 years ago
repo_collaboration_test.go Unit tests for models/repo_collaboration (#1032) 7 years ago
repo_editor.go Code/repo search (#2582) 7 years ago
repo_indexer.go Update code.gitea.io/git (#3482) 6 years ago
repo_issue.go Add EnableTimetracking option to app settings (#3719) 6 years ago
repo_list.go This commit will reduce join star, repo_topic, topic tables on repo search, so that fix extra columns problem on mssql (#5136) 6 years ago
repo_list_test.go This commit will reduce join star, repo_topic, topic tables on repo search, so that fix extra columns problem on mssql (#5136) 6 years ago
repo_mirror.go Add option to disable automatic mirror syncing. (#5242) 6 years ago
repo_permission.go Restrict permission check on repositories and fix some problems (#5314) 6 years ago
repo_permission_test.go Restrict permission check on repositories and fix some problems (#5314) 6 years ago
repo_redirect.go Redirects for renamed repos (#807) 8 years ago
repo_redirect_test.go Unit tests for repo redirects (#961) 7 years ago
repo_test.go Fix repo-transfer-and-team-repo-count bug (#3241) 7 years ago
repo_unit.go Add rebase with merge commit merge style (#3844) (#4052) 6 years ago
repo_watch.go Fix sqlite deadlock when assigning to a PR (#5640) 6 years ago
repo_watch_test.go Hide unactive on explore users and some refactors (#2741) 7 years ago
review.go Webhook for Pull Request approval/rejection (#5027) 6 years ago
review_test.go Show review summary in pull requests (#5132) 6 years ago
ssh_key.go Fix ssh deploy and user key constraints (#1357) (#5939) 5 years ago
ssh_key_test.go Use assert in legacy unit tests (#867) 7 years ago
star.go Ensure that sessions are passed into queries that could use the database to prevent deadlocks (#5718) 6 years ago
star_test.go Fix tests code to prevent some runtime errors (#2381) 7 years ago
status.go Fix race on updatesize (#5190) 6 years ago
status_test.go Fix tests code to prevent some runtime errors (#2381) 7 years ago
test_fixtures.go Increase the retry limit to 20 times and the interval to 200ms (#5134) 6 years ago
token.go Refactor struct's time to remove unnecessary memory usage (#3142) 7 years ago
token_test.go Fix tests code to prevent some runtime errors (#2381) 7 years ago
topic.go fix topic name length on database (#5493) 6 years ago
topic_test.go feat(repo): support search repository by topic name (#4505) 6 years ago
twofactor.go Switch plaintext scratch tokens to use hash instead (#4331) 6 years ago
u2f.go Add support for FIDO U2F (#3971) 6 years ago
u2f_test.go Add support for FIDO U2F (#3971) 6 years ago
unit.go Fix create team, update team missing units (#5188) 6 years ago
unit_tests.go User action heatmap (#5131) 6 years ago
update.go Improve performance of dashboard (#4977) 6 years ago
update_test.go Fix tests code to prevent some runtime errors (#2381) 7 years ago
user.go Don't discard the value of DISABLE_REGULAR_ORG_CREATION (#5886) 5 years ago
user_follow.go Refactor session close as xorm already does everything needed internally (#2020) 7 years ago
user_follow_test.go Move user_follow to separate file (#1210) 7 years ago
user_heatmap.go Only count users own actions for heatmap contributions (#5647) 6 years ago
user_heatmap_test.go Fix JSON result of empty array (#5154) 6 years ago
user_mail.go Replace deprecated Id method with ID (#2655) 7 years ago
user_mail_test.go Fix tests code to prevent some runtime errors (#2381) 7 years ago
user_openid.go Fix SQL quoting (#5117) 6 years ago
user_openid_test.go Fix tests code to prevent some runtime errors (#2381) 7 years ago
user_test.go Don't discard the value of DISABLE_REGULAR_ORG_CREATION (#5886) 5 years ago
webhook.go Webhook for Pull Request approval/rejection (#5027) 6 years ago
webhook_dingtalk.go Webhook for Pull Request approval/rejection (#5027) 6 years ago
webhook_discord.go Webhook for Pull Request approval/rejection (#5027) 6 years ago
webhook_slack.go handle milestone events for issues and PR (#5947) 5 years ago
webhook_test.go Add more webhooks support and refactor webhook templates directory (#3929) 6 years ago
wiki.go Fix deadlock when sqlite (#5118) 6 years ago
wiki_test.go test: reduce testing time. (#3885) 6 years ago