 JName           = require '../name'
 JUser           = require '../user'
 JGroup          = require '../group'
+
+# TODO Credential relations ~g
 
 module.exports = class JStackTemplate extends jraphical.Module
 

      'create stack template'     : ['member']
      'list stack templates'      : ['member']

      'delete stack template'     : []
      'delete own stack template' : ['member']
      'update stack template'     : []
      'update own stack template' : ['member']

    sharedMethods     :


      unless typeof selector is 'object'
        return callback new KodingError "Invalid query"

      selector.$and ?= []
      selector.$and.push
        $or : [
          { originId      : delegate.getId() }
          { accessLevel   : 'public' }
          {
            $and          : [
              accessLevel : 'group'
              group       : client.context.group
            ]
          }
        ]

      @some selector, options, (err, templates)->
        callback err, templates
