Skip to content

Commit

Permalink
Fix isUserAdmin method in store
Browse files Browse the repository at this point in the history
  • Loading branch information
satya164 committed Nov 6, 2015
1 parent 25eb8d5 commit 52a15b9
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions store/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,19 +262,9 @@ Store.prototype.getUserRole = function(userId, roomId) {
};

Store.prototype.isUserAdmin = function(userId, roomId) {
var rel, role;

userId = (typeof userId === "string") ? userId : this.get("user");

rel = this.getRelation(roomId, userId);

if (rel && rel.role && rel.role !== "none") {
role = rel.role;
} else {
role = (!userId || userUtils.isGuest(userId)) ? "guest" : "registered";
}
const role = this.getUserRole(userId, roomId);

return role;
return permissionWeights[role] >= permissionWeights.moderator;
};

Store.prototype.isRoomReadable = function(roomId, userId) {
Expand Down

0 comments on commit 52a15b9

Please sign in to comment.