77 "net/http"
88
99 actions_model "code.gitea.io/gitea/models/actions"
10- "code.gitea.io/gitea/services/context"
1110 api "code.gitea.io/gitea/modules/structs"
1211 "code.gitea.io/gitea/modules/web"
12+ "code.gitea.io/gitea/services/context"
1313)
1414
1515// GetActionsPermissions returns the Actions token permissions for an organization
@@ -36,7 +36,7 @@ func GetActionsPermissions(ctx *context.APIContext) {
3636 // Only org owners should be able to modify these settings.
3737 isOwner , err := ctx .Org .Organization .IsOwnedBy (ctx , ctx .Doer .ID )
3838 if err != nil {
39- ctx .APIError ( http . StatusInternalServerError , err )
39+ ctx .APIErrorInternal ( err )
4040 return
4141 } else if ! isOwner {
4242 ctx .APIError (http .StatusForbidden , "You must be an organization owner" )
@@ -45,7 +45,7 @@ func GetActionsPermissions(ctx *context.APIContext) {
4545
4646 perms , err := actions_model .GetOrgActionPermissions (ctx , ctx .Org .Organization .ID )
4747 if err != nil {
48- ctx .APIError ( http . StatusInternalServerError , err )
48+ ctx .APIErrorInternal ( err )
4949 return
5050 }
5151
@@ -131,7 +131,7 @@ func UpdateActionsPermissions(ctx *context.APIContext) {
131131 }
132132
133133 if err := actions_model .CreateOrUpdateOrgPermissions (ctx , perm ); err != nil {
134- ctx .APIError ( http . StatusInternalServerError , err )
134+ ctx .APIErrorInternal ( err )
135135 return
136136 }
137137
@@ -177,7 +177,7 @@ func ListCrossRepoAccess(ctx *context.APIContext) {
177177
178178 rules , err := actions_model .ListCrossRepoAccessRules (ctx , ctx .Org .Organization .ID )
179179 if err != nil {
180- ctx .APIError ( http . StatusInternalServerError , err )
180+ ctx .APIErrorInternal ( err )
181181 return
182182 }
183183
@@ -245,7 +245,7 @@ func AddCrossRepoAccess(ctx *context.APIContext) {
245245 }
246246
247247 if err := actions_model .CreateCrossRepoAccess (ctx , rule ); err != nil {
248- ctx .APIError ( http . StatusInternalServerError , err )
248+ ctx .APIErrorInternal ( err )
249249 return
250250 }
251251
@@ -300,7 +300,7 @@ func DeleteCrossRepoAccess(ctx *context.APIContext) {
300300 }
301301
302302 if err := actions_model .DeleteCrossRepoAccess (ctx , ruleID ); err != nil {
303- ctx .APIError ( http . StatusInternalServerError , err )
303+ ctx .APIErrorInternal ( err )
304304 return
305305 }
306306
@@ -336,4 +336,3 @@ func convertToCrossRepoAccessRule(rule *actions_model.ActionCrossRepoAccess) *ap
336336 AccessLevel : rule .AccessLevel ,
337337 }
338338}
339-
0 commit comments