diff options
author | Chris <ccbrown112@gmail.com> | 2018-02-06 17:25:49 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-06 17:25:49 -0600 |
commit | 1ec295f88ca99e9423ffd91019cecf802ae3dc77 (patch) | |
tree | 05abc364fefdc6b1088bfb4a307ba11db0dc427f /api | |
parent | 034dbc07e3068c482e654b6a1a8fcbe4b01c44f3 (diff) | |
download | chat-1ec295f88ca99e9423ffd91019cecf802ae3dc77.tar.gz chat-1ec295f88ca99e9423ffd91019cecf802ae3dc77.tar.bz2 chat-1ec295f88ca99e9423ffd91019cecf802ae3dc77.zip |
add App.License, remove utils.IsLicensed / utils.License calls (#8203)
Diffstat (limited to 'api')
-rw-r--r-- | api/context.go | 4 | ||||
-rw-r--r-- | api/team.go | 3 | ||||
-rw-r--r-- | api/user.go | 2 |
3 files changed, 4 insertions, 5 deletions
diff --git a/api/context.go b/api/context.go index 84967659d..b28a24731 100644 --- a/api/context.go +++ b/api/context.go @@ -127,7 +127,7 @@ func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { c.SetSiteURLHeader(app.GetProtocol(r) + "://" + r.Host) w.Header().Set(model.HEADER_REQUEST_ID, c.RequestId) - w.Header().Set(model.HEADER_VERSION_ID, fmt.Sprintf("%v.%v.%v.%v", model.CurrentVersion, model.BuildNumber, c.App.ClientConfigHash(), utils.IsLicensed())) + w.Header().Set(model.HEADER_VERSION_ID, fmt.Sprintf("%v.%v.%v.%v", model.CurrentVersion, model.BuildNumber, c.App.ClientConfigHash(), c.App.License() != nil)) // Instruct the browser not to display us in an iframe unless is the same origin for anti-clickjacking if !h.isApi { @@ -292,7 +292,7 @@ func (c *Context) UserRequired() { func (c *Context) MfaRequired() { // Must be licensed for MFA and have it configured for enforcement - if !utils.IsLicensed() || !*utils.License().Features.MFA || !*c.App.Config().ServiceSettings.EnableMultifactorAuthentication || !*c.App.Config().ServiceSettings.EnforceMultifactorAuthentication { + if license := c.App.License(); license == nil || !*license.Features.MFA || !*c.App.Config().ServiceSettings.EnableMultifactorAuthentication || !*c.App.Config().ServiceSettings.EnforceMultifactorAuthentication { return } diff --git a/api/team.go b/api/team.go index 48377f970..f590b8e8c 100644 --- a/api/team.go +++ b/api/team.go @@ -13,7 +13,6 @@ import ( "github.com/gorilla/mux" "github.com/mattermost/mattermost-server/model" - "github.com/mattermost/mattermost-server/utils" ) func (api *API) InitTeam() { @@ -117,7 +116,7 @@ func getAll(c *Context, w http.ResponseWriter, r *http.Request) { func inviteMembers(c *Context, w http.ResponseWriter, r *http.Request) { invites := model.InvitesFromJson(r.Body) - if utils.IsLicensed() && !c.App.SessionHasPermissionToTeam(c.Session, c.TeamId, model.PERMISSION_INVITE_USER) { + if c.App.License() != nil && !c.App.SessionHasPermissionToTeam(c.Session, c.TeamId, model.PERMISSION_INVITE_USER) { errorId := "" if *c.App.Config().TeamSettings.RestrictTeamInvite == model.PERMISSIONS_SYSTEM_ADMIN { errorId = "api.team.invite_members.restricted_system_admin.app_error" diff --git a/api/user.go b/api/user.go index a2e06c013..440ea5858 100644 --- a/api/user.go +++ b/api/user.go @@ -1057,7 +1057,7 @@ func updateMfa(c *Context, w http.ResponseWriter, r *http.Request) { } func checkMfa(c *Context, w http.ResponseWriter, r *http.Request) { - if !utils.IsLicensed() || !*utils.License().Features.MFA || !*c.App.Config().ServiceSettings.EnableMultifactorAuthentication { + if license := c.App.License(); license == nil || !*license.Features.MFA || !*c.App.Config().ServiceSettings.EnableMultifactorAuthentication { rdata := map[string]string{} rdata["mfa_required"] = "false" w.Write([]byte(model.MapToJson(rdata))) |