// RemoveNamedPolicy removes an authorization rule from the current named policy.
966741
func (e *Enforcer) RemoveNamedPolicy(ptype string, params ...interface{}) bool {
	var ruleRemoved bool
	if strSlice, ok := params[0].([]string); len(params) == 1 && ok {
		ruleRemoved = e.removePolicy("p", ptype, strSlice)
	} else {
		policy := make([]string, 0)
		for _, param := range params {
			policy = append(policy, param.(string))
		}

		ruleRemoved = e.removePolicy("p", ptype, policy)
	}

	return ruleRemoved
}
708423
func (e *Enforcer) RemovePolicySafe(params ...interface{}) (result bool, err error) {
	defer func() {
		if r := recover(); r != nil {
			err = fmt.Errorf("%v", r)
			result = false
		}
	}()

	result = e.RemoveNamedPolicy("p", params...)
	err = nil
	return
}
1137435
func (st *State) removeCloudOps(name string) ([]txn.Op, error) {
	countOp, n, err := countCloudModelRefOp(st, name)
	if err != nil {
		return nil, errors.Trace(err)
	}
	if n != 0 {
		return nil, errors.Errorf("cloud is used by %d model%s", n, plural(n))
	}

	ops := []txn.Op{{
		C:      cloudsC,
		Id:     name,
		Remove: true,
	}, countOp}

	credPattern := bson.M{
		"_id": bson.M{"$regex": "^" + name + "#"},
	}
	credOps, err := st.removeInCollectionOps(cloudCredentialsC, credPattern)
	if err != nil {
		return nil, errors.Trace(err)
	}
	ops = append(ops, credOps...)

	permPattern := bson.M{
		"_id": bson.M{"$regex": "^" + cloudGlobalKey(name) + "#"},
	}
	permOps, err := st.removeInCollectionOps(permissionsC, permPattern)
	if err != nil {
		return nil, errors.Trace(err)
	}
	ops = append(ops, permOps...)

	settingsPattern := bson.M{
		"_id": bson.M{"$regex": "^(" + cloudGlobalKey(name) + "|" + name + "#.*)"},
	}
	settingsOps, err := st.removeInCollectionOps(globalSettingsC, settingsPattern)
	if err != nil {
		return nil, errors.Trace(err)
	}
	ops = append(ops, settingsOps...)
	return ops, nil
}
6457
func (b *UpdateBuilder) RemoveNamed(column, name string) *UpdateBuilder {
	return b.removeValue(column, param(name))
}
886260
func OpenNamedPipe(name string, perm uint32) (*os.File, error) {
	return nil, fmt.Errorf("Named pipes are not supported on windows")
}
183123
func removeIPAddressDocOp(ipAddressDocID string) txn.Op {
	return txn.Op{
		C:      ipAddressesC,
		Id:     ipAddressDocID,
		Remove: true,
	}
}
472258
func (r *repository) RemoveDelegationKeysAndPaths(name data.RoleName, keyIDs, paths []string) error {
	if len(paths) > 0 {
		err := r.RemoveDelegationPaths(name, paths)
		if err != nil {
			return err
		}
	}
	if len(keyIDs) > 0 {
		err := r.RemoveDelegationKeys(name, keyIDs)
		if err != nil {
			return err
		}
	}
	return nil
}
1259899
func Remove(name string) error {
	lock.Lock()
	defer lock.Unlock()

	name = applyNamespace(name)

	delete(griftList, name)
	delete(descriptions, name)
	return nil
}
691663
func (r *repository) RemoveDelegationRole(name data.RoleName) error {

	if !data.IsDelegation(name) {
		return data.ErrInvalidRole{Role: name, Reason: "invalid delegation role name"}
	}

	logrus.Debugf(`Removing delegation "%s"\n`, name)

	template := newDeleteDelegationChange(name, nil)
	return addChange(r.changelist, template, name)
}
1023694
func (f *Facade) RemoveVirtualIP(ctx datastore.Context, vip pool.VirtualIP) error {
	defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.RemoveVirtualIP"))
	alog := f.auditLogger.Message(ctx, "Removing VirtualIP").Action(audit.Update).
		WithField("virtualip", vip.IP)
	entity, err := f.GetResourcePool(ctx, vip.PoolID)
	if err != nil {
		return alog.Error(err)
	} else if entity == nil {
		return alog.Error(ErrPoolNotExists)
	}
	alog = alog.Entity(entity)
	if err := f.removeVirtualIP(ctx, vip.PoolID, vip.IP); err != nil {
		return alog.Error(err)
	}
	for i, currentVIP := range entity.VirtualIPs {
		if currentVIP.IP == vip.IP {
			entity.VirtualIPs = append(entity.VirtualIPs[:i], entity.VirtualIPs[i+1:]...)
			break
		}
	}

	// grab all services that are assigned to that virtual ip
	query := []string{fmt.Sprintf("Endpoints.AddressAssignment.IPAddr:%s", vip.IP)}
	services, err := f.GetTaggedServices(ctx, query)
	if err != nil {
		glog.Errorf("Failed to grab services with endpoints assigned to ip %s: %s", vip.IP, err)
		return alog.Error(err)
	}

	evtctx := newEventCtx()
	err = f.beforeEvent(beforePoolUpdate, evtctx, entity)
	defer f.afterEvent(afterPoolUpdate, evtctx, entity, err)
	if err != nil {
		return alog.Error(err)
	} else if err = f.poolStore.Put(ctx, pool.Key(entity.ID), entity); err != nil {
		return alog.Error(err)
	} else if err = f.zzk.UpdateResourcePool(entity); err != nil {
		return alog.Error(err)
	}

	// update address assignments
	for _, svc := range services {
		request := addressassignment.AssignmentRequest{
			ServiceID:      svc.ID,
			IPAddress:      "",
			AutoAssignment: true,
		}
		if err = f.AssignIPs(ctx, request); err != nil {
			glog.Warningf("Failed assigning another ip to service %s: %s", svc.ID, err)
			alog.Error(err)
		}
	}
	alog.Succeeded()
	return nil
}
90204
func (b *BigIP) DeleteCertificate(name string) error {
	return b.delete(uriSys, uriFile, uriSslCert, name)
}
1360404
func ImplicitMetaAnyPolicy(policyName string) *StandardConfigPolicy {
	return &StandardConfigPolicy{
		key:   policyName,
		value: makeImplicitMetaPolicy(policyName, cb.ImplicitMetaPolicy_ANY),
	}
}
427382
func (gen *RuleGen) removeFromDNSName(dnsName, uuid string) (shouldStopManaging bool) {
	// remove the rule from the set of rules that rely on dnsName.
	// Note: this isn't removing dnsName from gen.sourceRules, that is just
	// below.
	return gen.sourceRules.Remove(dnsName, uuid)
}
978935
func (ps *PolicyStore) loadACLPolicy(ctx context.Context, policyName, policyText string) error {
	return ps.loadACLPolicyNamespaces(ctx, policyName, policyText)
}
1369985
func (d *Daemon) RemoveNetworkPolicy(e *endpoint.Endpoint) {
	if d.l7Proxy == nil {
		return
	}
	d.l7Proxy.RemoveNetworkPolicy(e)
}
6522
func (c *fabricCAAdapter) RemoveIdentity(key core.Key, cert []byte, request *api.RemoveIdentityRequest) (*api.IdentityResponse, error) {

	logger.Debugf("Removing identity [%s]", request.ID)

	// Create remove request
	req := caapi.RemoveIdentityRequest{
		CAName: request.CAName,
		Force:  request.Force,
		ID:     request.ID,
	}

	registrar, err := c.newIdentity(key, cert)
	if err != nil {
		return nil, errors.Wrap(err, "failed to create CA signing identity")
	}

	response, err := registrar.RemoveIdentity(&req)
	if err != nil {
		return nil, errors.Wrap(err, "failed to remove identity")
	}

	return getIdentityResponse(response), nil
}
22066
func (e *Enforcer) GetNamedPolicy(ptype string) [][]string {
	return e.model.GetPolicy("p", ptype)
}