@@ -8,7 +8,6 @@ package private
88import (
99 "strings"
1010
11- "code.gitea.io/gitea/models"
1211 "code.gitea.io/gitea/modules/log"
1312 "code.gitea.io/gitea/modules/private"
1413 "code.gitea.io/gitea/modules/setting"
@@ -27,55 +26,6 @@ func CheckInternalToken(ctx *macaron.Context) {
2726 }
2827}
2928
30- //GetRepositoryByOwnerAndName chainload to models.GetRepositoryByOwnerAndName
31- func GetRepositoryByOwnerAndName (ctx * macaron.Context ) {
32- //TODO use repo.Get(ctx *context.APIContext) ?
33- ownerName := ctx .Params (":owner" )
34- repoName := ctx .Params (":repo" )
35- repo , err := models .GetRepositoryByOwnerAndName (ownerName , repoName )
36- if err != nil {
37- ctx .JSON (500 , map [string ]interface {}{
38- "err" : err .Error (),
39- })
40- return
41- }
42- ctx .JSON (200 , repo )
43- }
44-
45- //CheckUnitUser chainload to models.CheckUnitUser
46- func CheckUnitUser (ctx * macaron.Context ) {
47- repoID := ctx .ParamsInt64 (":repoid" )
48- userID := ctx .ParamsInt64 (":userid" )
49- repo , err := models .GetRepositoryByID (repoID )
50- if err != nil {
51- ctx .JSON (500 , map [string ]interface {}{
52- "err" : err .Error (),
53- })
54- return
55- }
56-
57- var user * models.User
58- if userID > 0 {
59- user , err = models .GetUserByID (userID )
60- if err != nil {
61- ctx .JSON (500 , map [string ]interface {}{
62- "err" : err .Error (),
63- })
64- return
65- }
66- }
67-
68- perm , err := models .GetUserRepoPermission (repo , user )
69- if err != nil {
70- ctx .JSON (500 , map [string ]interface {}{
71- "err" : err .Error (),
72- })
73- return
74- }
75-
76- ctx .JSON (200 , perm .UnitAccessMode (models .UnitType (ctx .QueryInt ("unitType" ))))
77- }
78-
7929// RegisterRoutes registers all internal APIs routes to web application.
8030// These APIs will be invoked by internal commands for example `gitea serv` and etc.
8131func RegisterRoutes (m * macaron.Macaron ) {
0 commit comments