summaryrefslogtreecommitdiffstats
path: root/routers/web/web.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/web/web.go')
-rw-r--r--routers/web/web.go20
1 files changed, 18 insertions, 2 deletions
diff --git a/routers/web/web.go b/routers/web/web.go
index acce071891..656cd52b54 100644
--- a/routers/web/web.go
+++ b/routers/web/web.go
@@ -427,8 +427,8 @@ func RegisterRoutes(m *web.Route) {
m.Post("/{id}", bindIgnErr(forms.EditOAuth2ApplicationForm{}), user_setting.OAuthApplicationsEdit)
m.Post("/{id}/regenerate_secret", user_setting.OAuthApplicationsRegenerateSecret)
m.Post("", bindIgnErr(forms.EditOAuth2ApplicationForm{}), user_setting.OAuthApplicationsPost)
- m.Post("/delete", user_setting.DeleteOAuth2Application)
- m.Post("/revoke", user_setting.RevokeOAuth2Grant)
+ m.Post("/{id}/delete", user_setting.DeleteOAuth2Application)
+ m.Post("/{id}/revoke/{grantId}", user_setting.RevokeOAuth2Grant)
})
m.Combo("/applications").Get(user_setting.Applications).
Post(bindIgnErr(forms.NewAccessTokenForm{}), user_setting.ApplicationsPost)
@@ -662,6 +662,20 @@ func RegisterRoutes(m *web.Route) {
Post(bindIgnErr(forms.UpdateOrgSettingForm{}), org.SettingsPost)
m.Post("/avatar", bindIgnErr(forms.AvatarForm{}), org.SettingsAvatar)
m.Post("/avatar/delete", org.SettingsDeleteAvatar)
+ m.Group("/applications", func() {
+ m.Get("", org.Applications)
+ m.Post("/oauth2", bindIgnErr(forms.EditOAuth2ApplicationForm{}), org.OAuthApplicationsPost)
+ m.Group("/oauth2/{id}", func() {
+ m.Combo("").Get(org.OAuth2ApplicationShow).Post(bindIgnErr(forms.EditOAuth2ApplicationForm{}), org.OAuth2ApplicationEdit)
+ m.Post("/regenerate_secret", org.OAuthApplicationsRegenerateSecret)
+ m.Post("/delete", org.DeleteOAuth2Application)
+ })
+ }, func(ctx *context.Context) {
+ if !setting.OAuth2.Enable {
+ ctx.Error(http.StatusForbidden)
+ return
+ }
+ })
m.Group("/hooks", func() {
m.Get("", org.Webhooks)
@@ -702,6 +716,8 @@ func RegisterRoutes(m *web.Route) {
})
m.Route("/delete", "GET,POST", org.SettingsDelete)
+ }, func(ctx *context.Context) {
+ ctx.Data["EnableOAuth2"] = setting.OAuth2.Enable
})
}, context.OrgAssignment(true, true))
}, reqSignIn)