@@ -211,14 +211,14 @@ func Search(ctx *context.APIContext) {
211211 })
212212 return
213213 }
214- accessMode , err := access_model .AccessLevel (ctx , ctx .Doer , repo )
214+ permission , err := access_model .GetUserRepoPermission (ctx , repo , ctx .Doer )
215215 if err != nil {
216216 ctx .JSON (http .StatusInternalServerError , api.SearchError {
217217 OK : false ,
218218 Error : err .Error (),
219219 })
220220 }
221- results [i ] = convert .ToRepo (ctx , repo , accessMode )
221+ results [i ] = convert .ToRepo (ctx , repo , permission )
222222 }
223223 ctx .SetLinkHeader (int (count ), opts .PageSize )
224224 ctx .SetTotalCountHeader (count )
@@ -272,7 +272,7 @@ func CreateUserRepo(ctx *context.APIContext, owner *user_model.User, opt api.Cre
272272 ctx .Error (http .StatusInternalServerError , "GetRepositoryByID" , err )
273273 }
274274
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 } ))
276276}
277277
278278// Create one repository of mine
@@ -419,7 +419,7 @@ func Generate(ctx *context.APIContext) {
419419 }
420420 log .Trace ("Repository generated [%d]: %s/%s" , repo .ID , ctxUser .Name , repo .Name )
421421
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 } ))
423423}
424424
425425// CreateOrgRepoDeprecated create one repository of the organization
@@ -537,7 +537,7 @@ func Get(ctx *context.APIContext) {
537537 return
538538 }
539539
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 ))
541541}
542542
543543// GetByID returns a single Repository
@@ -568,15 +568,15 @@ func GetByID(ctx *context.APIContext) {
568568 return
569569 }
570570
571- perm , err := access_model .GetUserRepoPermission (ctx , repo , ctx .Doer )
571+ permission , err := access_model .GetUserRepoPermission (ctx , repo , ctx .Doer )
572572 if err != nil {
573- ctx .Error (http .StatusInternalServerError , "AccessLevel " , err )
573+ ctx .Error (http .StatusInternalServerError , "GetUserRepoPermission " , err )
574574 return
575- } else if ! perm .HasAccess () {
575+ } else if ! permission .HasAccess () {
576576 ctx .NotFound ()
577577 return
578578 }
579- ctx .JSON (http .StatusOK , convert .ToRepo (ctx , repo , perm . AccessMode ))
579+ ctx .JSON (http .StatusOK , convert .ToRepo (ctx , repo , permission ))
580580}
581581
582582// Edit edit repository properties
@@ -638,7 +638,7 @@ func Edit(ctx *context.APIContext) {
638638 return
639639 }
640640
641- ctx .JSON (http .StatusOK , convert .ToRepo (ctx , repo , ctx .Repo .AccessMode ))
641+ ctx .JSON (http .StatusOK , convert .ToRepo (ctx , repo , ctx .Repo .Permission ))
642642}
643643
644644// updateBasicProperties updates the basic properties of a repo: Name, Description, Website and Visibility
0 commit comments