@@ -211,14 +211,14 @@ func Search(ctx *context.APIContext) {
211
211
})
212
212
return
213
213
}
214
- accessMode , err := access_model .AccessLevel (ctx , ctx .Doer , repo )
214
+ permission , err := access_model .GetUserRepoPermission (ctx , repo , ctx .Doer )
215
215
if err != nil {
216
216
ctx .JSON (http .StatusInternalServerError , api.SearchError {
217
217
OK : false ,
218
218
Error : err .Error (),
219
219
})
220
220
}
221
- results [i ] = convert .ToRepo (ctx , repo , accessMode )
221
+ results [i ] = convert .ToRepo (ctx , repo , permission )
222
222
}
223
223
ctx .SetLinkHeader (int (count ), opts .PageSize )
224
224
ctx .SetTotalCountHeader (count )
@@ -272,7 +272,7 @@ func CreateUserRepo(ctx *context.APIContext, owner *user_model.User, opt api.Cre
272
272
ctx .Error (http .StatusInternalServerError , "GetRepositoryByID" , err )
273
273
}
274
274
275
- ctx .JSON (http .StatusCreated , convert .ToRepo (ctx , repo , perm .AccessModeOwner ))
275
+ ctx .JSON (http .StatusCreated , convert .ToRepo (ctx , repo , access_model. Permission { AccessMode : perm .AccessModeOwner } ))
276
276
}
277
277
278
278
// Create one repository of mine
@@ -419,7 +419,7 @@ func Generate(ctx *context.APIContext) {
419
419
}
420
420
log .Trace ("Repository generated [%d]: %s/%s" , repo .ID , ctxUser .Name , repo .Name )
421
421
422
- ctx .JSON (http .StatusCreated , convert .ToRepo (ctx , repo , perm .AccessModeOwner ))
422
+ ctx .JSON (http .StatusCreated , convert .ToRepo (ctx , repo , access_model. Permission { AccessMode : perm .AccessModeOwner } ))
423
423
}
424
424
425
425
// CreateOrgRepoDeprecated create one repository of the organization
@@ -537,7 +537,7 @@ func Get(ctx *context.APIContext) {
537
537
return
538
538
}
539
539
540
- ctx .JSON (http .StatusOK , convert .ToRepo (ctx , ctx .Repo .Repository , ctx .Repo .AccessMode ))
540
+ ctx .JSON (http .StatusOK , convert .ToRepo (ctx , ctx .Repo .Repository , ctx .Repo .Permission ))
541
541
}
542
542
543
543
// GetByID returns a single Repository
@@ -568,15 +568,15 @@ func GetByID(ctx *context.APIContext) {
568
568
return
569
569
}
570
570
571
- perm , err := access_model .GetUserRepoPermission (ctx , repo , ctx .Doer )
571
+ permission , err := access_model .GetUserRepoPermission (ctx , repo , ctx .Doer )
572
572
if err != nil {
573
- ctx .Error (http .StatusInternalServerError , "AccessLevel " , err )
573
+ ctx .Error (http .StatusInternalServerError , "GetUserRepoPermission " , err )
574
574
return
575
- } else if ! perm .HasAccess () {
575
+ } else if ! permission .HasAccess () {
576
576
ctx .NotFound ()
577
577
return
578
578
}
579
- ctx .JSON (http .StatusOK , convert .ToRepo (ctx , repo , perm . AccessMode ))
579
+ ctx .JSON (http .StatusOK , convert .ToRepo (ctx , repo , permission ))
580
580
}
581
581
582
582
// Edit edit repository properties
@@ -638,7 +638,7 @@ func Edit(ctx *context.APIContext) {
638
638
return
639
639
}
640
640
641
- ctx .JSON (http .StatusOK , convert .ToRepo (ctx , repo , ctx .Repo .AccessMode ))
641
+ ctx .JSON (http .StatusOK , convert .ToRepo (ctx , repo , ctx .Repo .Permission ))
642
642
}
643
643
644
644
// updateBasicProperties updates the basic properties of a repo: Name, Description, Website and Visibility
0 commit comments