Skip to content

Commit

Permalink
Add creation validation configuration, e. g. in order to check whethe…
Browse files Browse the repository at this point in the history
…r the user is authorized to create the room type
  • Loading branch information
mrsimpson committed Oct 17, 2017
1 parent 685593a commit fa20b86
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/rocketchat-lib/lib/RoomTypeConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,12 @@ export class RoomTypeConfig {
return true;
}

canBeCreated() {
return Meteor.isServer ?
RocketChat.authz.hasAtLeastOnePermission(Meteor.userId(), [`create-${ this._identifier }`]) :
RocketChat.authz.hasAtLeastOnePermission([`create-${ this._identifier }`]);
}

canBeDeleted(room) {
return Meteor.isServer ?
RocketChat.authz.hasAtLeastOnePermission(Meteor.userId(), [`delete-${ room.t }`], room._id) :
Expand Down

0 comments on commit fa20b86

Please sign in to comment.