[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 удалений

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

@@ -96,7 +96,7 @@ func patchRole(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
if c.App.License() == nil && patch.Permissions != nil {
if (c.App.License() == nil || !*c.App.License().Features.GuestAccounts) && patch.Permissions != nil {
if oldRole.Name == "system_guest" || oldRole.Name == "team_guest" || oldRole.Name == "channel_guest" {
c.Err = model.NewAppError("Api4.PatchRoles", "api.roles.patch_roles.license.error", nil, "", http.StatusNotImplemented)
return
@@ -129,7 +129,7 @@ func patchRole(c *Context, w http.ResponseWriter, r *http.Request) {
}
}
if c.App.License() != nil && (oldRole.Name == "system_guest" || oldRole.Name == "team_guest" || oldRole.Name == "channel_guest") && !*c.App.License().Features.GuestAccountsPermissions {
if c.App.License() != nil && *c.App.License().Features.GuestAccounts && (oldRole.Name == "system_guest" || oldRole.Name == "team_guest" || oldRole.Name == "channel_guest") && !*c.App.License().Features.GuestAccountsPermissions {
c.Err = model.NewAppError("Api4.PatchRoles", "api.roles.patch_roles.license.error", nil, "", http.StatusNotImplemented)
return
}