mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-24 10:06:16 -06:00
enforce scopes
This commit is contained in:
parent
e3857b90bb
commit
21d9edac54
191 changed files with 1473 additions and 648 deletions
|
|
@ -63,7 +63,7 @@ import (
|
|||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// - admin:write:accounts
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
|
|
@ -86,9 +86,12 @@ import (
|
|||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) AccountActionPOSTHandler(c *gin.Context) {
|
||||
authed, err := apiutil.TokenAuth(c, true, true, true, true)
|
||||
if err != nil {
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGetV1)
|
||||
authed, errWithCode := apiutil.TokenAuth(c,
|
||||
true, true, true, true,
|
||||
apiutil.ScopeAdminWriteAccounts,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ import (
|
|||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// - admin:write:accounts
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
|
|
@ -67,9 +67,12 @@ import (
|
|||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) AccountApprovePOSTHandler(c *gin.Context) {
|
||||
authed, err := apiutil.TokenAuth(c, true, true, true, true)
|
||||
if err != nil {
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGetV1)
|
||||
authed, errWithCode := apiutil.TokenAuth(c,
|
||||
true, true, true, true,
|
||||
apiutil.ScopeAdminWriteAccounts,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ import (
|
|||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// - admin:read:accounts
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
|
|
@ -67,9 +67,12 @@ import (
|
|||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) AccountGETHandler(c *gin.Context) {
|
||||
authed, err := apiutil.TokenAuth(c, true, true, true, true)
|
||||
if err != nil {
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGetV1)
|
||||
authed, errWithCode := apiutil.TokenAuth(c,
|
||||
true, true, true, true,
|
||||
apiutil.ScopeAdminReadAccounts,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ import (
|
|||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// - admin:write:accounts
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
|
|
@ -89,9 +89,12 @@ import (
|
|||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) AccountRejectPOSTHandler(c *gin.Context) {
|
||||
authed, err := apiutil.TokenAuth(c, true, true, true, true)
|
||||
if err != nil {
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGetV1)
|
||||
authed, errWithCode := apiutil.TokenAuth(c,
|
||||
true, true, true, true,
|
||||
apiutil.ScopeAdminWriteAccounts,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@
|
|||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// - admin:read:accounts
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
|
|
@ -186,9 +186,12 @@ import (
|
|||
)
|
||||
|
||||
func (m *Module) AccountsGETV1Handler(c *gin.Context) {
|
||||
authed, err := apiutil.TokenAuth(c, true, true, true, true)
|
||||
if err != nil {
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGetV1)
|
||||
authed, errWithCode := apiutil.TokenAuth(c,
|
||||
true, true, true, true,
|
||||
apiutil.ScopeAdminReadAccounts,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@
|
|||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// - admin:read:accounts
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
|
|
@ -159,9 +159,12 @@ import (
|
|||
)
|
||||
|
||||
func (m *Module) AccountsGETV2Handler(c *gin.Context) {
|
||||
authed, err := apiutil.TokenAuth(c, true, true, true, true)
|
||||
if err != nil {
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGetV1)
|
||||
authed, errWithCode := apiutil.TokenAuth(c,
|
||||
true, true, true, true,
|
||||
apiutil.ScopeAdminReadAccounts,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ import (
|
|||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// - admin:write
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
|
|
@ -89,7 +89,7 @@ func (m *Module) DebugAPUrlHandler(c *gin.Context) {}
|
|||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// - admin:write
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
|
|
|
|||
|
|
@ -30,9 +30,12 @@ import (
|
|||
)
|
||||
|
||||
func (m *Module) DebugAPUrlHandler(c *gin.Context) {
|
||||
authed, err := apiutil.Authed(c, true, true, true, true)
|
||||
if err != nil {
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGetV1)
|
||||
authed, errWithCode := apiutil.TokenAuth(c,
|
||||
true, true, true, true,
|
||||
apiutil.ScopeAdminWrite,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -57,9 +60,12 @@ func (m *Module) DebugAPUrlHandler(c *gin.Context) {
|
|||
}
|
||||
|
||||
func (m *Module) DebugClearCachesHandler(c *gin.Context) {
|
||||
authed, err := apiutil.Authed(c, true, true, true, true)
|
||||
if err != nil {
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGetV1)
|
||||
authed, errWithCode := apiutil.TokenAuth(c,
|
||||
true, true, true, true,
|
||||
apiutil.ScopeAdminWrite,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ import (
|
|||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// - admin:write:domain_allows
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ import (
|
|||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// - admin:write:domain_allows
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ import (
|
|||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// - admin:read:domain_allows
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ import (
|
|||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// - admin:read:domain_allows
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ import (
|
|||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// - admin:write:domain_blocks
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ import (
|
|||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// - admin:write:domain_blocks
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ import (
|
|||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// - admin:read:domain_blocks
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ import (
|
|||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// - admin:read:domain_blocks
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ import (
|
|||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// - admin:write
|
||||
//
|
||||
// responses:
|
||||
// '202':
|
||||
|
|
@ -94,9 +94,12 @@ import (
|
|||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) DomainKeysExpirePOSTHandler(c *gin.Context) {
|
||||
authed, err := apiutil.TokenAuth(c, true, true, true, true)
|
||||
if err != nil {
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGetV1)
|
||||
authed, errWithCode := apiutil.TokenAuth(c,
|
||||
true, true, true, true,
|
||||
apiutil.ScopeAdminWrite,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -62,9 +62,20 @@ func (m *Module) createDomainPermissions(
|
|||
single singleDomainPermCreate,
|
||||
multi multiDomainPermCreate,
|
||||
) {
|
||||
authed, err := apiutil.TokenAuth(c, true, true, true, true)
|
||||
if err != nil {
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGetV1)
|
||||
// Scope differs based on permType.
|
||||
var requireScope apiutil.Scope
|
||||
if permType == gtsmodel.DomainPermissionBlock {
|
||||
requireScope = apiutil.ScopeAdminWriteDomainBlocks
|
||||
} else {
|
||||
requireScope = apiutil.ScopeAdminWriteDomainAllows
|
||||
}
|
||||
|
||||
authed, errWithCode := apiutil.TokenAuth(c,
|
||||
true, true, true, true,
|
||||
requireScope,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -97,6 +108,7 @@ func (m *Module) createDomainPermissions(
|
|||
return
|
||||
}
|
||||
|
||||
var err error
|
||||
if importing && form.Domains.Size == 0 {
|
||||
err = errors.New("import was specified but list of domains is empty")
|
||||
} else if !importing && form.Domain == "" {
|
||||
|
|
@ -170,9 +182,20 @@ func (m *Module) deleteDomainPermission(
|
|||
c *gin.Context,
|
||||
permType gtsmodel.DomainPermissionType, // block/allow
|
||||
) {
|
||||
authed, err := apiutil.TokenAuth(c, true, true, true, true)
|
||||
if err != nil {
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGetV1)
|
||||
// Scope differs based on permType.
|
||||
var requireScope apiutil.Scope
|
||||
if permType == gtsmodel.DomainPermissionBlock {
|
||||
requireScope = apiutil.ScopeAdminWriteDomainBlocks
|
||||
} else {
|
||||
requireScope = apiutil.ScopeAdminWriteDomainAllows
|
||||
}
|
||||
|
||||
authed, errWithCode := apiutil.TokenAuth(c,
|
||||
true, true, true, true,
|
||||
requireScope,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -217,9 +240,20 @@ func (m *Module) getDomainPermission(
|
|||
c *gin.Context,
|
||||
permType gtsmodel.DomainPermissionType,
|
||||
) {
|
||||
authed, err := apiutil.TokenAuth(c, true, true, true, true)
|
||||
if err != nil {
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGetV1)
|
||||
// Scope differs based on permType.
|
||||
var requireScope apiutil.Scope
|
||||
if permType == gtsmodel.DomainPermissionBlock {
|
||||
requireScope = apiutil.ScopeAdminReadDomainBlocks
|
||||
} else {
|
||||
requireScope = apiutil.ScopeAdminReadDomainAllows
|
||||
}
|
||||
|
||||
authed, errWithCode := apiutil.TokenAuth(c,
|
||||
true, true, true, true,
|
||||
requireScope,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -265,9 +299,20 @@ func (m *Module) getDomainPermissions(
|
|||
c *gin.Context,
|
||||
permType gtsmodel.DomainPermissionType,
|
||||
) {
|
||||
authed, err := apiutil.TokenAuth(c, true, true, true, true)
|
||||
if err != nil {
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGetV1)
|
||||
// Scope differs based on permType.
|
||||
var requireScope apiutil.Scope
|
||||
if permType == gtsmodel.DomainPermissionBlock {
|
||||
requireScope = apiutil.ScopeAdminReadDomainBlocks
|
||||
} else {
|
||||
requireScope = apiutil.ScopeAdminReadDomainAllows
|
||||
}
|
||||
|
||||
authed, errWithCode := apiutil.TokenAuth(c,
|
||||
true, true, true, true,
|
||||
requireScope,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ import (
|
|||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// - admin:write
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
|
|
@ -80,9 +80,9 @@ import (
|
|||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) DomainPermissionDraftAcceptPOSTHandler(c *gin.Context) {
|
||||
authed, err := apiutil.TokenAuth(c, true, true, true, true)
|
||||
if err != nil {
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGetV1)
|
||||
authed, errWithCode := apiutil.TokenAuth(c, true, true, true, true)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ import (
|
|||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// - admin:write
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
|
|
@ -98,9 +98,12 @@ import (
|
|||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) DomainPermissionDraftsPOSTHandler(c *gin.Context) {
|
||||
authed, err := apiutil.TokenAuth(c, true, true, true, true)
|
||||
if err != nil {
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGetV1)
|
||||
authed, errWithCode := apiutil.TokenAuth(c,
|
||||
true, true, true, true,
|
||||
apiutil.ScopeAdminWrite,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ import (
|
|||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// - admin:read
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
|
|
@ -65,9 +65,12 @@ import (
|
|||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) DomainPermissionDraftGETHandler(c *gin.Context) {
|
||||
authed, err := apiutil.TokenAuth(c, true, true, true, true)
|
||||
if err != nil {
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGetV1)
|
||||
authed, errWithCode := apiutil.TokenAuth(c,
|
||||
true, true, true, true,
|
||||
apiutil.ScopeAdminRead,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ import (
|
|||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// - admin:write
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
|
|
@ -80,9 +80,12 @@ import (
|
|||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) DomainPermissionDraftRemovePOSTHandler(c *gin.Context) {
|
||||
authed, err := apiutil.TokenAuth(c, true, true, true, true)
|
||||
if err != nil {
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGetV1)
|
||||
authed, errWithCode := apiutil.TokenAuth(c,
|
||||
true, true, true, true,
|
||||
apiutil.ScopeAdminWrite,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ import (
|
|||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// - admin:read
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
|
|
@ -124,9 +124,12 @@ import (
|
|||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) DomainPermissionDraftsGETHandler(c *gin.Context) {
|
||||
authed, err := apiutil.TokenAuth(c, true, true, true, true)
|
||||
if err != nil {
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGetV1)
|
||||
authed, errWithCode := apiutil.TokenAuth(c,
|
||||
true, true, true, true,
|
||||
apiutil.ScopeAdminRead,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ import (
|
|||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// - admin:write
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
|
|
@ -81,9 +81,12 @@ import (
|
|||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) DomainPermissionExcludesPOSTHandler(c *gin.Context) {
|
||||
authed, err := apiutil.TokenAuth(c, true, true, true, true)
|
||||
if err != nil {
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGetV1)
|
||||
authed, errWithCode := apiutil.TokenAuth(c,
|
||||
true, true, true, true,
|
||||
apiutil.ScopeAdminWrite,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ import (
|
|||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// - admin:read
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
|
|
@ -65,9 +65,12 @@ import (
|
|||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) DomainPermissionExcludeGETHandler(c *gin.Context) {
|
||||
authed, err := apiutil.TokenAuth(c, true, true, true, true)
|
||||
if err != nil {
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGetV1)
|
||||
authed, errWithCode := apiutil.TokenAuth(c,
|
||||
true, true, true, true,
|
||||
apiutil.ScopeAdminRead,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ import (
|
|||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// - admin:write
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
|
|
@ -67,9 +67,12 @@ import (
|
|||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) DomainPermissionExcludeDELETEHandler(c *gin.Context) {
|
||||
authed, err := apiutil.TokenAuth(c, true, true, true, true)
|
||||
if err != nil {
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGetV1)
|
||||
authed, errWithCode := apiutil.TokenAuth(c,
|
||||
true, true, true, true,
|
||||
apiutil.ScopeAdminWrite,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ import (
|
|||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// - admin:read
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
|
|
@ -112,9 +112,12 @@ import (
|
|||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) DomainPermissionExcludesGETHandler(c *gin.Context) {
|
||||
authed, err := apiutil.TokenAuth(c, true, true, true, true)
|
||||
if err != nil {
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGetV1)
|
||||
authed, errWithCode := apiutil.TokenAuth(c,
|
||||
true, true, true, true,
|
||||
apiutil.ScopeAdminRead,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ import (
|
|||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// - admin:write
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
|
|
@ -144,9 +144,12 @@ import (
|
|||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) DomainPermissionSubscriptionPOSTHandler(c *gin.Context) {
|
||||
authed, err := apiutil.TokenAuth(c, true, true, true, true)
|
||||
if err != nil {
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGetV1)
|
||||
authed, errWithCode := apiutil.TokenAuth(c,
|
||||
true, true, true, true,
|
||||
apiutil.ScopeAdminWrite,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ import (
|
|||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// - admin:read
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
|
|
@ -65,9 +65,12 @@ import (
|
|||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) DomainPermissionSubscriptionGETHandler(c *gin.Context) {
|
||||
authed, err := apiutil.TokenAuth(c, true, true, true, true)
|
||||
if err != nil {
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGetV1)
|
||||
authed, errWithCode := apiutil.TokenAuth(c,
|
||||
true, true, true, true,
|
||||
apiutil.ScopeAdminRead,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ import (
|
|||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// - admin:write
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
|
|
@ -87,9 +87,12 @@ import (
|
|||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) DomainPermissionSubscriptionRemovePOSTHandler(c *gin.Context) {
|
||||
authed, err := apiutil.TokenAuth(c, true, true, true, true)
|
||||
if err != nil {
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGetV1)
|
||||
authed, errWithCode := apiutil.TokenAuth(c,
|
||||
true, true, true, true,
|
||||
apiutil.ScopeAdminWrite,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ import (
|
|||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// - admin:read
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
|
|
@ -114,9 +114,12 @@ import (
|
|||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) DomainPermissionSubscriptionsGETHandler(c *gin.Context) {
|
||||
authed, err := apiutil.TokenAuth(c, true, true, true, true)
|
||||
if err != nil {
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGetV1)
|
||||
authed, errWithCode := apiutil.TokenAuth(c,
|
||||
true, true, true, true,
|
||||
apiutil.ScopeAdminRead,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ import (
|
|||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// - admin:read
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
|
|
@ -73,9 +73,12 @@ import (
|
|||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) DomainPermissionSubscriptionsPreviewGETHandler(c *gin.Context) {
|
||||
authed, err := apiutil.TokenAuth(c, true, true, true, true)
|
||||
if err != nil {
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGetV1)
|
||||
authed, errWithCode := apiutil.TokenAuth(c,
|
||||
true, true, true, true,
|
||||
apiutil.ScopeAdminRead,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ import (
|
|||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// - admin:write
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
|
|
@ -75,9 +75,12 @@ import (
|
|||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) DomainPermissionSubscriptionTestPOSTHandler(c *gin.Context) {
|
||||
authed, err := apiutil.TokenAuth(c, true, true, true, true)
|
||||
if err != nil {
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGetV1)
|
||||
authed, errWithCode := apiutil.TokenAuth(c,
|
||||
true, true, true, true,
|
||||
apiutil.ScopeAdminWrite,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ import (
|
|||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// - admin:write
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
|
|
@ -140,9 +140,12 @@ import (
|
|||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) DomainPermissionSubscriptionPATCHHandler(c *gin.Context) {
|
||||
authed, err := apiutil.TokenAuth(c, true, true, true, true)
|
||||
if err != nil {
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGetV1)
|
||||
authed, errWithCode := apiutil.TokenAuth(c,
|
||||
true, true, true, true,
|
||||
apiutil.ScopeAdminWrite,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ import (
|
|||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// - admin:write
|
||||
//
|
||||
// responses:
|
||||
// '202':
|
||||
|
|
@ -86,9 +86,12 @@ import (
|
|||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) EmailTestPOSTHandler(c *gin.Context) {
|
||||
authed, err := apiutil.TokenAuth(c, true, true, true, true)
|
||||
if err != nil {
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGetV1)
|
||||
authed, errWithCode := apiutil.TokenAuth(c,
|
||||
true, true, true, true,
|
||||
apiutil.ScopeAdminWrite,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -120,7 +123,7 @@ func (m *Module) EmailTestPOSTHandler(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
errWithCode := m.processor.Admin().EmailTest(
|
||||
errWithCode = m.processor.Admin().EmailTest(
|
||||
c.Request.Context(),
|
||||
authed.Account,
|
||||
email.Address,
|
||||
|
|
|
|||
|
|
@ -37,6 +37,10 @@ import (
|
|||
// produces:
|
||||
// - application/json
|
||||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin:read
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
// description: Array of existing emoji categories.
|
||||
|
|
@ -57,9 +61,12 @@ import (
|
|||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) EmojiCategoriesGETHandler(c *gin.Context) {
|
||||
authed, err := apiutil.TokenAuth(c, true, true, true, true)
|
||||
if err != nil {
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGetV1)
|
||||
authed, errWithCode := apiutil.TokenAuth(c,
|
||||
true, true, true, true,
|
||||
apiutil.ScopeAdminRead,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ import (
|
|||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// - admin:write
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
|
|
@ -97,9 +97,12 @@ import (
|
|||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) EmojiCreatePOSTHandler(c *gin.Context) {
|
||||
authed, err := apiutil.TokenAuth(c, true, true, true, true)
|
||||
if err != nil {
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGetV1)
|
||||
authed, errWithCode := apiutil.TokenAuth(c,
|
||||
true, true, true, true,
|
||||
apiutil.ScopeAdminWrite,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ import (
|
|||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// - admin:write
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
|
|
@ -73,9 +73,12 @@ import (
|
|||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) EmojiDELETEHandler(c *gin.Context) {
|
||||
authed, err := apiutil.TokenAuth(c, true, true, true, true)
|
||||
if err != nil {
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGetV1)
|
||||
authed, errWithCode := apiutil.TokenAuth(c,
|
||||
true, true, true, true,
|
||||
apiutil.ScopeAdminWrite,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,6 +45,10 @@ import (
|
|||
// in: path
|
||||
// required: true
|
||||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin:read
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
// description: A single emoji.
|
||||
|
|
@ -63,9 +67,12 @@ import (
|
|||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) EmojiGETHandler(c *gin.Context) {
|
||||
authed, err := apiutil.TokenAuth(c, true, true, true, true)
|
||||
if err != nil {
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGetV1)
|
||||
authed, errWithCode := apiutil.TokenAuth(c,
|
||||
true, true, true, true,
|
||||
apiutil.ScopeAdminRead,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -98,6 +98,10 @@ import (
|
|||
// Emoji with the given `[shortcode]@[domain]` will not be included in the result set.
|
||||
// in: query
|
||||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin:read
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
// headers:
|
||||
|
|
@ -122,9 +126,12 @@ import (
|
|||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) EmojisGETHandler(c *gin.Context) {
|
||||
authed, err := apiutil.TokenAuth(c, true, true, true, true)
|
||||
if err != nil {
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGetV1)
|
||||
authed, errWithCode := apiutil.TokenAuth(c,
|
||||
true, true, true, true,
|
||||
apiutil.ScopeAdminRead,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ import (
|
|||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// - admin:write
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
|
|
@ -124,9 +124,12 @@ import (
|
|||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) EmojiPATCHHandler(c *gin.Context) {
|
||||
authed, err := apiutil.TokenAuth(c, true, true, true, true)
|
||||
if err != nil {
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGetV1)
|
||||
authed, errWithCode := apiutil.TokenAuth(c,
|
||||
true, true, true, true,
|
||||
apiutil.ScopeAdminWrite,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,9 +31,11 @@ import (
|
|||
|
||||
// getHeaderFilter is a gin handler function that returns details of an HTTP header filter with provided ID, using given get function.
|
||||
func (m *Module) getHeaderFilter(c *gin.Context, get func(context.Context, string) (*apimodel.HeaderFilter, gtserror.WithCode)) {
|
||||
authed, err := apiutil.TokenAuth(c, true, true, true, true)
|
||||
if err != nil {
|
||||
errWithCode := gtserror.NewErrorUnauthorized(err, err.Error())
|
||||
authed, errWithCode := apiutil.TokenAuth(c,
|
||||
true, true, true, true,
|
||||
apiutil.ScopeAdminRead,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
|
@ -68,9 +70,11 @@ func (m *Module) getHeaderFilter(c *gin.Context, get func(context.Context, strin
|
|||
|
||||
// getHeaderFilters is a gin handler function that returns details of all HTTP header filters using given get function.
|
||||
func (m *Module) getHeaderFilters(c *gin.Context, get func(context.Context) ([]*apimodel.HeaderFilter, gtserror.WithCode)) {
|
||||
authed, err := apiutil.TokenAuth(c, true, true, true, true)
|
||||
if err != nil {
|
||||
errWithCode := gtserror.NewErrorUnauthorized(err, err.Error())
|
||||
authed, errWithCode := apiutil.TokenAuth(c,
|
||||
true, true, true, true,
|
||||
apiutil.ScopeAdminRead,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
|
@ -99,9 +103,11 @@ func (m *Module) getHeaderFilters(c *gin.Context, get func(context.Context) ([]*
|
|||
|
||||
// createHeaderFilter is a gin handler function that creates a HTTP header filter entry using provided form data, passing to given create function.
|
||||
func (m *Module) createHeaderFilter(c *gin.Context, create func(context.Context, *gtsmodel.Account, *apimodel.HeaderFilterRequest) (*apimodel.HeaderFilter, gtserror.WithCode)) {
|
||||
authed, err := apiutil.TokenAuth(c, true, true, true, true)
|
||||
if err != nil {
|
||||
errWithCode := gtserror.NewErrorUnauthorized(err, err.Error())
|
||||
authed, errWithCode := apiutil.TokenAuth(c,
|
||||
true, true, true, true,
|
||||
apiutil.ScopeAdminWrite,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
|
@ -147,9 +153,11 @@ func (m *Module) createHeaderFilter(c *gin.Context, create func(context.Context,
|
|||
|
||||
// deleteHeaderFilter is a gin handler function that deletes an HTTP header filter with provided ID, using given delete function.
|
||||
func (m *Module) deleteHeaderFilter(c *gin.Context, delete func(context.Context, string) gtserror.WithCode) {
|
||||
authed, err := apiutil.TokenAuth(c, true, true, true, true)
|
||||
if err != nil {
|
||||
errWithCode := gtserror.NewErrorUnauthorized(err, err.Error())
|
||||
authed, errWithCode := apiutil.TokenAuth(c,
|
||||
true, true, true, true,
|
||||
apiutil.ScopeAdminWrite,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ import (
|
|||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// - admin:write
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
|
|
@ -82,7 +82,7 @@ func (m *Module) HeaderFilterAllowPOST(c *gin.Context) {
|
|||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// - admin:write
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ import (
|
|||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// - admin:write
|
||||
//
|
||||
// responses:
|
||||
// '202':
|
||||
|
|
@ -76,7 +76,7 @@ func (m *Module) HeaderFilterAllowDELETE(c *gin.Context) {
|
|||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// - admin:write
|
||||
//
|
||||
// responses:
|
||||
// '202':
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ import "github.com/gin-gonic/gin"
|
|||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// - admin:read
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
|
|
@ -76,7 +76,7 @@ func (m *Module) HeaderFilterAllowGET(c *gin.Context) {
|
|||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// - admin:read
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ import (
|
|||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// - admin:write
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
|
|
@ -68,9 +68,12 @@ import (
|
|||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) MediaCleanupPOSTHandler(c *gin.Context) {
|
||||
authed, err := apiutil.TokenAuth(c, true, true, true, true)
|
||||
if err != nil {
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGetV1)
|
||||
authed, errWithCode := apiutil.TokenAuth(c,
|
||||
true, true, true, true,
|
||||
apiutil.ScopeAdminWrite,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ import (
|
|||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// - admin:write
|
||||
//
|
||||
// parameters:
|
||||
// -
|
||||
|
|
@ -70,9 +70,12 @@ import (
|
|||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) MediaRefetchPOSTHandler(c *gin.Context) {
|
||||
authed, err := apiutil.TokenAuth(c, true, true, true, true)
|
||||
if err != nil {
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGetV1)
|
||||
authed, errWithCode := apiutil.TokenAuth(c,
|
||||
true, true, true, true,
|
||||
apiutil.ScopeAdminWrite,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ import (
|
|||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// - admin:read:reports
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
|
|
@ -66,9 +66,12 @@ import (
|
|||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) ReportGETHandler(c *gin.Context) {
|
||||
authed, err := apiutil.TokenAuth(c, true, true, true, true)
|
||||
if err != nil {
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGetV1)
|
||||
authed, errWithCode := apiutil.TokenAuth(c,
|
||||
true, true, true, true,
|
||||
apiutil.ScopeAdminReadReports,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ import (
|
|||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// - admin:write:reports
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
|
|
@ -83,9 +83,12 @@ import (
|
|||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) ReportResolvePOSTHandler(c *gin.Context) {
|
||||
authed, err := apiutil.TokenAuth(c, true, true, true, true)
|
||||
if err != nil {
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGetV1)
|
||||
authed, errWithCode := apiutil.TokenAuth(c,
|
||||
true, true, true, true,
|
||||
apiutil.ScopeAdminWriteReports,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ import (
|
|||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// - admin:read:reports
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
|
|
@ -124,9 +124,12 @@ import (
|
|||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) ReportsGETHandler(c *gin.Context) {
|
||||
authed, err := apiutil.TokenAuth(c, true, true, true, true)
|
||||
if err != nil {
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGetV1)
|
||||
authed, errWithCode := apiutil.TokenAuth(c,
|
||||
true, true, true, true,
|
||||
apiutil.ScopeAdminReadReports,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ import (
|
|||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// - admin:write
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
|
|
@ -64,9 +64,12 @@ import (
|
|||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) RulePOSTHandler(c *gin.Context) {
|
||||
authed, err := apiutil.TokenAuth(c, true, true, true, true)
|
||||
if err != nil {
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGetV1)
|
||||
authed, errWithCode := apiutil.TokenAuth(c,
|
||||
true, true, true, true,
|
||||
apiutil.ScopeAdminWrite,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ import (
|
|||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// - admin:write
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
|
|
@ -71,9 +71,12 @@ import (
|
|||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) RuleDELETEHandler(c *gin.Context) {
|
||||
authed, err := apiutil.TokenAuth(c, true, true, true, true)
|
||||
if err != nil {
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGetV1)
|
||||
authed, errWithCode := apiutil.TokenAuth(c,
|
||||
true, true, true, true,
|
||||
apiutil.ScopeAdminWrite,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ import (
|
|||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// - admin:read
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
|
|
@ -66,9 +66,12 @@ import (
|
|||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) RuleGETHandler(c *gin.Context) {
|
||||
authed, err := apiutil.TokenAuth(c, true, true, true, true)
|
||||
if err != nil {
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGetV1)
|
||||
authed, errWithCode := apiutil.TokenAuth(c,
|
||||
true, true, true, true,
|
||||
apiutil.ScopeAdminRead,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ import (
|
|||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// - admin:read
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
|
|
@ -63,9 +63,12 @@ import (
|
|||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) RulesGETHandler(c *gin.Context) {
|
||||
authed, err := apiutil.TokenAuth(c, true, true, true, true)
|
||||
if err != nil {
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGetV1)
|
||||
authed, errWithCode := apiutil.TokenAuth(c,
|
||||
true, true, true, true,
|
||||
apiutil.ScopeAdminRead,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ import (
|
|||
//
|
||||
// security:
|
||||
// - OAuth2 Bearer:
|
||||
// - admin
|
||||
// - admin:write
|
||||
//
|
||||
// responses:
|
||||
// '200':
|
||||
|
|
@ -63,9 +63,12 @@ import (
|
|||
// '500':
|
||||
// description: internal server error
|
||||
func (m *Module) RulePATCHHandler(c *gin.Context) {
|
||||
authed, err := apiutil.TokenAuth(c, true, true, true, true)
|
||||
if err != nil {
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGetV1)
|
||||
authed, errWithCode := apiutil.TokenAuth(c,
|
||||
true, true, true, true,
|
||||
apiutil.ScopeAdminWrite,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue