@@ -155,13 +155,13 @@ func GetEditorconfig(ctx *context.APIContext) {
155
155
ctx .JSON (http .StatusOK , def )
156
156
}
157
157
158
- // CanWriteFiles returns true if repository is editable and user has proper access level.
159
- func CanWriteFiles (r * context.Repository ) bool {
158
+ // canWriteFiles returns true if repository is editable and user has proper access level.
159
+ func canWriteFiles (r * context.Repository ) bool {
160
160
return r .Permission .CanWrite (models .UnitTypeCode ) && ! r .Repository .IsMirror && ! r .Repository .IsArchived
161
161
}
162
162
163
- // CanReadFiles returns true if repository is readable and user has proper access level.
164
- func CanReadFiles (r * context.Repository ) bool {
163
+ // canReadFiles returns true if repository is readable and user has proper access level.
164
+ func canReadFiles (r * context.Repository ) bool {
165
165
return r .Permission .CanRead (models .UnitTypeCode )
166
166
}
167
167
@@ -321,7 +321,7 @@ func UpdateFile(ctx *context.APIContext, apiOpts api.UpdateFileOptions) {
321
321
322
322
// Called from both CreateFile or UpdateFile to handle both
323
323
func createOrUpdateFile (ctx * context.APIContext , opts * repofiles.UpdateRepoFileOptions ) (* api.FileResponse , error ) {
324
- if ! CanWriteFiles (ctx .Repo ) {
324
+ if ! canWriteFiles (ctx .Repo ) {
325
325
return nil , models.ErrUserDoesNotHaveAccessToRepo {
326
326
UserID : ctx .User .ID ,
327
327
RepoName : ctx .Repo .Repository .LowerName ,
@@ -377,7 +377,7 @@ func DeleteFile(ctx *context.APIContext, apiOpts api.DeleteFileOptions) {
377
377
// "404":
378
378
// "$ref": "#/responses/error"
379
379
380
- if ! CanWriteFiles (ctx .Repo ) {
380
+ if ! canWriteFiles (ctx .Repo ) {
381
381
ctx .Error (http .StatusForbidden , "DeleteFile" , models.ErrUserDoesNotHaveAccessToRepo {
382
382
UserID : ctx .User .ID ,
383
383
RepoName : ctx .Repo .Repository .LowerName ,
@@ -474,7 +474,7 @@ func GetContents(ctx *context.APIContext) {
474
474
// "404":
475
475
// "$ref": "#/responses/notFound"
476
476
477
- if ! CanReadFiles (ctx .Repo ) {
477
+ if ! canReadFiles (ctx .Repo ) {
478
478
ctx .Error (http .StatusInternalServerError , "GetContentsOrList" , models.ErrUserDoesNotHaveAccessToRepo {
479
479
UserID : ctx .User .ID ,
480
480
RepoName : ctx .Repo .Repository .LowerName ,
0 commit comments