Skip to content

Commit

Permalink
[FIX] Owner unable to delete channel or group from APIs (#9729)
Browse files Browse the repository at this point in the history
* gave default room delete permissions to owner

* adds necessary migrations

* Changing migration version to 111
  • Loading branch information
c0dzilla authored and sampaiodiego committed Apr 17, 2018
1 parent 16b6190 commit 2411702
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/rocketchat-authorization/server/startup.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ Meteor.startup(function() {
{ _id: 'create-p', roles : ['admin', 'user', 'bot'] },
{ _id: 'create-user', roles : ['admin'] },
{ _id: 'clean-channel-history', roles : ['admin'] }, // special permission to bulk delete a channel's mesages
{ _id: 'delete-c', roles : ['admin'] },
{ _id: 'delete-c', roles : ['admin', 'owner'] },
{ _id: 'delete-d', roles : ['admin'] },
{ _id: 'delete-message', roles : ['admin', 'owner', 'moderator'] },
{ _id: 'delete-p', roles : ['admin'] },
{ _id: 'delete-p', roles : ['admin', 'owner'] },
{ _id: 'delete-user', roles : ['admin'] },
{ _id: 'edit-message', roles : ['admin', 'owner', 'moderator'] },
{ _id: 'edit-other-user-active-status', roles : ['admin'] },
Expand Down
10 changes: 10 additions & 0 deletions server/startup/migrations/v111.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Migration to give delete channel, delete group permissions to owner
RocketChat.Migrations.add({
version: 111,
up() {
if (RocketChat.models && RocketChat.models.Permissions) {
RocketChat.models.Permissions.update({ _id: 'delete-c' }, { $addToSet: { roles: 'owner' } });
RocketChat.models.Permissions.update({ _id: 'delete-p' }, { $addToSet: { roles: 'owner' } });
}
}
});

0 comments on commit 2411702

Please sign in to comment.