[MM-16798] Add a Guest Accounts feature flag (#13231)

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Miguel de la Cruz
2020-01-02 22:15:10 +01:00
коммит произвёл Jesús Espino
родитель 7a6c0f607b
Коммит c3c250cd91
6 изменённых файлов: 17 добавлений и 7 удалений

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

@@ -104,7 +104,7 @@ func createUser(c *Context, w http.ResponseWriter, r *http.Request) {
}
if token.Type == app.TOKEN_TYPE_GUEST_INVITATION {
if c.App.License() == nil {
if c.App.License() == nil || !*c.App.License().Features.GuestAccounts {
c.Err = model.NewAppError("CreateUserWithToken", "api.user.create_user.guest_accounts.license.app_error", nil, "", http.StatusBadRequest)
return
}
@@ -1387,7 +1387,7 @@ func login(c *Context, w http.ResponseWriter, r *http.Request) {
}
if user.IsGuest() {
if c.App.License() == nil {
if c.App.License() == nil || !*c.App.License().Features.GuestAccounts {
c.Err = model.NewAppError("login", "api.user.login.guest_accounts.license.error", nil, "", http.StatusUnauthorized)
return
}
@@ -1971,7 +1971,7 @@ func promoteGuestToUser(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
if c.App.License() == nil {
if c.App.License() == nil || !*c.App.License().Features.GuestAccounts {
c.Err = model.NewAppError("Api4.promoteGuestToUser", "api.team.promote_guest_to_user.license.error", nil, "", http.StatusNotImplemented)
return
}
@@ -2011,7 +2011,7 @@ func demoteUserToGuest(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
if c.App.License() == nil {
if c.App.License() == nil || !*c.App.License().Features.GuestAccounts {
c.Err = model.NewAppError("Api4.demoteUserToGuest", "api.team.demote_user_to_guest.license.error", nil, "", http.StatusNotImplemented)
return
}