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

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

          next()
        },
        checkOrg,
        clearOrganizationAttachedPolicies
      ]

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

        organizationOps.readById(id, cb)
      })

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

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

          next()
        },
        checkOrg,
        clearOrganizationAttachedPolicies
      ]

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

        organizationOps.readById(id, cb)
      })

      return promise
    }
function deleteOrganizationAttachedPolicies ( params , cb ) { let promise = null if ( typeof cb !== 'function' ) [ promise , cb ] = asyncify ( ) const { id } = params const tasks = [ ( job , next ) => { Joi . validate ( { id } , validationRules . deleteOrganizationPolicies , ( err ) => { if ( err ) return next ( Boom . badRequest ( err ) ) next ( ) } ) } , ( job , next ) => { job . id = id next ( ) } , checkOrg , clearOrganizationAttachedPolicies ] db . withTransaction ( tasks , ( err , res ) => { if ( err ) return cb ( err ) organizationOps . readById ( id , cb ) } ) return promise }
Rmove all organization's attached policies

@param  {Object}   params { id, organizationId }
@param  {Function} cb
Rmove all organization s attached policies