summaryrefslogtreecommitdiffstats
path: root/api4
diff options
context:
space:
mode:
Diffstat (limited to 'api4')
-rw-r--r--api4/saml.go15
-rw-r--r--api4/user_test.go11
2 files changed, 12 insertions, 14 deletions
diff --git a/api4/saml.go b/api4/saml.go
index ba9ee9eec..b2f2b3eef 100644
--- a/api4/saml.go
+++ b/api4/saml.go
@@ -8,7 +8,6 @@ import (
"net/http"
l4g "github.com/alecthomas/log4go"
- "github.com/mattermost/mattermost-server/app"
"github.com/mattermost/mattermost-server/model"
"github.com/mattermost/mattermost-server/utils"
)
@@ -73,7 +72,7 @@ func addSamlPublicCertificate(c *Context, w http.ResponseWriter, r *http.Request
return
}
- if err := app.AddSamlPublicCertificate(fileData); err != nil {
+ if err := c.App.AddSamlPublicCertificate(fileData); err != nil {
c.Err = err
return
}
@@ -92,7 +91,7 @@ func addSamlPrivateCertificate(c *Context, w http.ResponseWriter, r *http.Reques
return
}
- if err := app.AddSamlPrivateCertificate(fileData); err != nil {
+ if err := c.App.AddSamlPrivateCertificate(fileData); err != nil {
c.Err = err
return
}
@@ -111,7 +110,7 @@ func addSamlIdpCertificate(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
- if err := app.AddSamlIdpCertificate(fileData); err != nil {
+ if err := c.App.AddSamlIdpCertificate(fileData); err != nil {
c.Err = err
return
}
@@ -124,7 +123,7 @@ func removeSamlPublicCertificate(c *Context, w http.ResponseWriter, r *http.Requ
return
}
- if err := app.RemoveSamlPublicCertificate(); err != nil {
+ if err := c.App.RemoveSamlPublicCertificate(); err != nil {
c.Err = err
return
}
@@ -138,7 +137,7 @@ func removeSamlPrivateCertificate(c *Context, w http.ResponseWriter, r *http.Req
return
}
- if err := app.RemoveSamlPrivateCertificate(); err != nil {
+ if err := c.App.RemoveSamlPrivateCertificate(); err != nil {
c.Err = err
return
}
@@ -152,7 +151,7 @@ func removeSamlIdpCertificate(c *Context, w http.ResponseWriter, r *http.Request
return
}
- if err := app.RemoveSamlIdpCertificate(); err != nil {
+ if err := c.App.RemoveSamlIdpCertificate(); err != nil {
c.Err = err
return
}
@@ -166,6 +165,6 @@ func getSamlCertificateStatus(c *Context, w http.ResponseWriter, r *http.Request
return
}
- status := app.GetSamlCertificateStatus()
+ status := c.App.GetSamlCertificateStatus()
w.Write([]byte(status.ToJson()))
}
diff --git a/api4/user_test.go b/api4/user_test.go
index eee9aa8a2..5424a1ee2 100644
--- a/api4/user_test.go
+++ b/api4/user_test.go
@@ -10,7 +10,6 @@ import (
"testing"
"time"
- "github.com/mattermost/mattermost-server/app"
"github.com/mattermost/mattermost-server/model"
"github.com/mattermost/mattermost-server/utils"
"github.com/stretchr/testify/assert"
@@ -961,7 +960,7 @@ func TestUpdateUser(t *testing.T) {
session, _ := th.App.GetSession(Client.AuthToken)
session.IsOAuth = true
- app.AddSessionToCache(session)
+ th.App.AddSessionToCache(session)
ruser.Id = user.Id
ruser.Email = GenerateTestEmail()
@@ -1045,7 +1044,7 @@ func TestPatchUser(t *testing.T) {
session, _ := th.App.GetSession(Client.AuthToken)
session.IsOAuth = true
- app.AddSessionToCache(session)
+ th.App.AddSessionToCache(session)
patch.Email = model.NewString(GenerateTestEmail())
_, resp = Client.PatchUser(user.Id, patch)
@@ -1513,7 +1512,7 @@ func TestUpdateUserMfa(t *testing.T) {
session, _ := th.App.GetSession(Client.AuthToken)
session.IsOAuth = true
- app.AddSessionToCache(session)
+ th.App.AddSessionToCache(session)
_, resp := Client.UpdateUserMfa(th.BasicUser.Id, "12345", false)
CheckForbiddenStatus(t, resp)
@@ -1609,7 +1608,7 @@ func TestGenerateMfaSecret(t *testing.T) {
session, _ := th.App.GetSession(Client.AuthToken)
session.IsOAuth = true
- app.AddSessionToCache(session)
+ th.App.AddSessionToCache(session)
_, resp = Client.GenerateMfaSecret(th.BasicUser.Id)
CheckForbiddenStatus(t, resp)
@@ -2257,7 +2256,7 @@ func TestCreateUserAccessToken(t *testing.T) {
session, _ := th.App.GetSession(Client.AuthToken)
session.IsOAuth = true
- app.AddSessionToCache(session)
+ th.App.AddSessionToCache(session)
_, resp = Client.CreateUserAccessToken(th.BasicUser.Id, testDescription)
CheckForbiddenStatus(t, resp)