[MM-22071] Allow fetch all groups as a system admin (#13866)
* Merge upstream * allow fetch all groups * Delete report.xml * update i18n stuffz * fix test cases * fix bug Co-authored-by: Jason Paul Deland <9366595+jaydeland@users.noreply.github.com> Co-authored-by: mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
17f2cd665d
Коммит
4587913b49
@@ -581,8 +581,8 @@ func getGroups(c *Context, w http.ResponseWriter, r *http.Request) {
|
|||||||
channelID = id
|
channelID = id
|
||||||
}
|
}
|
||||||
|
|
||||||
if teamID == "" && channelID == "" {
|
if teamID == "" && channelID == "" && !c.App.SessionHasPermissionTo(*c.App.Session(), model.PERMISSION_MANAGE_SYSTEM) {
|
||||||
c.Err = model.NewAppError("Api4.getGroups", "api.getGroups.invalid_or_missing_channel_or_team_id", nil, "", http.StatusBadRequest)
|
c.SetPermissionError(model.PERMISSION_MANAGE_SYSTEM)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -801,7 +801,7 @@ func TestGetGroups(t *testing.T) {
|
|||||||
th.App.SetLicense(model.NewTestLicense("ldap"))
|
th.App.SetLicense(model.NewTestLicense("ldap"))
|
||||||
|
|
||||||
_, response = th.SystemAdminClient.GetGroups(opts)
|
_, response = th.SystemAdminClient.GetGroups(opts)
|
||||||
CheckBadRequestStatus(t, response)
|
require.Nil(t, response.Error)
|
||||||
|
|
||||||
_, response = th.SystemAdminClient.UpdateChannelRoles(th.BasicChannel.Id, th.BasicUser.Id, "")
|
_, response = th.SystemAdminClient.UpdateChannelRoles(th.BasicChannel.Id, th.BasicUser.Id, "")
|
||||||
require.Nil(t, response.Error)
|
require.Nil(t, response.Error)
|
||||||
@@ -841,4 +841,9 @@ func TestGetGroups(t *testing.T) {
|
|||||||
|
|
||||||
_, response = th.Client.GetGroups(opts)
|
_, response = th.Client.GetGroups(opts)
|
||||||
assert.Nil(t, response.Error)
|
assert.Nil(t, response.Error)
|
||||||
|
|
||||||
|
opts.NotAssociatedToTeam = ""
|
||||||
|
opts.NotAssociatedToChannel = ""
|
||||||
|
_, response = th.Client.GetGroups(opts)
|
||||||
|
CheckForbiddenStatus(t, response)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1392,10 +1392,6 @@
|
|||||||
"id": "api.file.write_file_locally.writing.app_error",
|
"id": "api.file.write_file_locally.writing.app_error",
|
||||||
"translation": "Encountered an error writing to local server storage"
|
"translation": "Encountered an error writing to local server storage"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"id": "api.getGroups.invalid_or_missing_channel_or_team_id",
|
|
||||||
"translation": "Invalid/Missing channel ID or Team ID."
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"id": "api.incoming_webhook.disabled.app_error",
|
"id": "api.incoming_webhook.disabled.app_error",
|
||||||
"translation": "Incoming webhooks have been disabled by the system admin."
|
"translation": "Incoming webhooks have been disabled by the system admin."
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user