1
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-12-04 14:46:57 -05:00
gitea/models/migrations
zeripath 5d2e11eedb
Refactor: Move login out of models (#16199)
`models` does far too much. In particular it handles all `UserSignin`.

It shouldn't be responsible for calling LDAP, SMTP or PAM for signing in.

Therefore we should move this code out of `models`.

This code has to depend on `models` - therefore it belongs in `services`.

There is a package in `services` called `auth` and clearly this functionality belongs in there.

Plan:

- [x] Change `auth.Auth` to `auth.Method` - as they represent methods of authentication.
- [x] Move `models.UserSignIn` into `auth`
- [x] Move `models.ExternalUserLogin`
- [x] Move most of the `LoginVia*` methods to `auth` or subpackages
- [x] Move Resynchronize functionality to `auth`
  - Involved some restructuring of `models/ssh_key.go` to reduce the size of this massive file and simplify its files.
- [x] Move the rest of the LDAP functionality in to the ldap subpackage
- [x] Re-factor the login sources to express an interfaces `auth.Source`?
  - I've done this through some smaller interfaces Authenticator and Synchronizable - which would allow us to extend things in future
- [x] Now LDAP is out of models - need to think about modules/auth/ldap and I think all of that functionality might just be moveable
- [x] Similarly a lot Oauth2 functionality need not be in models too and should be moved to services/auth/source/oauth2
  - [x] modules/auth/oauth2/oauth2.go uses xorm... This is naughty - probably need to move this into models.
  - [x] models/oauth2.go - mostly should be in modules/auth/oauth2 or services/auth/source/oauth2 
- [x] More simplifications of login_source.go may need to be done
- Allow wiring in of notify registration -  *this can now easily be done - but I think we should do it in another PR*  - see #16178 
- More refactors...?
  - OpenID should probably become an auth Method but I think that can be left for another PR
  - Methods should also probably be cleaned up  - again another PR I think.
  - SSPI still needs more refactors.* Rename auth.Auth auth.Method
* Restructure ssh_key.go

- move functions from models/user.go that relate to ssh_key to ssh_key
- split ssh_key.go to try create clearer function domains for allow for
future refactors here.

Signed-off-by: Andrew Thornton <art27@cantab.net>
2021-07-24 11:16:34 +01:00
..
fixtures
migrations_test.go Refactor: Move login out of models (#16199) 2021-07-24 11:16:34 +01:00
migrations.go
testlogger_test.go
v70.go chore(models): rewrite code format. (#14754) 2021-03-14 19:52:12 +01:00
v71.go
v72.go
v73.go Upgrade xorm to v0.8.0 (#8536) 2019-10-17 11:26:49 +02:00
v74.go Upgrade xorm to v0.8.0 (#8536) 2019-10-17 11:26:49 +02:00
v75.go
v76.go
v77.go Upgrade xorm to v0.8.0 (#8536) 2019-10-17 11:26:49 +02:00
v78.go
v79.go
v80.go Upgrade xorm to v0.8.0 (#8536) 2019-10-17 11:26:49 +02:00
v81.go
v82.go
v83.go
v84.go Upgrade xorm to v0.8.0 (#8536) 2019-10-17 11:26:49 +02:00
v85.go
v86.go
v87.go Upgrade xorm to v0.8.0 (#8536) 2019-10-17 11:26:49 +02:00
v88.go
v89.go
v90.go Upgrade xorm to v0.8.0 (#8536) 2019-10-17 11:26:49 +02:00
v91.go Upgrade xorm to v0.8.0 (#8536) 2019-10-17 11:26:49 +02:00
v92.go chore(models): rewrite code format. (#14754) 2021-03-14 19:52:12 +01:00
v93.go Upgrade xorm to v0.8.0 (#8536) 2019-10-17 11:26:49 +02:00
v94.go Upgrade xorm to v0.8.0 (#8536) 2019-10-17 11:26:49 +02:00
v95.go Upgrade xorm to v0.8.0 (#8536) 2019-10-17 11:26:49 +02:00
v96.go
v97.go Upgrade xorm to v0.8.0 (#8536) 2019-10-17 11:26:49 +02:00
v98.go
v99.go
v100.go
v101.go Allow more than 255 characters for tokens in external_login_user table (#8554) 2019-10-18 09:58:36 +03:00
v102.go
v103.go Allow Protected Branches to Whitelist Deploy Keys (#8483) 2019-10-21 09:21:45 +01:00
v104.go
v105.go chore(models): rewrite code format. (#14754) 2021-03-14 19:52:12 +01:00
v106.go Auto-subscribe user to repository when they commit/tag to it (#7657) 2019-11-10 09:22:19 +00:00
v107.go
v108.go
v109.go
v110.go
v111.go Fix various documentation, user-facing, and source comment typos (#16367) 2021-07-08 13:38:13 +02:00
v112.go Add a storage layer for attachments (#11387) 2020-08-18 12:23:45 +08:00
v113.go
v114.go
v115.go chore(models): rewrite code format. (#14754) 2021-03-14 19:52:12 +01:00
v116.go
v117.go Add branch protection option to block merge on requested changes. (#9592) 2020-01-03 19:47:09 +02:00
v118.go Mark PR reviews as stale at push and allow to dismiss stale approvals (#9532) 2020-01-09 01:47:45 +00:00
v119.go Refactor: Remove Dependencys from Migration v112-v119 (#11811) 2020-06-09 16:34:05 -04:00
v120.go
v121.go Restricted users (#6274) 2020-01-13 18:33:46 +01:00
v122.go
v123.go
v124.go
v125.go Migrate reviews when migrating repository from github (#9463) 2020-01-23 19:28:15 +02:00
v126.go Update topics repo count when deleting repository (#10051) 2020-01-31 08:57:19 +02:00
v127.go
v128.go
v129.go
v130.go chore(models): rewrite code format. (#14754) 2021-03-14 19:52:12 +01:00
v131.go System-wide webhooks (#10546) 2020-03-09 00:08:05 +02:00
v132.go
v133.go make avatar lookup occur at image request (#10540) 2020-03-27 14:34:39 +02:00
v134.go chore(models): rewrite code format. (#14754) 2021-03-14 19:52:12 +01:00
v135.go Add Organization Wide Labels (#10814) 2020-04-01 01:14:46 -03:00
v136.go chore(models): rewrite code format. (#14754) 2021-03-14 19:52:12 +01:00
v137.go Prevent merge of outdated PRs on protected branches (#11012) 2020-04-16 22:00:36 -03:00
v138.go
v139.go Fix issue ref migration (#11419) 2020-05-15 15:05:18 +01:00
v140.go Change language statistics to save size instead of percentage (#11681) 2020-05-30 10:46:15 +03:00
v141.go Fix migration v141 (#14387) 2021-01-28 23:58:33 +01:00
v142.go Add migration to set IsArchived false if it is null (#11853) 2020-06-11 16:18:11 -04:00
v143.go Decrease the num_stars when deleting a repo (#11954) 2020-07-07 15:16:34 -04:00
v144.go chore(models): rewrite code format. (#14754) 2021-03-14 19:52:12 +01:00
v145.go Fix Migration 145 on MSSQL if varchar is changed to nvarchar (#12445) 2020-08-10 16:01:10 +03:00
v146.go chore(models): rewrite code format. (#14754) 2021-03-14 19:52:12 +01:00
v147.go
v148.go
v149.go Add Created & Updated to Milestone (#12662) 2020-09-05 13:38:54 -04:00
v150.go Add Primary Key to Topic and RepoTopic (#12639) 2020-09-10 20:45:01 +01:00
v151.go Add migration for password algorithm change (#12784) 2020-09-15 18:02:41 -04:00
v152.go Add configurable Trust Models (#11712) 2020-09-20 00:44:55 +08:00
v153.go
v154.go Save TimeStamps for Star, Label, Follow, Watch and Collaboration to Database (#13124) 2020-10-12 20:01:57 -04:00
v155.go
v156.go
v157.go chore(models): rewrite code format. (#14754) 2021-03-14 19:52:12 +01:00
v158.go
v159.go Include OriginalAuthor in Reaction constraint (#13505) 2020-11-10 22:37:11 +00:00
v160.go Add block on official review requests branch protection (#13705) 2020-11-28 21:30:46 +02:00
v161.go
v162.go Add support for corporate WeChat webhooks (#15910) 2021-07-23 12:41:27 +08:00
v163.go Change topic name size from 25 to 50 (#14150) 2020-12-26 23:28:47 +00:00
v164.go Minimal OpenID Connect implementation (#14139) 2021-01-02 00:33:27 +08:00
v165.go
v166.go Remove unused commit (#14741) 2021-02-20 15:02:39 +01:00
v167.go
v168.go
v169.go
v170.go Add dismiss review feature (#12674) 2021-02-11 18:32:25 +01:00
v171.go Add v171 (addSortingColToProjectBoard) migration for #14634 (#14652) 2021-02-12 13:01:26 +02:00
v172.go v172 migration adds created_unix field instead of expiry (#15458) 2021-04-13 20:04:17 -04:00
v173.go Add UI to delete tracked times (#14100) 2021-02-19 12:52:11 +02:00
v174.go
v175.go Fix postgres ID sequences broken by recreate-table (#15015) 2021-03-18 02:06:40 -04:00
v176_test.go Create Proper Migration Tests (#15116) 2021-03-24 19:27:22 +01:00
v176.go Create Proper Migration Tests (#15116) 2021-03-24 19:27:22 +01:00
v177_test.go
v177.go Create Proper Migration Tests (#15116) 2021-03-24 19:27:22 +01:00
v178.go
v179.go OAuth2 auto-register (#5123) 2021-04-14 14:02:12 +02:00
v180.go v180 migration should be standalone (#16151) 2021-06-14 15:07:49 -04:00
v181_test.go
v181.go Rework repository archive (#14723) 2021-06-23 17:12:38 -04:00
v182_test.go Add a new table issue_index to store the max issue index so that issue could be deleted with no duplicated index (#15599) 2021-06-14 10:22:55 +08:00
v182.go
v183.go
v184.go Add Status Updates whilst Gitea migrations are occurring (#15076) 2021-06-16 18:02:24 -04:00
v185.go
v186.go
v187.go
v188.go Add option to provide signature for a token to verify key ownership (#14054) 2021-07-13 15:28:07 +02:00
v189_test.go
v189.go