summaryrefslogtreecommitdiffstats
path: root/api4
diff options
context:
space:
mode:
authorJesús Espino <jespinog@gmail.com>2018-09-24 15:35:39 +0200
committerGitHub <noreply@github.com>2018-09-24 15:35:39 +0200
commit847f30a13b9e784e54455e84069deeeba281874d (patch)
treefc65ef9deaa6a02e0371617d78116fe5877299f5 /api4
parent89cd752aa1bd8bc290b32cce531b47767fb3e4b8 (diff)
downloadchat-847f30a13b9e784e54455e84069deeeba281874d.tar.gz
chat-847f30a13b9e784e54455e84069deeeba281874d.tar.bz2
chat-847f30a13b9e784e54455e84069deeeba281874d.zip
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
Diffstat (limited to 'api4')
-rw-r--r--api4/post_test.go10
-rw-r--r--api4/role.go1
2 files changed, 9 insertions, 2 deletions
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)