MM-14590: Adds license check to LDAP test and LDAP sync API endpoints. (#10519)

* MM-14590: Adds license check to LDAP test and LDAP sync API endpoints.

* MM-14590: Improves the LdapSync and LdapTest API tests.
Этот коммит содержится в:
Martin Kraft
2019-04-01 10:48:58 -04:00
коммит произвёл GitHub
родитель 4c8bac38bb
Коммит d14235b4e0
2 изменённых файлов: 33 добавлений и 1 удалений

Просмотреть файл

@@ -33,6 +33,11 @@ func (api *API) InitLdap() {
}
func syncLdap(c *Context, w http.ResponseWriter, r *http.Request) {
if c.App.License() == nil || !*c.App.License().Features.LDAP {
c.Err = model.NewAppError("Api4.syncLdap", "api.ldap_groups.license_error", nil, "", http.StatusNotImplemented)
return
}
if !c.App.SessionHasPermissionTo(c.App.Session, model.PERMISSION_MANAGE_SYSTEM) {
c.SetPermissionError(model.PERMISSION_MANAGE_SYSTEM)
return
@@ -44,6 +49,11 @@ func syncLdap(c *Context, w http.ResponseWriter, r *http.Request) {
}
func testLdap(c *Context, w http.ResponseWriter, r *http.Request) {
if c.App.License() == nil || !*c.App.License().Features.LDAP {
c.Err = model.NewAppError("Api4.testLdap", "api.ldap_groups.license_error", nil, "", http.StatusNotImplemented)
return
}
if !c.App.SessionHasPermissionTo(c.App.Session, model.PERMISSION_MANAGE_SYSTEM) {
c.SetPermissionError(model.PERMISSION_MANAGE_SYSTEM)
return