From 847f30a13b9e784e54455e84069deeeba281874d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Espino?= Date: Mon, 24 Sep 2018 15:35:39 +0200 Subject: MM-11707: Change the default setting for EDIT_OTHERS_POSTS (#9447) * MM-11707: Removes edit_others_posts permission from the team_admin role in MakeDefaultRoles(). * MM-11707: Tests fix. * MM-11707: Update test store. * MM-11707: Allow to change the permission for edit the others posts on TE * Fixing tests --- api4/post_test.go | 10 ++++++++-- api4/role.go | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'api4') diff --git a/api4/post_test.go b/api4/post_test.go index 8ccd88a42..3c9875975 100644 --- a/api4/post_test.go +++ b/api4/post_test.go @@ -587,6 +587,12 @@ func TestUpdatePost(t *testing.T) { Client.Logout() + th.LoginTeamAdmin() + _, resp = Client.UpdatePost(rpost.Id, rpost) + CheckForbiddenStatus(t, resp) + + Client.Logout() + _, resp = th.SystemAdminClient.UpdatePost(rpost.Id, rpost) CheckNoError(t, resp) } @@ -673,7 +679,7 @@ func TestPatchPost(t *testing.T) { th.LoginTeamAdmin() _, resp = Client.PatchPost(post.Id, patch) - CheckNoError(t, resp) + CheckForbiddenStatus(t, resp) _, resp = th.SystemAdminClient.PatchPost(post.Id, patch) CheckNoError(t, resp) @@ -1599,7 +1605,7 @@ func TestSearchPostsWithDateFlags(t *testing.T) { posts, _ = Client.SearchPosts(th.BasicTeam.Id, "before:2018-08-03 after:2018-08-01", false) if len(posts.Order) != 1 { t.Fatalf("wrong number of posts returned %v", len(posts.Order)) - } + } } func TestGetFileInfosForPost(t *testing.T) { diff --git a/api4/role.go b/api4/role.go index 4e367629b..384738c36 100644 --- a/api4/role.go +++ b/api4/role.go @@ -104,6 +104,7 @@ func patchRole(c *Context, w http.ResponseWriter, r *http.Request) { model.PERMISSION_MANAGE_OAUTH.Id, model.PERMISSION_MANAGE_SYSTEM_WIDE_OAUTH.Id, model.PERMISSION_MANAGE_EMOJIS.Id, + model.PERMISSION_EDIT_OTHERS_POSTS.Id, } changedPermissions := model.PermissionsChangedByPatch(oldRole, patch) -- cgit v1.2.3-1-g7c22