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.
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
4c8bac38bb
Коммит
d14235b4e0
10
api4/ldap.go
10
api4/ldap.go
@@ -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
|
||||
|
||||
Ссылка в новой задаче
Block a user