Remove one organization policy

@param  {Object}   params { id, policyId, instance } "instance" optional
@param  {Function} cb
760509
function deleteOrganizationAttachedPolicy (params, cb) {
      let promise = null
      if (typeof cb !== 'function') [promise, cb] = asyncify()

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

          next()
        },
        checkOrg,
        clearOrganizationAttachedPolicy
      ]

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

        organizationOps.readById(id, cb)
      })

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

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

          next()
        },
        checkOrg,
        clearOrganizationAttachedPolicies
      ]

      if (policies.length > 0) {
        tasks.push((job, next) => {
          utils.checkPoliciesOrg(job.client, job.policies, job.id, next)
        })
        tasks.push(insertOrgPolicies)
      }

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

        organizationOps.readById(id, cb)
      })

      return promise
    }
171580
@Override
    public void removePolicy(String sec, String ptype, List<String> rule) {
        throw new Error("not implemented");
    }
1309321
function remove(appName, domain, callback) {
    var url = format('/%s/apps/%s/domains/%s', deis.version, appName, domain);
    commons.del(url, callback);
  }
1347648
function deleteAccount (name, cb) {
  assert(this instanceof CouchLogin)
  var u = '/_users/org.couchdb.user:' + name
  this.get(u, thenPut.bind(this))

  function thenPut (er, res, data) {
    if (er || res.statusCode !== 200) {
      return cb(er, res, data)
    }

    // user accts can't be just DELETE'd by non-admins
    // so we take the existing doc and just slap a _deleted
    // flag on it to fake it.  Works the same either way
    // in couch.
    data._deleted = true
    this.put(u + '?rev=' + data._rev, data, cb)
  }
}
143866
function(callback) {
  console.log('Removing Checks');
  async.series([
    function(cb) { CheckEvent.collection.remove(cb); },
    function(cb) { Check.collection.remove(cb); }
  ], callback);
}
6147
def remove_policy(self, index=None, params=None):
        
        return self.transport.perform_request(
            "POST", _make_path(index, "_ilm", "remove"), params=params
        )
580244
function remove(connections, params, cb) {
  var failed = validate(params).has(CONSTANTS.DATA_SOURCE_ID);

  if (failed) {
    return cb(buildErrorResponse({error: new Error("An ID Parameter Is Required To Remove A Data Source"), code: ERROR_CODES.FH_FORMS_INVALID_PARAMETERS}));
  }

  if (!misc.checkId(params[CONSTANTS.DATA_SOURCE_ID])) {
    return cb(buildErrorResponse({error: new Error("Invalid ID Parameter"), code: ERROR_CODES.FH_FORMS_INVALID_PARAMETERS}));
  }
  var DataSource = models.get(connections.mongooseConnection, models.MODELNAMES.DATA_SOURCE);

  async.waterfall([
    function findAssociatedForms(cb) {
      checkFormsUsingDataSource(connections, params, cb);
    },
    function verifyNoFormsAssociated(updatedDataSource, cb) {
      //If there are any forms using this data source, then do not delete it.
      logger.debug("Remove Data Source ", {updatedDataSource: updatedDataSource});

      if (updatedDataSource.forms.length > 0) {
        return cb(buildErrorResponse({
          error: new Error("Forms Are Associated With This Data Source. Please Disassociate Forms From This Data Source Before Deleting."),
          code: ERROR_CODES.FH_FORMS_UNEXPECTED_ERROR
        }));
      }

      return cb(undefined, updatedDataSource);
    },
    function processResponse(updatedDataSource, cb) {
      //Removing The Data Source

      DataSource.remove({_id: updatedDataSource._id}, function(err) {
        if (err) {
          return cb(buildErrorResponse({
            error: err,
            userDetail: "Unexpected Error When Removing A Data Source",
            code: ERROR_CODES.FH_FORMS_UNEXPECTED_ERROR
          }));
        }

        //Data Source Removed Successfully
        return cb(undefined, updatedDataSource);
      });
    },
    function removeAduditLogs(updatedDataSource, cb) {
      DataSource.clearAuditLogs(updatedDataSource._id, cb);
    }
  ], cb);
}
765949
function del(body, cb) {
  db.getClient(function(err, client, done) {
    client.query(DELETE, [body.post_id, body.tag_id], function(err, r) {
      if(err) {
        cb(err);
        done(err);
      } else {
        cb(null, r.rowCount);
        done();
      }
    });
  });
}
471913
function updatePolicy (params, cb) {
      let promise = null
      if (typeof cb !== 'function') [promise, cb] = asyncify()

      const { id, organizationId, version, name, statements } = params

      Joi.validate({ id, organizationId, version, name, statements }, validationRules.updatePolicy, function (err) {
        if (err) return cb(Boom.badRequest(err))

        const sqlQuery = SQL`
          UPDATE policies
          SET
            version = ${version},
            name = ${name},
            statements = ${statements}
          WHERE
            id = ${id}
            AND org_id = ${organizationId}
        `
        db.query(sqlQuery, function (err, result) {
          if (utils.isUniqueViolationError(err)) return cb(Boom.conflict(err.detail))
          if (err) return cb(Boom.badImplementation(err))
          if (result.rowCount === 0) return cb(Boom.notFound())

          policyOps.readPolicy({ id, organizationId }, cb)
        })
      })

      return promise
    }
1226273
async function removeMemberFromCryptoKeyPolicy(
  projectId = 'your-project-id', // Your GCP projectId
  keyRingId = 'my-key-ring', // Name of the crypto key's key ring
  cryptoKeyId = 'my-key', // Name of the crypto key, e.g. "my-key"
  member = 'user:dev@example.com', // Member to add to the crypto key
  role = 'roles/viewer' // Role to give the member
) {
  // Import the library and create a client
  const kms = require('@google-cloud/kms');
  const client = new kms.KeyManagementServiceClient();

  // The location of the crypto key's key ring, e.g. "global"
  const locationId = 'global';

  // Get the full path to the crypto key
  const resource = client.cryptoKeyPath(
    projectId,
    locationId,
    keyRingId,
    cryptoKeyId
  );

  // Gets the IAM policy of a crypto key
  const [result] = await client.getIamPolicy({resource});
  let policy = Object.assign({bindings: []}, result);
  const index = policy.bindings.findIndex(binding => binding.role === role);
  const members = [];
  const binding = Object.assign({role, members}, policy.bindings[index]);
  if (index === -1) {
    return;
  }
  if (!binding.members.includes(member)) {
    return;
  }

  // Remove the role/member combo from the policy
  binding.members.splice(binding.members.indexOf(member), 1);

  const request = {resource, policy};
  console.log(JSON.stringify(request, null, 2));

  // Removes the member/role combo from the policy of the crypto key
  [policy] = await client.setIamPolicy(request);
  console.log(
    `${member}/${role} combo removed from policy for crypto key ${cryptoKeyId}.`
  );
  if (policy.bindings) {
    policy.bindings.forEach(binding => {
      if (binding.members && binding.members.length) {
        console.log(`${binding.role}:`);
        binding.members.forEach(member => {
          console.log(`  ${member}`);
        });
      }
    });
  } else {
    console.log(`Policy for crypto key ${cryptoKeyId} is empty.`);
  }
}
620316
function (opts, cb) {
            var self = this;
            cb = cb || function () {
                };
            opts = opts || {};
            var url = this._getlisturi(opts);
            this.client.delete({
                uri: url
            }, cb);
        }
980062
public boolean removeNamedGroupingPolicy(String ptype, List<String> params) {
        boolean ruleRemoved = removePolicy("g", ptype, params);

        if (autoBuildRoleLinks) {
            buildRoleLinks();
        }
        return ruleRemoved;
    }
1279137
function unsubscribe(name, id, callback) {
        if (typeof name !== s_string) {
            throw new TypeError('topic name must be a string.');
        }
        if (id === undefined || id === null) {
            if (typeof callback === s_function) {
                id = callback;
            }
            else {
                delete _topics[name];
                return;
            }
        }
        if (typeof id === s_function) {
            callback = id;
            id = null;
        }
        if (id === null) {
            if (_id === null) {
                if (_topics[name]) {
                    var topics = _topics[name];
                    for (id in topics) {
                        delTopic(topics, id, callback);
                    }
                }
            }
            else {
                _id.then(function(id) {
                    unsubscribe(name, id, callback);
                });
            }
        }
        else if (Future.isPromise(id)) {
            id.then(function(id) {
                unsubscribe(name, id, callback);
            });
        }
        else {
            delTopic(_topics[name], id, callback);
        }
        if (isObjectEmpty(_topics[name])) {
            delete _topics[name];
        }
    }
600017
def remove(self, param):
        
        if self.has(param):
            del(self.raw_dict[param])
            self.manifest.remove_option(self.feature_name, param)
1358600
function removeData(params) {
    var defaults$$1 = {
      field: 'data',
      event: 'data',
      triggerFnName: 'trigger',
      triggerEvent: false,
      immutableKeys: {} // key => true if immutable

    };
    params = extend({}, defaults$$1, params);
    return function removeDataImpl(names) {
      var p = params;
      var self = this;
      var selfIsArrayLike = self.length !== undefined;
      var all = selfIsArrayLike ? self : [self]; // put in array if not array-like
      // .removeData('foo bar')

      if (string(names)) {
        // then get the list of keys, and delete them
        var keys = names.split(/\s+/);
        var l = keys.length;

        for (var i = 0; i < l; i++) {
          // delete each non-empty key
          var key = keys[i];

          if (emptyString(key)) {
            continue;
          }

          var valid = !p.immutableKeys[key]; // not valid if immutable

          if (valid) {
            for (var i_a = 0, l_a = all.length; i_a < l_a; i_a++) {
              all[i_a]._private[p.field][key] = undefined;
            }
          }
        }

        if (p.triggerEvent) {
          self[p.triggerFnName](p.event);
        } // .removeData()

      } else if (names === undefined) {
        // then delete all keys
        for (var _i_a = 0, _l_a = all.length; _i_a < _l_a; _i_a++) {
          var _privateFields = all[_i_a]._private[p.field];

          var _keys = Object.keys(_privateFields);

          for (var _i2 = 0; _i2 < _keys.length; _i2++) {
            var _key = _keys[_i2];
            var validKeyToDelete = !p.immutableKeys[_key];

            if (validKeyToDelete) {
              _privateFields[_key] = undefined;
            }
          }
        }

        if (p.triggerEvent) {
          self[p.triggerFnName](p.event);
        }
      }

      return self; // maintain chaining
    }; // function
  }
875483
function deleteUserFromTeams (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.deleteUserFromTeams, (err) => {
            if (err) return next(Boom.badRequest(err))
            next()
          })
        },
        (job, next) => {
          job.id = id
          job.organizationId = organizationId

          next()
        },
        checkUserOrg,
        clearUserTeams
      ]

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

        userOps.readUser({ id, organizationId }, cb)
      })

      return promise
    }