Browse Source

Removed text, merged login/register, added button to user slideout, fixed bug.

KrisVos130 9 năm trước cách đây
mục cha
commit
11e7c69b3c

+ 1 - 1
app/.meteor/release

@@ -1 +1 @@
-METEOR@1.3
+METEOR@1.3.4.4

+ 89 - 89
app/.meteor/versions

@@ -1,52 +1,52 @@
-accounts-base@1.2.4
-accounts-facebook@1.0.7
-accounts-github@1.0.7
-accounts-oauth@1.1.10
-accounts-password@1.1.6
+accounts-base@1.2.8
+accounts-facebook@1.0.10
+accounts-github@1.0.10
+accounts-oauth@1.1.13
+accounts-password@1.1.12
 aldeed:collection2@2.9.1
 aldeed:collection2-core@1.1.1
 aldeed:schema-deny@1.0.1
 aldeed:schema-index@1.0.1
 aldeed:simple-schema@1.5.3
-allow-deny@1.0.2
+allow-deny@1.0.5
 altapp:recaptcha@2.0.1
-autoupdate@1.2.6
-babel-compiler@6.5.2
-babel-runtime@0.1.6
-base64@1.0.6
-binary-heap@1.0.6
-blaze@2.1.5
-blaze-html-templates@1.0.2
-blaze-tools@1.0.6
-boilerplate-generator@1.0.6
-caching-compiler@1.0.2
-caching-html-compiler@1.0.4
-callback-hook@1.0.6
-check@1.1.2
-coffeescript@1.0.15
-ddp@1.2.3
-ddp-client@1.2.3
-ddp-common@1.2.3
-ddp-rate-limiter@1.0.2
-ddp-server@1.2.4
-deps@1.0.10
-diff-sequence@1.0.3
-ecmascript@0.4.1
-ecmascript-runtime@0.2.8
-ejson@1.0.9
-email@1.0.10
+autoupdate@1.2.11
+babel-compiler@6.8.4
+babel-runtime@0.1.9_1
+base64@1.0.9
+binary-heap@1.0.9
+blaze@2.1.8
+blaze-html-templates@1.0.4
+blaze-tools@1.0.9
+boilerplate-generator@1.0.9
+caching-compiler@1.0.6
+caching-html-compiler@1.0.6
+callback-hook@1.0.9
+check@1.2.3
+coffeescript@1.1.3
+ddp@1.2.5
+ddp-client@1.2.9
+ddp-common@1.2.6
+ddp-rate-limiter@1.0.5
+ddp-server@1.2.9
+deps@1.0.12
+diff-sequence@1.0.6
+ecmascript@0.4.7
+ecmascript-runtime@0.2.12
+ejson@1.0.12
+email@1.0.15
 emojione:emojione@1.5.2
-es5-shim@4.5.8
-facebook@1.2.4
-fastclick@1.0.9
-geojson-utils@1.0.6
-github@1.1.6
-handlebars@1.0.5
-hot-code-push@1.0.2
-html-tools@1.0.7
-htmljs@1.0.7
-http@1.1.3
-id-map@1.0.5
+es5-shim@4.5.13
+facebook@1.2.8
+fastclick@1.0.12
+geojson-utils@1.0.9
+github@1.1.8
+handlebars@1.0.7
+hot-code-push@1.0.4
+html-tools@1.0.10
+htmljs@1.0.10
+http@1.1.8
+id-map@1.0.8
 iron:controller@1.0.12
 iron:core@1.0.11
 iron:dynamic-template@1.0.12
@@ -59,61 +59,61 @@ joncursi:socket-io-client@0.1.4
 jparker:crypto-core@0.1.0
 jparker:crypto-md5@0.1.1
 jparker:gravatar@0.3.1
-jquery@1.11.6
-launch-screen@1.0.8
-livedata@1.0.16
-localstorage@1.0.7
-logging@1.0.10
+jquery@1.11.9
+launch-screen@1.0.12
+livedata@1.0.18
+localstorage@1.0.11
+logging@1.0.14
 matb33:collection-hooks@0.8.1
 materialize:materialize@0.97.5
 mdg:validation-error@0.2.0
-meteor@1.1.12
-meteor-base@1.0.2
+meteor@1.1.16
+meteor-base@1.0.4
 meteorhacks:async@1.0.0
 meteorhacks:inject-initial@1.0.4
 meteorhacks:npm@1.5.0
-minifier-css@1.1.9
-minifier-js@1.1.9
-minimongo@1.0.12
-mobile-experience@1.0.2
-mobile-status-bar@1.0.10
-modules@0.5.1
-modules-runtime@0.6.1
+minifier-css@1.1.13
+minifier-js@1.1.13
+minimongo@1.0.17
+mobile-experience@1.0.4
+mobile-status-bar@1.0.12
+modules@0.6.5
+modules-runtime@0.6.5
 momentjs:moment@2.12.0
-mongo@1.1.5
-mongo-id@1.0.2
-npm-bcrypt@0.7.8_2
+mongo@1.1.9_1
+mongo-id@1.0.5
+npm-bcrypt@0.8.6_2
 npm-container@1.2.0
-npm-mongo@1.4.41
-oauth@1.1.8
-oauth2@1.1.7
-observe-sequence@1.0.9
-ordered-dict@1.0.5
-promise@0.6.5
+npm-mongo@1.4.45
+oauth@1.1.11
+oauth2@1.1.10
+observe-sequence@1.0.12
+ordered-dict@1.0.8
+promise@0.7.3
 raix:eventemitter@0.1.3
-random@1.0.7
-rate-limit@1.0.2
-reactive-dict@1.1.5
-reactive-var@1.0.7
-reload@1.1.6
-retry@1.0.5
-routepolicy@1.0.8
-service-configuration@1.0.7
-session@1.1.3
-sha@1.0.5
-spacebars@1.0.9
-spacebars-compiler@1.0.9
-srp@1.0.6
-standard-minifier-css@1.0.4
-standard-minifier-js@1.0.4
-templating@1.1.7
-templating-tools@1.0.2
-tracker@1.0.11
-ui@1.0.9
-underscore@1.0.6
-url@1.0.7
+random@1.0.10
+rate-limit@1.0.5
+reactive-dict@1.1.8
+reactive-var@1.0.10
+reload@1.1.10
+retry@1.0.8
+routepolicy@1.0.11
+service-configuration@1.0.10
+session@1.1.6
+sha@1.0.8
+spacebars@1.0.12
+spacebars-compiler@1.0.12
+srp@1.0.9
+standard-minifier-css@1.0.8
+standard-minifier-js@1.0.8
+templating@1.1.13
+templating-tools@1.0.4
+tracker@1.0.14
+ui@1.0.11
+underscore@1.0.9
+url@1.0.10
 utilities:avatar@0.9.2
-webapp@1.2.6
-webapp-hashing@1.0.7
-zimme:active-route@2.3.2
+webapp@1.2.10
+webapp-hashing@1.0.9
+zimme:active-route@2.0.4_1
 zimme:iron-router-active@2.0.1

+ 25 - 32
app/client/scripts/events.js

@@ -256,38 +256,12 @@ Template.header.events({
     "click .logout": function(e){
         e.preventDefault();
         Meteor.logout();
-        if (hpSound !== undefined) {
-            hpSound.stop();
-        }
     },
     "click #profile": function(){
         window.location = "/u/" + Meteor.user().profile.username;
     }
 });
 
-Template.login.events({
-    "submit form": function(e){
-        e.preventDefault();
-        Session.set("github", false);
-        var username = $("#username").val()
-        var password = $("#password").val();
-        Meteor.loginWithPassword(username, password, function(err) {
-            if (err) {
-                var $toastContent = $('<span><strong>Oh snap!</strong> ' + err.reason + '</span>');
-                Materialize.toast($toastContent, 8000);
-            } else {
-                window.location.href = "/";
-            }
-        });
-    },
-
-    "click #github-login": function(){
-        Meteor.loginWithGithub({loginStyle: "redirect"}, function(err, res) {
-            console.log(err, res);
-        });
-    }
-});
-
 Template.playlist.events({
     "keyup #search-playlist": function(){
         if($("#search-playlist").val().length === 0){
@@ -1126,12 +1100,12 @@ Template.manageSongs.events({
     }
 });
 
-Template.register.events({
-    "submit form": function(e){
+Template.loginRegister.events({
+    "submit #register_form": function(e){
         e.preventDefault();
-        var username = $("#username").val();
-        var email = $("#email").val();
-        var password = $("#password").val();
+        var username = $("#register_username").val();
+        var email = $("#register_email").val();
+        var password = $("#register_password").val();
         var acceptedTermsAndPrivacy = $("#termsPrivacyBTN").is(":checked");
         var captchaData = grecaptcha.getResponse();
         if (acceptedTermsAndPrivacy) {
@@ -1154,7 +1128,20 @@ Template.register.events({
             Materialize.toast($toastContent, 8000);
         }
     },
-
+    "submit #login_form": function(e){
+        e.preventDefault();
+        Session.set("github", false);
+        var username = $("#login_username").val()
+        var password = $("#login_password").val();
+        Meteor.loginWithPassword(username, password, function(err) {
+            if (err) {
+                var $toastContent = $('<span><strong>Oh snap!</strong> ' + err.reason + '</span>');
+                Materialize.toast($toastContent, 8000);
+            } else {
+                window.location.href = "/";
+            }
+        });
+    },
     "click #github-login": function(){
         Meteor.loginWithGithub({loginStyle: "redirect"}, function(err, res) {
             console.log(err, res);
@@ -1183,6 +1170,9 @@ Template.news.events({
 });
 
 Template.room.events({
+    "click #logout": function() {
+        Meteor.logout();
+    },
     "input #volume_slider": function() {
         var volume = Number($("#volume_slider").val());
         localStorage.setItem("volume", volume);
@@ -1633,6 +1623,9 @@ Template.room.events({
 });
 
 Template.communityStation.events({
+    "click #logout": function() {
+        Meteor.logout();
+    },
     "click #delete_room": function() {
         var name = Session.get("CommunityStationName");
         Meteor.call("deleteCommunityStation", name, function(err) {

+ 3 - 20
app/client/scripts/onCreated.js

@@ -25,17 +25,12 @@ Template.home.onCreated(function() {
     Session.set("type", undefined);
 });
 
-Template.login.onCreated(function() {
+Template.loginRegister.onCreated(function() {
     Session.set("github", true);
     Accounts.onLoginFailure(function() {
         if (Session.get("github") === true) {
-            var errAlert = $('<div style="margin-bottom: 0" class="alert alert-danger" role="alert"><strong>Oh Snap!</strong> Something went wrong when trying to log in with GitHub.</div>');
-            $(".landing").before(errAlert);
-            Meteor.setTimeout(function() {
-                errAlert.fadeOut(5000, function() {
-                    errAlert.remove();
-                });
-            }, 10000);
+            var $toastContent = $('<span><strong>Oh Snap!</strong> Something went wrong when trying to log in/register with GitHub. Maybe an account with that username is already registered?</span>');
+            Materialize.toast($toastContent, 8000);
         }
     });
 });
@@ -119,18 +114,6 @@ Template.manageSongs.onCreated(function() {
     });
 });
 
-Template.register.onCreated(function() {
-    Accounts.onLoginFailure(function() {
-        var errAlert = $('<div style="margin-bottom: 0" class="alert alert-danger" role="alert"><strong>Oh Snap!</strong> Something went wrong when trying to register with GitHub. Maybe an account with that username already exists?</div>');
-        $(".landing").before(errAlert);
-        Meteor.setTimeout(function() {
-            errAlert.fadeOut(5000, function() {
-                errAlert.remove();
-            });
-        }, 10000);
-    });
-});
-
 Template.room.onCreated(function () {
     Chat.after.find(function(userId, selector) {
         if (selector.type === "global") {

+ 2 - 2
app/client/scripts/routes.js

@@ -39,7 +39,7 @@ Router.route("/login", {
     action: function() {
         var user = Meteor.user();
         if (user === undefined || user === null) {
-            this.render("login");
+            this.render("loginRegister");
         } else {
             this.redirect("/");
         }
@@ -51,7 +51,7 @@ Router.route("/register", {
     action: function() {
         var user = Meteor.user();
         if (user === undefined || user === null) {
-            this.render("register");
+            this.render("loginRegister");
         } else {
             this.redirect("/");
         }

+ 7 - 1
app/client/templates/communityStation.html

@@ -95,11 +95,17 @@
     </div-->
     <div id="users-slide-out" class="side-nav room-slideout">
         <h5>Users In Room</h5>
-        <ul>
+        <ul style="margin-bottom: 64px;">
             {{#each usersInRoom}}
                 <li><a href=/u/{{this}} target="_blank">{{this}}</a></li>
             {{/each}}
         </ul>
+
+        {{#if currentUser}}
+            <a class="btn btn-block musare white-text waves-effect waves-light" href="#" id="logout" style="position: fixed; bottom: 0; width: 342px;">Logout</a>
+        {{else}}
+            <a class="btn btn-block musare white-text waves-effect waves-light" href="/login" style="position: fixed; bottom: 0; width: 342px;">Login / Register</a>
+        {{/if}}
     </div>
 
     <div id="allowed-slide-out" class="side-nav room-slideout">

+ 10 - 11
app/client/templates/header.html

@@ -2,7 +2,8 @@
     <header>
         <!-- Dropdown Structure -->
         <ul id="contributeDrop" class="dropdown-content">
-            <li><a href="https://www.github.com/Musare/Musare" target="_blank" class="grey-text text-darken-4">Github</a></li>
+            <li><a href="https://www.github.com/Musare/Musare" target="_blank"
+                   class="grey-text text-darken-4">Github</a></li>
             <li><a href="/feedback" class="grey-text text-darken-4">Feedback</a></li>
         </ul>
         <ul id="aboutDrop" class="dropdown-content">
@@ -16,8 +17,7 @@
                 <li class="divider"></li>
                 <li class="logout"><a class="grey-text text-darken-4">Logout</a></li>
             {{else}}
-                <li><a href="/login" class="grey-text text-darken-4">Login</a></li>
-                <li><a href="/register" class="grey-text text-darken-4">Register</a></li>
+                <li><a href="/login" class="grey-text text-darken-4">Login / Register</a></li>
             {{/if}}
         </ul>
         <nav>
@@ -25,9 +25,9 @@
                 <a href="/" class="brand-logo"><img src="/logo.png" class="responsive-img" style="height: 60px;"/></a>
                 <a href="#" data-activates="mobile-navi" class="button-collapse white-text"><i class="material-icons">menu</i></a>
                 <ul class="right hide-on-med-and-down scroll-fix">
-                  {{#if isModerator}}
-                    <li><a  class="light-blue-text text-accent-4" href="/admin"><b>Admin</b></a></li>
-                  {{/if}}
+                    {{#if isModerator}}
+                        <li><a class="light-blue-text text-accent-4" href="/admin"><b>Admin</b></a></li>
+                    {{/if}}
                     <li><a href="/news" class="white-text">News</a></li>
                     <li><a class="dropdown-button white-text" href="#!" data-activates="contributeDrop">Contribute<i
                             class="material-icons right">arrow_drop_down</i></a></li>
@@ -43,9 +43,9 @@
                 </ul>
                 <ul class="side-nav" id="mobile-navi" style="width: 240px;">
                     <ul class="collapsible" data-collapsible="accordion">
-                      {{#if isModerator}}
-                        <li><a href="/admin">Admin</a></li>
-                      {{/if}}
+                        {{#if isModerator}}
+                            <li><a href="/admin">Admin</a></li>
+                        {{/if}}
                         <li>
                             <a href="/news">News</a>
                         </li>
@@ -76,8 +76,7 @@
                                 {{/if}}
                             </div>
                             <div class="collapsible-body black-text">
-                                <a href="/login">Login</a>
-                                <a href="/register">Register</a>
+                                <a href="/login">Login / Register</a>
                             </div>
                         </li>
                     </ul>

+ 0 - 27
app/client/templates/login.html

@@ -1,27 +0,0 @@
-<template name="login">
-    {{> header}}
-    <main>
-        <div class="container row">
-            <form class="col s12">
-                <h1>Login</h1>
-                <div class="row">
-                    <div class="input-field col s6">
-                        <input id="username" type="text" class="validate">
-                        <label for="first_name">Username</label>
-                    </div>
-                </div>
-                <div class="row">
-                    <div class="input-field col s6">
-                        <input id="password" type="password" class="validate">
-                        <label for="password">Password</label>
-                    </div>
-                </div>
-                <button class="btn waves-effect waves-light" type="submit" name="action">Submit
-                    <i class="material-icons right">send</i>
-                </button>
-            </form>
-            <button id="github-login" class="btn waves-effect waves-light grey login-btn">Login With GitHub</button>
-        </div>
-    </main>
-    {{> footer}}
-</template>

+ 58 - 0
app/client/templates/loginRegister.html

@@ -0,0 +1,58 @@
+<template name="loginRegister">
+    {{> header}}
+    <main>
+        <div class="container row">
+            <form class="col s12" id="login_form">
+                <h1>Login</h1>
+                <div class="row">
+                    <div class="input-field col s6">
+                        <input id="login_username" type="text" class="validate">
+                        <label for="login_first_name">Username</label>
+                    </div>
+                </div>
+                <div class="row">
+                    <div class="input-field col s6">
+                        <input id="login_password" type="password" class="validate">
+                        <label for="login_password">Password</label>
+                    </div>
+                </div>
+                <button class="btn waves-effect waves-light" type="submit" name="action">Submit
+                    <i class="material-icons right">send</i>
+                </button>
+            </form>
+            <button id="github-login" class="btn waves-effect waves-light grey login-btn">Login With GitHub</button>
+            <hr class="center-block" style="width: 99%">
+            <h1>Register</h1>
+            <form class="col s12" id="register_form">
+                <div class="row">
+                    <div class="input-field col s6">
+                        <input id="register_username" type="text" class="validate">
+                        <label for="register_username">Username</label>
+                    </div>
+                    <div class="input-field col s6">
+                        <input id="register_email" type="email" class="validate">
+                        <label for="email">Email</label>
+                    </div>
+                </div>
+                <div class="row">
+                    <div class="input-field col s12">
+                        <input id="register_password" type="password" class="validate">
+                        <label for="password">Password</label>
+                    </div>
+                </div>
+                <div class="row acceptTerms">
+                    <p>
+                        <input type="checkbox" id="termsPrivacyBTN" />
+                        <label for="termsPrivacyBTN">I agree to the <a href="/terms" target="_blank">terms & conditions</a> and <a href="/privacy" target="_blank">privacy policy.</a></label>
+                    </p>
+                </div>
+                {{> reCAPTCHA}}
+                <button class="btn waves-effect waves-light register" type="submit" name="action">Submit
+                    <i class="material-icons right">send</i>
+                </button>
+            </form>
+            <button id="github-login" class="btn waves-effect waves-light grey login-btn">Login With GitHub</button>
+        </div>
+    </main>
+    {{> footer}}
+</template>

+ 1 - 1
app/client/templates/playlist.html

@@ -7,7 +7,7 @@
         {{#each nextSong}}
             <p style="margin: -20px 0 0 15px; font-weight: 300;">Up Next</p>
             <li class="pl-item" style="color: rgb(3, 169, 244) !important;">
-                <img src={{img}} style="width: 80px; float: left; margin: 0 10px 10px 0;">
+                <img onerror="this.src='/notes.png'" src={{img}} style="width: 80px; float: left; margin: 0 10px 10px 0;">
                 <p style="float:right; margin-top: -20px;">{{formatTime duration}}</p>
                 <p class="pl-title" style="font-size: 1.2em">{{title}}</p>
                 <p id="pl-artist" style="margin-top: -20px; font-size: 0.7em">{{artist}}</p>

+ 6 - 1
app/client/templates/room.html

@@ -102,11 +102,16 @@
     </div>
     <div id="users-slide-out" class="side-nav room-slideout">
         <h5>Users In Room</h5>
-        <ul>
+        <ul style="margin-bottom: 64px;">
             {{#each usersInRoom}}
                 <li><a href=/u/{{this}} target="_blank">{{this}}</a></li>
             {{/each}}
         </ul>
+        {{#if currentUser}}
+            <a class="btn btn-block musare white-text waves-effect waves-light" href="#" id="logout" style="position: fixed; bottom: 0; width: 342px;">Logout</a>
+        {{else}}
+            <a class="btn btn-block musare white-text waves-effect waves-light" href="/login" style="position: fixed; bottom: 0; width: 342px;">Login / Register</a>
+        {{/if}}
     </div>
     <!--Admin room controls-->
     <ul id='admin-dropdown' style="background-color: rgb(3, 169, 244) !important; display: none">

+ 70 - 0
app/server/a.js

@@ -0,0 +1,70 @@
+Meteor.isBanned = function() {
+    var userData = Meteor.users.findOne(Meteor.userId());
+    if (Meteor.userId() && userData !== undefined && userData.punishments !== undefined && userData.punishments.ban !== undefined) {
+        var ban = userData.punishments.ban;
+        if (new Date(ban.bannedUntil).getTime() <= new Date().getTime()) {
+            Meteor.users.update(Meteor.userId(), {$unset: {"punishments.ban": ""}});
+            return false;
+        } else {
+            return true;
+        }
+    } else {
+        return false;
+    }
+};
+
+Meteor.isMuted = function() {
+    var userData = Meteor.users.findOne(Meteor.userId());
+    if (Meteor.userId() && userData !== undefined && userData.punishments !== undefined && userData.punishments.mute !== undefined) {
+        var mute = userData.punishments.mute;
+        if (new Date(mute.bannedUntil).getTime() <= new Date().getTime()) {
+            Meteor.users.update(Meteor.userId(), {$unset: {"punishments.mute": ""}});
+            return false;
+        } else {
+            return true;
+        }
+    } else {
+        return false;
+    }
+};
+
+Meteor.updatedMethods = function(methods) {
+    var methodsNames = _.keys(methods);
+    _.each(methodsNames, function(methodName) {
+        var method = {};
+        method[methodName] = function() {
+            if (typeof methods[methodName] === "function") {
+                return methods[methodName].apply(this, arguments);
+            } else {
+                if (Meteor.isBanned()) {
+                    throw new Meteor.Error(401, "Invalid permissions.");
+                }
+                _.each(methods[methodName].requirements, function(requirement) {
+                    if (requirement === "moderator") {
+                        if (!Meteor.userId() || !Meteor.user() || !(Meteor.user().profile.type === "admin" || Meteor.user().profile.type === "moderator")) {
+                            throw new Meteor.Error(401, "Invalid permissions.");
+                        }
+                    } else if (requirement === "admin") {
+                        if (!Meteor.userId() || !Meteor.user() || Meteor.user().profile.type !== "admin") {
+                            throw new Meteor.Error(401, "Invalid permissions.");
+                        }
+                    } else if (requirement === "login") {
+                        if (!Meteor.userId() || !Meteor.user()) {
+                            throw new Meteor.Error(401, "Invalid permissions.");
+                        }
+                    } else if (requirement === "noLogin") {
+                        if (Meteor.userId() || Meteor.user()) {
+                            throw new Meteor.Error(401, "Invalid permissions.");
+                        }
+                    } else if (requirement === "noMute") {
+                        if (isMuted()) {
+                            throw new Meteor.Error(401, "Invalid permissions.");
+                        }
+                    }
+                });
+                return methods[methodName].code.apply(this, arguments);
+            }
+        };
+        Meteor.methods(method);
+    });
+};

+ 245 - 285
app/server/server.js

@@ -930,7 +930,7 @@ function isMuted() {
     }
 }
 
-Meteor.methods({
+Meteor.updatedMethods({
     deleteCommunityStation: function(roomName) {
         if ((isAdmin() || isCommunityStationOwner(roomName)) && !isBanned()) {
             CommunityStations.remove({name: roomName});
@@ -963,8 +963,8 @@ Meteor.methods({
             throw new Meteor.Error(403, "Invalid permissions.");
         }
     },
-    addVideoToPrivatePlaylist: function(name, id) {
-        if (Meteor.userId() && !isBanned()) {
+    addVideoToPrivatePlaylist: {
+        code: function(name, id) {
             var pl = PrivatePlaylists.findOne({owner: Meteor.userId(), name: name});
             if (pl !== undefined) {
                 var copy = false;
@@ -984,12 +984,11 @@ Meteor.methods({
             } else {
                 throw new Meteor.Error(404, "Playlist not found.");
             }
-        } else {
-            throw new Meteor.Error(403, "Invalid permissions.");
-        }
+        },
+        requirements: ["login"]
     },
-    removeVideoFromPrivatePlaylist: function(name, id) {
-        if (Meteor.userId() && !isBanned()) {
+    removeVideoFromPrivatePlaylist: {
+        code: function(name, id) {
             var pl = PrivatePlaylists.findOne({owner: Meteor.userId(), name: name});
             if (pl !== undefined) {
                 var copy = false;
@@ -1008,12 +1007,11 @@ Meteor.methods({
             } else {
                 throw new Meteor.Error(404, "Playlist not found.");
             }
-        } else {
-            throw new Meteor.Error(403, "Invalid permissions.");
-        }
+        },
+        requirements: ["login"]
     },
-    deletePrivatePlaylist: function(name) {
-        if (Meteor.userId() && !isBanned()) {
+    deletePrivatePlaylist: {
+        code: function(name) {
             var pl = PrivatePlaylists.findOne({owner: Meteor.userId(), name: name});
             if (pl !== undefined) {
                 PrivatePlaylists.remove({owner: Meteor.userId(), name: name});
@@ -1021,69 +1019,61 @@ Meteor.methods({
             } else {
                 throw new Meteor.Error(404, "Playlist not found.");
             }
-        } else {
-            throw new Meteor.Error(403, "Invalid permissions.");
-        }
+        },
+        requirements: ["login"]
     },
-    activateAlert: function(id) {
-        if (isAdmin() && !isBanned()) {
+    activateAlert: {
+        code: function(id) {
             Alerts.update(id, {$set: {active: true}});
-        } else {
-            throw new Meteor.Error(403, "Invalid permissions.");
-        }
+        },
+        requirements: ["admin"]
     },
-    deactivateAlert: function(id) {
-        if (isAdmin() && !isBanned()) {
+    deactivateAlert: {
+        code: function(id) {
             Alerts.update(id, {$set: {active: false}});
-        } else {
-            throw new Meteor.Error(403, "Invalid permissions.");
-        }
+        },
+        requirements: ["admin"]
     },
-    deleteAlert: function(id) {
-        if (isAdmin() && !isBanned()) {
+    deleteAlert: {
+        code: function(id) {
             Alerts.remove(id);
-        } else {
-            throw new Meteor.Error(403, "Invalid permissions.");
-        }
+        },
+        requirements: ["admin"]
     },
-    fetchSong: function(type) {
-        if (isAdmin() && !isBanned()) {
+    fetchSong: {
+        code: function(type) {
             getStation(type, function (station) {
                 station.fetchSongs();
             });
-        } else {
-            throw new Meteor.Error(403, "Invalid permissions.");
-        }
+        },
+        requirements: ["admin"]
     },
-    removeSongs: function(type) {
-        if (isAdmin() && !isBanned()) {
+    removeSongs: {
+        code: function(type) {
             getStation(type, function (station) {
                 station.removeSongs();
             });
-        } else {
-            throw new Meteor.Error(403, "Invalid permissions.");
-        }
+        },
+        requirements: ["admin"]
     },
-    lockRoom: function (type) {
-        if (isAdmin() && !isBanned()) {
+    lockRoom: {
+        code: function (type) {
             getStation(type, function (station) {
                 station.lock();
             });
-        } else {
-            throw new Meteor.Error(403, "Invalid permissions.");
-        }
+        },
+        requirements: ["admin"]
     },
-    unlockRoom: function (type) {
-        if (isAdmin() && !isBanned()) {
+    unlockRoom: {
+        code: function (type) {
             getStation(type, function (station) {
                 station.unlock();
             });
-        } else {
-            throw new Meteor.Error(403, "Invalid permissions.");
-        }
+        },
+        requirements: ["admin"]
     },
-    banUser: function (username, period, reason) {
-        if (isAdmin() && !isBanned()) {
+    banUser: {
+        code: function (username, period, reason) {
             var user = Meteor.user();
             var bannedUser = Meteor.users.findOne({"profile.usernameL": username.toLowerCase()});
             var bannedUntil = (new Date).getTime() + (period * 1000);
@@ -1099,12 +1089,11 @@ Meteor.methods({
             };
             Meteor.users.update({"profile.usernameL": bannedUser.profile.usernameL}, {$set: {"punishments.ban": banObject}});
             Meteor.users.update({"profile.usernameL": bannedUser.profile.usernameL}, {$push: {"punishments.bans": banObject}});
-        } else {
-            throw new Meteor.Error(403, "Invalid permissions.");
-        }
+        },
+        requirements: ["admin"]
     },
-    muteUser: function (username, period) {
-        if (isAdmin() && !isBanned()) {
+    muteUser: {
+        code: function (username, period) {
             var user = Meteor.user();
             var mutedUser = Meteor.users.findOne({"profile.usernameL": username.toLowerCase()});
             if (period === undefined || Number(period) === 0) {
@@ -1119,32 +1108,29 @@ Meteor.methods({
             var muteObject = {mutedBy: user.profile.usernameL, mutedAt: new Date(Date.now()), mutedUntil: mutedUntil};
             Meteor.users.update({"profile.usernameL": mutedUser.profile.usernameL}, {$set: {"punishments.mute": muteObject}});
             Meteor.users.update({"profile.usernameL": mutedUser.profile.usernameL}, {$push: {"punishments.mutes": muteObject}});
-        } else {
-            throw new Meteor.Error(403, "Invalid permissions.");
-        }
+        },
+        requirements: ["admin"]
     },
-    unbanUser: function (username) {
-        if (isAdmin() && !isBanned()) {
+    unbanUser: {
+        code: function (username) {
             Meteor.users.update({"profile.usernameL": username.toLowerCase()}, {$unset: "punishments.ban"});
-        } else {
-            throw new Meteor.Error(403, "Invalid permissions.");
-        }
+        },
+        requirements: ["admin"]
     },
-    unsilenceUser: function (username) {
-        if (isAdmin() && !isBanned()) {
+    unsilenceUser: {
+        code: function (username) {
             Meteor.users.update({"profile.usernameL": username.toLowerCase()}, {$unset: "punishments.mute"});
-        } else {
-            throw new Meteor.Error(403, "Invalid permissions.");
-        }
+        },
+        requirements: ["admin"]
     },
     isBanned: function () {
-        return isBanned();
+        return Meteor.isBanned();
     },
     isMuted: function () {
         return isMuted();
     },
-    updateSettings: function (showRating) {
-        if (Meteor.userId() && !isBanned()) {
+    updateSettings: {
+        code: function (showRating) {
             var user = Meteor.user();
             if (showRating !== true && showRating !== false) {
                 showRating = true;
@@ -1154,22 +1140,20 @@ Meteor.methods({
             } else {
                 Meteor.users.update({"profile.username": user.profile.username}, {$set: {"profile.settings": {showRating: showRating}}});
             }
-        } else {
-            throw new Meteor.Error(403, "Invalid permissions.");
-        }
+        },
+        requirements: ["login"]
     },
-    addAlert: function (description) {
-        if (isAdmin()) {
+    addAlert: {
+        code: function (description) {
             var username = Meteor.user().profile.username;
             description = htmlEntities(description);
             Alerts.insert({description: description, active: true, createdBy: username});
             return true;
-        } else {
-            throw Meteor.Error(403, "Invalid permissions.");
-        }
+        },
+        requirements: ["admin"]
     },
-    sendMessage: function (type, message) {
-        if (Meteor.userId() && !isBanned() && !isMuted()) {
+    sendMessage: {
+        code: function (type, message) {
             var user = Meteor.user();
             var time = new Date();
             var rawrank = user.profile.rank;
@@ -1184,61 +1168,60 @@ Meteor.methods({
             }
             else if (user.profile.rank === "admin") {
                 /*HTTP.call("GET", "http://www.wdyl.com/profanity?q=" + encodeURIComponent(message), function (err, res) {
-                    if (res.content.indexOf("true") > -1) {
-                        return true;
-                    } else {*/
-                        Chat.insert({
-                            type: type,
-                            rawrank: rawrank,
-                            rank: "[A]",
-                            message: message,
-                            time: time,
-                            username: username
-                        });
-                    /*}
-                });*/
+                 if (res.content.indexOf("true") > -1) {
+                 return true;
+                 } else {*/
+                Chat.insert({
+                    type: type,
+                    rawrank: rawrank,
+                    rank: "[A]",
+                    message: message,
+                    time: time,
+                    username: username
+                });
+                /*}
+                 });*/
                 return true;
             }
             else if (user.profile.rank === "moderator") {
                 /*HTTP.call("GET", "http://www.wdyl.com/profanity?q=" + encodeURIComponent(message), function (err, res) {
-                    if (res.content.indexOf("true") > -1) {
-                        return true;
-                    } else {*/
-                        Chat.insert({
-                            type: type,
-                            rawrank: rawrank,
-                            rank: "[M]",
-                            message: message,
-                            time: time,
-                            username: username
-                        });
-                    /*}
-                });*/
+                 if (res.content.indexOf("true") > -1) {
+                 return true;
+                 } else {*/
+                Chat.insert({
+                    type: type,
+                    rawrank: rawrank,
+                    rank: "[M]",
+                    message: message,
+                    time: time,
+                    username: username
+                });
+                /*}
+                 });*/
                 return true;
             }
             else {
                 /*HTTP.call("GET", "http://www.wdyl.com/profanity?q=" + encodeURIComponent(message), function (err, res) {
-                    if (res.content.indexOf("true") > -1) {
-                        return true;
-                    } else {*/
-                        Chat.insert({
-                            type: type,
-                            rawrank: rawrank,
-                            rank: "",
-                            message: message,
-                            time: time,
-                            username: username
-                        });
-                    /*}
-                });*/
+                 if (res.content.indexOf("true") > -1) {
+                 return true;
+                 } else {*/
+                Chat.insert({
+                    type: type,
+                    rawrank: rawrank,
+                    rank: "",
+                    message: message,
+                    time: time,
+                    username: username
+                });
+                /*}
+                 });*/
                 return true;
             }
-        } else {
-            throw new Meteor.Error(403, "Invalid permissions.");
-        }
+        },
+        requirements: ["login", "noMute"]
     },
-    likeSong: function (mid) {
-        if (Meteor.userId() && !isBanned()) {
+    likeSong: {
+        code: function (mid) {
             var user = Meteor.user();
             if (user.profile.liked.indexOf(mid) === -1) {
                 Meteor.users.update({"profile.username": user.profile.username}, {$push: {"profile.liked": mid}});
@@ -1253,12 +1236,11 @@ Meteor.methods({
                 Songs.update({mid: mid}, {$inc: {dislikes: -1}})
             }
             return true;
-        } else {
-            throw new Meteor.Error(403, "Invalid permissions.");
-        }
+        },
+        requirements: ["login"]
     },
-    dislikeSong: function (mid) {
-        if (Meteor.userId() && !isBanned()) {
+    dislikeSong: {
+        code: function (mid) {
             var user = Meteor.user();
             if (user.profile.disliked.indexOf(mid) === -1) {
                 Meteor.users.update({"profile.username": user.profile.username}, {$push: {"profile.disliked": mid}});
@@ -1273,12 +1255,11 @@ Meteor.methods({
                 Songs.update({mid: mid}, {$inc: {likes: -1}});
             }
             return true;
-        } else {
-            throw new Meteor.Error(403, "Invalid permissions.");
-        }
+        },
+        requirements: ["login"]
     },
-    voteSkip: function (type) {
-        if (Meteor.userId() && !isBanned()) {
+    voteSkip: {
+        code: function (type) {
             var user = Meteor.user();
             getStation(type, function (station) {
                 if (station.voted.indexOf(user.profile.username) === -1) {
@@ -1290,11 +1271,12 @@ Meteor.methods({
                 } else {
                     throw new Meteor.Error(401, "Already voted.");
                 }
-            })
-        }
+            });
+        },
+        requirements: ["login"]
     },
-    votePrivateSkip: function (name) {
-        if (Meteor.userId() && !isBanned()) {
+    votePrivateSkip: {
+        code: function (name) {
             var user = Meteor.user();
             getCommunityStation(name, function (station) {
                 if (station.voted.indexOf(user.profile.username) === -1) {
@@ -1306,11 +1288,12 @@ Meteor.methods({
                 } else {
                     throw new Meteor.Error(401, "Already voted.");
                 }
-            })
-        }
+            });
+        },
+        requirements: ["login"]
     },
-    submitReport: function (room, reportData) {
-        if (Meteor.userId() && !isBanned()) {
+    submitReport: {
+        code: function (room, reportData) {
             room = room.toLowerCase();
             if (Rooms.find({type: room}).count() === 1) {
                 if (Reports.find({room: room}).count() === 0) {
@@ -1334,12 +1317,11 @@ Meteor.methods({
             } else {
                 throw new Meteor.Error(403, "Invalid genre.");
             }
-        } else {
-            throw new Meteor.Error(403, "Invalid permissions.");
-        }
+        },
+        requirements: ["login"]
     },
-    shufflePlaylist: function (type) {
-        if (isAdmin() && !isBanned()) {
+    shufflePlaylist: {
+        code: function (type) {
             getStation(type, function (station) {
                 if (station === undefined) {
                     throw new Meteor.Error(404, "Station not found.");
@@ -1348,10 +1330,11 @@ Meteor.methods({
                     station.shufflePlaylist();
                 }
             });
-        }
+        },
+        requirements: ["admin"]
     },
-    skipSong: function (type) {
-        if (isAdmin() && !isBanned()) {
+    skipSong: {
+        code: function (type) {
             getStation(type, function (station) {
                 if (station === undefined) {
                     throw new Meteor.Error(404, "Station not found.");
@@ -1359,10 +1342,11 @@ Meteor.methods({
                     station.skipSong();
                 }
             });
-        }
+        },
+        requirements: ["admin"]
     },
-    pauseRoom: function (type) {
-        if (isAdmin() && !isBanned()) {
+    pauseRoom: {
+        code: function (type) {
             getStation(type, function (station) {
                 if (station === undefined) {
                     throw new Meteor.Error(403, "Room doesn't exist.");
@@ -1370,12 +1354,11 @@ Meteor.methods({
                     station.pauseRoom();
                 }
             });
-        } else {
-            throw new Meteor.Error(403, "Invalid permissions.");
-        }
+        },
+        requirements: ["admin"]
     },
-    resumeRoom: function (type) {
-        if (isAdmin() && !isBanned()) {
+    resumeRoom: {
+        code: function (type) {
             getStation(type, function (station) {
                 if (station === undefined) {
                     throw new Meteor.Error(403, "Room doesn't exist.");
@@ -1383,9 +1366,8 @@ Meteor.methods({
                     station.resumeRoom();
                 }
             });
-        } else {
-            throw new Meteor.Error(403, "Invalid permissions.");
-        }
+        },
+        requirements: ["admin"]
     },
     skipPrivateSong: function (name) {
         if ((isAdmin() || isCommunityStationOwner(name)) && !isBanned()) {
@@ -1465,8 +1447,8 @@ Meteor.methods({
             throw new Meteor.Error(403, "Invalid permissions.");
         }
     },
-    createUserMethod: function (formData, captchaData) {
-        if (!isBanned()) {
+    createUserMethod: {
+        code: function (formData, captchaData) {
             var verifyCaptchaResponse = reCAPTCHA.verifyCaptcha(this.connection.clientAddress, captchaData);
             if (!verifyCaptchaResponse.success) {
                 throw new Meteor.Error(422, 'reCAPTCHA Failed: ' + verifyCaptchaResponse.error);
@@ -1478,10 +1460,11 @@ Meteor.methods({
                 });
             }
             return true;
-        }
+        },
+        requirements: []
     },
-    createArticle: function(data) {
-        if (!isBanned() && isModerator()) {
+    createArticle: {
+        code: function(data) {
             var userId = Meteor.userId();
             var requiredProperties = ["title", "content", "anonymous"];
             if (data !== undefined && Object.keys(data).length === requiredProperties.length) {
@@ -1509,12 +1492,11 @@ Meteor.methods({
             } else {
                 throw new Meteor.Error(403, "Invalid data.");
             }
-        } else {
-            throw new Meteor.Error(403, "Invalid permissions.");
-        }
+        },
+        requirements: ["moderator"]
     },
-    addSongToQueue: function (songData) {
-        if (Meteor.userId() && !isBanned()) {
+    addSongToQueue: {
+        code: function (songData) {
             var userId = Meteor.userId();
             var requiredProperties = ["title", "artist", "id", "genres"];
             if (songData !== undefined && Object.keys(songData).length === requiredProperties.length) {
@@ -1549,12 +1531,11 @@ Meteor.methods({
             } else {
                 throw new Meteor.Error(403, "Invalid data.");
             }
-        } else {
-            throw new Meteor.Error(403, "Invalid permissions.");
-        }
+        },
+        requirements: ["login"]
     },
-    updateQueueSong: function (mid, newSong) {
-        if (isModerator() && !isBanned()) {
+    updateQueueSong: {
+        code: function (mid, newSong) {
             Queues.update({mid: mid}, {$set: {
                 "title": newSong.title,
                 "artist": newSong.artist,
@@ -1571,12 +1552,11 @@ Meteor.methods({
                     return true;
                 }
             });
-        } else {
-            throw new Meteor.Error(403, "Invalid permissions.");
-        }
+        },
+        requirements: ["moderator"]
     },
-    updatePlaylistSong: function (mid, newSong) {
-        if (isModerator() && !isBanned()) {
+    updatePlaylistSong: {
+        code: function (mid, newSong) {
             Songs.update({mid: mid}, {$set: {
                 "title": newSong.title,
                 "artist": newSong.artist,
@@ -1595,40 +1575,29 @@ Meteor.methods({
                 }
             });
             return true;
-        } else {
-            throw new Meteor.Error(403, "Invalid permissions.");
-        }
+        },
+        requirements: ["moderator"]
     },
-    removeSongFromQueue: function (mid) {
-        if (isModerator() && !isBanned()) {
+    removeSongFromQueue: {
+        code: function (mid) {
             Queues.remove({mid: mid});
-        } else {
-            throw new Meteor.Error(403, "Invalid permissions.");
-        }
+        },
+        requirements: ["moderator"]
     },
-    removeSongFromPlaylist: function (type, mid) {
-        if (isModerator() && !isBanned()) {
+    removeSongFromPlaylist: {
+        code: function (type, mid) {
             Playlists.update({type: type}, {$pull: {songs: mid}});
-        } else {
-            throw new Meteor.Error(403, "Invalid permissions.");
-        }
+        },
+        requirements: ["moderator"]
     },
-    deleteSong: function (mid) {
-        if (isModerator() && !isBanned()) {
+    deleteSong: {
+        code: function (mid) {
             Songs.remove({mid: mid})
-        } else {
-            throw new Meteor.Error(403, "Invalid permissions.");
-        }
-    },
-    deleteSong: function (mid) {
-        if (isModerator() && !isBanned()) {
-            Songs.remove({mid: mid})
-        } else {
-            throw new Meteor.Error(403, "Invalid permissions.");
-        }
+        },
+        requirements: ["moderator"]
     },
-    addSongToPlaylist: function (songData) {
-        if (isModerator() && !isBanned()) {
+    addSongToPlaylist: {
+        code: function (songData) {
             var requiredProperties = ["_id", "mid", "id", "title", "artist", "duration", "skipDuration", "img", "likes", "dislikes", "requestedBy", "genres"];
             if (songData !== undefined && Object.keys(songData).length === requiredProperties.length) {
                 for (var property in requiredProperties) {
@@ -1652,64 +1621,59 @@ Meteor.methods({
             } else {
                 throw new Meteor.Error(403, "Invalid data.");
             }
-        } else {
-            throw new Meteor.Error(403, "Invalid permissions.");
-        }
+        },
+        requirements: ["moderator"]
     },
-    createRoom: function (display, tag, private, desc) {
-        if (isAdmin() && !isBanned()) {
+    createRoom: {
+        code: function (display, tag, private, desc) {
             createRoom(display, tag, private, desc);
-        } else {
-            throw new Meteor.Error(403, "Invalid permissions.");
-        }
+        },
+        requirements: ["admin"]
     },
-    createCommunityStation: function (name, display, private, desc) {
-        if (Meteor.userId() && !isBanned()) {
+    createCommunityStation: {
+        code: function (name, display, private, desc) {
             name = name.toLowerCase();
             createCommunityStation(name, display, private, desc, Meteor.userId());
-        } else {
-            throw new Meteor.Error(403, "Invalid permissions.");
-        }
+        },
+        requirements: ["login"]
     },
-    createPrivatePlaylist: function (name, display) {
-        if (Meteor.userId() && !isBanned()) {
-			name = name.toLowerCase();
+    createPrivatePlaylist: {
+        code: function (name, display) {
+            name = name.toLowerCase();
             if (PrivatePlaylists.findOne({name: name, owner: Meteor.userId()}) === undefined) {
                 PrivatePlaylists.insert({name: name, displayName: display, songs: [{id: "60ItHLz5WEA", duration: 213, title: "Alan Walker - Faded"}], owner: Meteor.userId()});
             }
-        } else {
-            throw new Meteor.Error(403, "Invalid permissions.");
-        }
+        },
+        requirements: ["login"]
     },
-    deleteRoom: function (type) {
-        if (isAdmin() && !isBanned()) {
+    deleteRoom: {
+        code: function (type) {
             Rooms.remove({type: type});
             return true;
-        } else {
-            throw new Meteor.Error(403, "Invalid permissions.");
-        }
+        },
+        requirements: ["admin"]
     },
-    getUserNum: function () {
-        if (!isBanned()) {
+    getUserNum: {
+        code: function () {
             return Object.keys(Meteor.default_server.sessions).length;
-        }
+        },
+        requirements: []
     },
     getTotalUsers: function () {
         return Meteor.users.find().count();
     },
-    updateRealName: function (realname) {
-        if (Meteor.userId()) {
+    updateRealName: {
+        code: function (realname) {
             var oldName = Meteor.users.findOne(Meteor.userId()).profile.realname;
             Meteor.users.update(Meteor.userId(), {
                 $set: {"profile.realname": realname},
                 $push: {"profile.realnames": oldName}
             });
-        } else {
-            throw new Meteor.Error(403, "Invalid permissions.");
-        }
+        },
+        requirements: ["login"]
     },
-    updateUserName: function (newUserName) {
-        if (Meteor.userId()) {
+    updateUserName: {
+        code: function (newUserName) {
             var oldUsername = Meteor.users.findOne(Meteor.userId()).profile.username;
             Meteor.users.update(Meteor.userId(), {
                 $set: {
@@ -1718,9 +1682,8 @@ Meteor.methods({
                     "profile.usernameL": newUserName.toLowerCase()
                 }, $push: {"profile.usernames": oldUsername}
             });
-        } else {
-            throw new Meteor.Error(403, "Invalid permissions.");
-        }
+        },
+        requirements: ["login"]
     },
     /*updateUserRank: function(newRank){
      if (Meteor.userId()) {
@@ -1729,33 +1692,33 @@ Meteor.methods({
      throw new Meteor.Error(403, "Invalid permissions.");
      }
      },*/
-    deleteAccount: function () {
-        if (Meteor.userId()) {
+    deleteAccount: {
+        code: function () {
             var user = Meteor.users.findOne(Meteor.userId());
             Meteor.users.remove({_id: Meteor.userId()});
-        } else {
-            throw new Meteor.Error(403, "Invalid permissions.");
-        }
+        },
+        requirements: ["login"]
     },
-    sendFeedback: function(message){
-        if(Meteor.userId() && !isBanned()) {
-            HTTP.call("GET", "http://www.wdyl.com/profanity?q=" + encodeURIComponent(message), function (err, res) {
+    sendFeedback: {
+        code: function(message){
+            /*HTTP.call("GET", "http://www.wdyl.com/profanity?q=" + encodeURIComponent(message), function (err, res) {
                 if (res.content.indexOf("true") > -1) {
                     return true;
-                } else {
+                } else {*/
                     Feedback.insert({
                         "username": Meteor.user().profile.username,
                         "message": message,
                         "upvotes": 0,
                         "upvotedBy": []
                     })
-                }
-            });
-        }
+                /*}
+            });*/
+        },
+        requirements: ["login"]
     },
-    upvoteFeedback: function(message){
-        if(Meteor.userId() && !isBanned()){
-            console.log(Feedback.findOne({"message": message}));
+    upvoteFeedback: {
+        code: function(message){
+            //TODO Fix feedback upvoting to use Id's
             if(Feedback.findOne({"message": message}).upvotedBy.indexOf(Meteor.user().profile.username) === -1){
                 Feedback.update({"message": message}, {$inc: {"upvotes": 1}});
                 Feedback.update({"message": message}, {$push: {"upvotedBy": Meteor.user().profile.username}});
@@ -1763,35 +1726,32 @@ Meteor.methods({
                 Feedback.update({"message": message}, {$inc: {"upvotes": -1}});
                 Feedback.update({"message": message}, {$pull: {"upvotedBy": Meteor.user().profile.username}});
             }
-        }
+        },
+        requirements: ["login"]
     },
-    deleteFeedback: function(message){
-        if(isAdmin() && !isBanned()){
+    deleteFeedback: {
+        code: function(message){
             Feedback.remove({"message": message});
-        } else {
-            throw new Meteor.Error(403, "Invalid permissions.");
-        }
+        },
+        requirements: ["admin"]
     },
-    updateFeedback: function(oldMessage, newMessage){
-        if(isAdmin() && !isBanned()){
+    updateFeedback: {
+        code: function(oldMessage, newMessage){
             Feedback.update({"message": oldMessage}, {$set: {"message": newMessage}});
-        } else {
-            throw new Meteor.Error(403, "Invalid permissions.");
-        }
+        },
+        requirements: ["admin"]
     },
-    editRoomDesc: function(type, description){
-        if(isAdmin() && !isBanned()){
+    editRoomDesc: {
+        code: function(type, description){
             Rooms.update({type: type}, {$set: {"roomDesc": description}});
-        } else {
-            throw new Meteor.Error(403, "Invalid permissions.");
-        }
+        },
+        requirements: ["admin"]
     },
-    removeReport: function(query, obj){
-        if(isAdmin() && !isBanned()){
+    removeReport: {
+        code: function(query, obj){
             Reports.update(query, {$pull: {"report": obj}});
-        } else {
-            throw new Meteor.Error(403, "Invalid permissions.");
-        }
+        },
+        requirements: ["admin"]
     }
 });