 ## @callback {function} Continuation to pass control back to when complete.
 ## Check if application can manage docType
 module.exports.checkDocType = (auth, docType, callback) ->
+    # Check if application is authenticated
     checkToken auth, (err, isAuthenticated, name) =>
         if isAuthenticated
             if docType?
                 docType = docType.toLowerCase()
+                # Check if application can manage docType
                 if permissions[name][docType]?
                     console.log "#{name} is authorized to manage #{docType} "
                     callback null, true, true

                permissions[body.name][docType.toLowerCase()] = description



## function init (app, callback)
## @app {Object} application DS, allows to acces variables environment of DS
## @callback {function} Continuation to pass control back to when complete.
## Initialize tokens which contains applications and their tokens
module.exports.init = (app, callback) ->
    token = fs.readFileSync('/etc/cozy/tokens/data-system.token', 'utf8')
    token = token.split('\n')[0]
    tokens['home'] = token
    permissions.home = 
        "application":

        auth = new Buffer(auth, 'base64').toString('ascii')
        username = auth.split(':')[0]
        password = auth.split(':')[1]
        # Check if application is cozy-proxy
        if password isnt undefined and tokens[username] is password
            if username is "proxy"
                console.log "proxy is authenticated"
