From b069f818d91a75cc6a4275860adf23243de7bc50 Mon Sep 17 00:00:00 2001 From: abalabahaha Date: Sat, 19 Mar 2016 22:54:49 -0700 Subject: [PATCH] Unoverlap allow when denying a permission overwrite --- lib/Client/InternalClient.js | 2 ++ lib/Util/TokenCacher-shim.js | 24 ++++++++++++------------ src/Client/InternalClient.js | 2 ++ 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/lib/Client/InternalClient.js b/lib/Client/InternalClient.js index 9c17333ae..365f25876 100644 --- a/lib/Client/InternalClient.js +++ b/lib/Client/InternalClient.js @@ -1143,7 +1143,9 @@ var InternalClient = (function () { for (var perm in updated) { if (updated[perm]) { data.allow |= _Constants.Permissions[perm] || 0; + data.deny &= ~(_Constants.Permissions[perm] || 0); } else { + data.allow &= ~(_Constants.Permissions[perm] || 0); data.deny |= _Constants.Permissions[perm] || 0; } } diff --git a/lib/Util/TokenCacher-shim.js b/lib/Util/TokenCacher-shim.js index 53412d365..f483e9575 100644 --- a/lib/Util/TokenCacher-shim.js +++ b/lib/Util/TokenCacher-shim.js @@ -6,23 +6,23 @@ exports.__esModule = true; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var TokenCacher = (function () { - function TokenCacher() { - _classCallCheck(this, TokenCacher); - } + function TokenCacher() { + _classCallCheck(this, TokenCacher); + } - TokenCacher.prototype.setToken = function setToken() {}; + TokenCacher.prototype.setToken = function setToken() {}; - TokenCacher.prototype.save = function save() {}; + TokenCacher.prototype.save = function save() {}; - TokenCacher.prototype.getToken = function getToken() { - return null; - }; + TokenCacher.prototype.getToken = function getToken() { + return null; + }; - TokenCacher.prototype.init = function init(ind) { - this.done = true; - }; + TokenCacher.prototype.init = function init(ind) { + this.done = true; + }; - return TokenCacher; + return TokenCacher; })(); exports["default"] = TokenCacher; diff --git a/src/Client/InternalClient.js b/src/Client/InternalClient.js index 2d3a71259..5806ccbf2 100644 --- a/src/Client/InternalClient.js +++ b/src/Client/InternalClient.js @@ -914,7 +914,9 @@ export default class InternalClient { for (var perm in updated) { if (updated[perm]) { data.allow |= (Permissions[perm] || 0); + data.deny &= ~(Permissions[perm] || 0); } else { + data.allow &= ~(Permissions[perm] || 0); data.deny |= (Permissions[perm] || 0); } }