 ## @callback {function} Continuation to pass control back to when complete.
 ## Update application permissions and token
 module.exports.updatePermissions = (body, callback) ->
-    if process.env.NODE_ENV is "production" or process.env.NODE_ENV is "test"
+    if productionOrTest
         if body.password?
             tokens[body.name] = body.password
         permissions[body.name] = {}

## Check if application is proxy
## Useful for register and login requests
module.exports.checkProxyHome = (auth, callback) ->
    if process.env.NODE_ENV is "production" or process.env.NODE_ENV is "test"
        if auth isnt "undefined" and auth?
            # Recover username and password in field authorization
            auth = auth.substr(5, auth.length - 1)

## Check if application can manage docType
module.exports.checkDocType = (auth, docType, callback) ->
    # Check if application is authenticated
    if productionOrTest
        checkToken auth, (err, isAuthenticated, name) =>
            if isAuthenticated
                if docType?
