From 15f35e801929d5e82bfc70a1996ccb4b66fa08cb Mon Sep 17 00:00:00 2001 From: hydrabolt Date: Mon, 26 Oct 2015 12:11:45 +0000 Subject: [PATCH] Fixed getBit will now resolve all permissions to true if it has manage role --- lib/ChannelPermissions.js | 3 +++ lib/EvaluatedPermissions.js | 3 +++ lib/ServerPermissions.js | 13 +++++++++++-- src/ChannelPermissions.js | 3 +++ src/EvaluatedPermissions.js | 3 +++ src/ServerPermissions.js | 14 ++++++++++++-- 6 files changed, 35 insertions(+), 4 deletions(-) diff --git a/lib/ChannelPermissions.js b/lib/ChannelPermissions.js index e163b37e7..a9c1bad3a 100644 --- a/lib/ChannelPermissions.js +++ b/lib/ChannelPermissions.js @@ -53,6 +53,9 @@ var ChannelPermissions = (function () { }; ChannelPermissions.prototype.getBit = function getBit(x) { + if ((this.packed >>> 3 & 1) === 1) { + return true; + } return (this.packed >>> x & 1) === 1; }; diff --git a/lib/EvaluatedPermissions.js b/lib/EvaluatedPermissions.js index c4720c46b..ddcbf2128 100644 --- a/lib/EvaluatedPermissions.js +++ b/lib/EvaluatedPermissions.js @@ -38,6 +38,9 @@ var EvaluatedPermissions = (function () { }; EvaluatedPermissions.prototype.getBit = function getBit(x) { + if ((this.packed >>> 3 & 1) === 1) { + return true; + } return (this.packed >>> x & 1) === 1; }; diff --git a/lib/ServerPermissions.js b/lib/ServerPermissions.js index 45b4c3642..4c1b48f2d 100644 --- a/lib/ServerPermissions.js +++ b/lib/ServerPermissions.js @@ -42,11 +42,20 @@ var ServerPermissions = (function () { }; ServerPermissions.prototype.getBit = function getBit(x) { + if ((this.packed >>> 3 & 1) === 1) { + return true; + } return (this.packed >>> x & 1) === 1; }; - ServerPermissions.prototype.setBit = function setBit() { - //dummy function for now + ServerPermissions.prototype.setBit = function setBit(location, value) { + + if (value) { + // allow that permission + + } else { + // not allowed + } }; ServerPermissions.prototype.toString = function toString() { diff --git a/src/ChannelPermissions.js b/src/ChannelPermissions.js index 215a7ad50..e3424488b 100644 --- a/src/ChannelPermissions.js +++ b/src/ChannelPermissions.js @@ -98,6 +98,9 @@ class ChannelPermissions{ set voiceUseVoiceActivation(val){this.setBit(25, val);} getBit(x) { + if( ((this.packed >>> 3) & 1) === 1 ){ + return true; + } return ((this.packed >>> x) & 1) === 1; } diff --git a/src/EvaluatedPermissions.js b/src/EvaluatedPermissions.js index b7ccd1dde..00f382915 100644 --- a/src/EvaluatedPermissions.js +++ b/src/EvaluatedPermissions.js @@ -83,6 +83,9 @@ class EvaluatedPermissions { set voiceUseVoiceActivation(val) { this.setBit(25, val); } getBit(x) { + if( ((this.packed >>> 3) & 1) === 1 ){ + return true; + } return ((this.packed >>> x) & 1) === 1; } diff --git a/src/ServerPermissions.js b/src/ServerPermissions.js index a9c00f101..992e9ce66 100644 --- a/src/ServerPermissions.js +++ b/src/ServerPermissions.js @@ -97,11 +97,21 @@ class ServerPermissions { set voiceUseVoiceActivation(val){this.setBit(25, val);} getBit(x) { + if( ((this.packed >>> 3) & 1) === 1 ){ + return true; + } return ((this.packed >>> x) & 1) === 1; } - setBit(){ - //dummy function for now + setBit(location, value){ + + if(value){ + // allow that permission + + }else{ + // not allowed + } + } toString(){