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

      const { id, organizationId } = params
      const tasks = [
        (job, next) => {
          Joi.validate({ id, organizationId }, validationRules.deletePolicy, (err) => {
            if (err) return next(Boom.badRequest(err))

            next()
          })
        },
        (job, next) => {
          job.id = id
          job.organizationId = organizationId
          next()
        },
        removePolicyFromUsers,
        removePolicyFromTeams,
        removePolicyFromOrganizations,
        removePolicy
      ]

      db.withTransaction(tasks, (err, res) => {
        if (err) return cb(err)
        cb()
      })

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

      const { id, organizationId } = params
      const tasks = [
        (job, next) => {
          Joi.validate({ id, organizationId }, validationRules.deletePolicy, (err) => {
            if (err) return next(Boom.badRequest(err))

            next()
          })
        },
        (job, next) => {
          job.id = id
          job.organizationId = organizationId
          next()
        },
        removePolicyFromUsers,
        removePolicyFromTeams,
        removePolicyFromOrganizations,
        removePolicy
      ]

      db.withTransaction(tasks, (err, res) => {
        if (err) return cb(err)
        cb()
      })

      return promise
    }
function deletePolicy ( params , cb ) { let promise = null if ( typeof cb !== 'function' ) [ promise , cb ] = asyncify ( ) const { id , organizationId } = params const tasks = [ ( job , next ) => { Joi . validate ( { id , organizationId } , validationRules . deletePolicy , ( err ) => { if ( err ) return next ( Boom . badRequest ( err ) ) next ( ) } ) } , ( job , next ) => { job . id = id job . organizationId = organizationId next ( ) } , removePolicyFromUsers , removePolicyFromTeams , removePolicyFromOrganizations , removePolicy ] db . withTransaction ( tasks , ( err , res ) => { if ( err ) return cb ( err ) cb ( ) } ) return promise }
Delete a specific policy

@param  {Object}   params { id, organizationId }
@param  {Function} cb
Delete a specific policy