Avoid taking into account guest accounts flag (#13643)

Этот коммит содержится в:
Miguel de la Cruz
2020-01-21 17:29:54 +01:00
коммит произвёл GitHub
родитель d496e6a6a6
Коммит 97969a2904
3 изменённых файлов: 7 добавлений и 7 удалений

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

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

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

@@ -977,7 +977,7 @@ func inviteUsersToTeam(c *Context, w http.ResponseWriter, r *http.Request) {
} }
func inviteGuestsToChannels(c *Context, w http.ResponseWriter, r *http.Request) { func inviteGuestsToChannels(c *Context, w http.ResponseWriter, r *http.Request) {
if c.App.License() == nil || !*c.App.License().Features.GuestAccounts { if c.App.License() == nil {
c.Err = model.NewAppError("Api4.InviteGuestsToChannels", "api.team.invate_guests_to_channels.license.error", nil, "", http.StatusNotImplemented) c.Err = model.NewAppError("Api4.InviteGuestsToChannels", "api.team.invate_guests_to_channels.license.error", nil, "", http.StatusNotImplemented)
return return
} }

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

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