packages/udaru-core/lib/ops/policyOps.js
function readSharedPolicy ({ id }, cb) {
      let promise = null
      if (typeof cb !== 'function') [promise, cb] = asyncify()

      Joi.validate({ id }, validationRules.readSharedPolicy, function (err) {
        if (err) return cb(Boom.badRequest(err))

        const sqlQuery = SQL`
          SELECT  *
          FROM policies
          WHERE id = ${id}
          AND org_id IS NULL
        `
        db.query(sqlQuery, function (err, result) {
          if (err) return cb(Boom.badImplementation(err))
          if (result.rowCount === 0) return cb(Boom.notFound())

          return cb(null, mapping.policy(result.rows[0]))
        })
      })

      return promise
    }
function readSharedPolicy ({ id }, cb) {
      let promise = null
      if (typeof cb !== 'function') [promise, cb] = asyncify()

      Joi.validate({ id }, validationRules.readSharedPolicy, function (err) {
        if (err) return cb(Boom.badRequest(err))

        const sqlQuery = SQL`
          SELECT  *
          FROM policies
          WHERE id = ${id}
          AND org_id IS NULL
        `
        db.query(sqlQuery, function (err, result) {
          if (err) return cb(Boom.badImplementation(err))
          if (result.rowCount === 0) return cb(Boom.notFound())

          return cb(null, mapping.policy(result.rows[0]))
        })
      })

      return promise
    }
function readSharedPolicy ( { id } , cb ) { let promise = null if ( typeof cb !== 'function' ) [ promise , cb ] = asyncify ( ) Joi . validate ( { id } , validationRules . readSharedPolicy , function ( err ) { if ( err ) return cb ( Boom . badRequest ( err ) ) const sqlQuery = SQL ` ${ id } ` db . query ( sqlQuery , function ( err , result ) { if ( err ) return cb ( Boom . badImplementation ( err ) ) if ( result . rowCount === 0 ) return cb ( Boom . notFound ( ) ) return cb ( null , mapping . policy ( result . rows [ 0 ] ) ) } ) } ) return promise }
fetch specific shared policy

@param  {Object}   params { id }
@param  {Function} cb
fetch specific shared policy