// Accepts returns true if no Accepter is registered for the group resource in attributes,
// or if the registered Accepter also returns true.
190797
func (a mappedAccepter) Accepts(attr *ImagePolicyAttributes) bool {
	accepter, ok := a[attr.Resource]
	if !ok {
		return true
	}
	return accepter.Accepts(attr)
}
244555
func (n *negotiator) Accepts(ctype string) float64 {
	return accepts(n.r.Header.Get("Accept"), ctype)
}
976151
func (s *acceptFirst) Accept(from interface{}) bool {
	if _, ok := s.handled[from]; ok {
		return false
	}
	s.handled[from] = struct{}{}
	return true
}
1091047
func (s *invitationServiceImpl) Accept(ctx context.Context, token uuid.UUID) (string, string, error) {

	// Locate the invitation
	inv, err := s.Repositories().InvitationRepository().FindByAcceptCode(ctx, token)

	if err != nil {
		return "", "", errs.Wrapf(err, "something went wrong while finding invitation with accept code")
	}

	// get redirect urls
	redirectOnSuccess := inv.SuccessRedirectURL
	redirectOnFailure := inv.FailureRedirectURL

	// get identity for invitation
	currentIdentityID := inv.IdentityID
	identity, err := s.Repositories().Identities().LoadWithUser(ctx, currentIdentityID)
	if err != nil {
		return "", redirectOnFailure, errs.Wrapf(err, "failed to load identity for invitee %d", currentIdentityID)
	}

	if identity.User.Banned {
		return "", redirectOnFailure, autherrors.NewUnauthorizedError("user banned")
	}

	var resourceID string

	err = s.ExecuteInTransaction(func() error {

		// If this invitation is for an identity
		if inv.InviteTo != nil {
			inviteToIdentity, err := s.Repositories().Identities().Load(ctx, *inv.InviteTo)
			if err != nil {
				return err
			}

			// If the invitation is for a membership, add a membership record
			if inv.Member {
				err = s.Repositories().Identities().AddMember(ctx, inviteToIdentity.ID, currentIdentityID)
				if err != nil {
					return err
				}
			}

			roles, err := s.Repositories().InvitationRepository().ListRoles(ctx, inv.InvitationID)
			if err != nil {
				return err
			}

			// If the invitation includes role assignments, assign them
			inviteToIdentityResourceID := inviteToIdentity.IdentityResourceID.String
			for _, role := range roles {
				ir := &repository.IdentityRole{
					IdentityID: currentIdentityID,
					RoleID:     role.RoleID,
					ResourceID: inviteToIdentityResourceID,
				}

				err = s.Repositories().IdentityRoleRepository().Create(ctx, ir)
				if err != nil {
					return err
				}
			}

			// Delete the invitation
			err = s.Repositories().InvitationRepository().Delete(ctx, inv.InvitationID)
			if err != nil {
				return errs.Wrap(err, "failed to create identity role")
			}

			// Return the identity ID
			resourceID = inviteToIdentity.IdentityResourceID.String

		} else if inv.ResourceID != nil {
			inviteToResource, err := s.Repositories().ResourceRepository().Load(ctx, *inv.ResourceID)
			if err != nil {
				return errs.Wrapf(err, "failed to load resource %s", resourceID)
			}

			roles, err := s.Repositories().InvitationRepository().ListRoles(ctx, inv.InvitationID)
			if err != nil {
				return errs.Wrapf(err, "failed to load roles for invitation %d", inv.InvitationID)
			}

			for _, role := range roles {
				ir := &repository.IdentityRole{
					IdentityID: currentIdentityID,
					RoleID:     role.RoleID,
					ResourceID: inviteToResource.ResourceID,
				}

				err = s.Repositories().IdentityRoleRepository().Create(ctx, ir)
				if err != nil {
					return err
				}
			}

			// Delete the invitation
			err = s.Repositories().InvitationRepository().Delete(ctx, inv.InvitationID)
			if err != nil {
				return errs.Wrapf(err, "failed to delete invitation %d", inv.InvitationID)
			}

			// Set the resource ID
			resourceID = inviteToResource.ResourceID
		}

		return nil
	})

	if err != nil {
		return "", redirectOnFailure, err
	}

	// Return the resource ID and redirect path
	return resourceID, redirectOnSuccess, nil
}
534194
func (n *Join) Accept(v Visitor) (Node, bool) {
	newNode, skipChildren := v.Enter(n)
	if skipChildren {
		return v.Leave(newNode)
	}
	n = newNode.(*Join)
	node, ok := n.Left.Accept(v)
	if !ok {
		return n, false
	}
	n.Left = node.(ResultSetNode)
	if n.Right != nil {
		node, ok = n.Right.Accept(v)
		if !ok {
			return n, false
		}
		n.Right = node.(ResultSetNode)
	}
	if n.On != nil {
		node, ok = n.On.Accept(v)
		if !ok {
			return n, false
		}
		n.On = node.(*OnCondition)
	}
	return v.Leave(n)
}
1045143
func (n *SelectStmt) Accept(v Visitor) (Node, bool) {
	newNode, skipChildren := v.Enter(n)
	if skipChildren {
		return v.Leave(newNode)
	}

	n = newNode.(*SelectStmt)
	if n.From != nil {
		node, ok := n.From.Accept(v)
		if !ok {
			return n, false
		}
		n.From = node.(*TableRefsClause)
	}

	if n.Where != nil {
		node, ok := n.Where.Accept(v)
		if !ok {
			return n, false
		}
		n.Where = node.(ExprNode)
	}

	if n.Fields != nil {
		node, ok := n.Fields.Accept(v)
		if !ok {
			return n, false
		}
		n.Fields = node.(*FieldList)
	}

	if n.GroupBy != nil {
		node, ok := n.GroupBy.Accept(v)
		if !ok {
			return n, false
		}
		n.GroupBy = node.(*GroupByClause)
	}

	if n.Having != nil {
		node, ok := n.Having.Accept(v)
		if !ok {
			return n, false
		}
		n.Having = node.(*HavingClause)
	}

	if n.OrderBy != nil {
		node, ok := n.OrderBy.Accept(v)
		if !ok {
			return n, false
		}
		n.OrderBy = node.(*OrderByClause)
	}

	if n.Limit != nil {
		node, ok := n.Limit.Accept(v)
		if !ok {
			return n, false
		}
		n.Limit = node.(*Limit)
	}

	return v.Leave(n)
}
1296645
func (a *acceptNonExistentImageStreamTag) Accept(from interface{}) bool {
	obj, _, err := objectMetaData(from)
	if err != nil {
		return false
	}
	gvk, _, err := a.typer.ObjectKinds(obj)
	if err != nil {
		return false
	}
	gk := gvk[0].GroupKind()
	if !(image.Kind("ImageStreamTag") == gk || legacy.Kind("ImageStreamTag") == gk) {
		return true
	}
	ist, ok := from.(*imagev1.ImageStreamTag)
	if !ok {
		klog.V(4).Infof("type cast to imagestreamtag %#v not right for an unanticipated reason", from)
		return true
	}
	namespace := a.namespace
	if len(ist.Namespace) > 0 {
		namespace = ist.Namespace
	}
	tag, err := a.getter.ImageStreamTags(namespace).Get(ist.Name, metav1.GetOptions{})
	if err == nil && tag != nil {
		klog.V(4).Infof("acceptor determined that imagestreamtag %s in namespace %s exists so don't accept: %#v", ist.Name, namespace, tag)
		return false
	}
	return true
}
1282913
func (n *Assignment) Accept(v Visitor) (Node, bool) {
	newNode, skipChildren := v.Enter(n)
	if skipChildren {
		return v.Leave(newNode)
	}
	n = newNode.(*Assignment)
	node, ok := n.Column.Accept(v)
	if !ok {
		return n, false
	}
	n.Column = node.(*ColumnName)
	node, ok = n.Expr.Accept(v)
	if !ok {
		return n, false
	}
	n.Expr = node.(ExprNode)
	return v.Leave(n)
}
772051
func Accept(ctypes ...string) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		a := r.Header.Get("Accept")
		for _, t := range ctypes {
			if accepts(a, t) > 0 {
				return
			}
		}
		w.WriteHeader(http.StatusNotAcceptable)
	}
}
268106
func (l *RaftLayer) Accept() (net.Conn, error) {
	select {
	case conn := <-l.connCh:
		return conn, nil
	case <-l.closeCh:
		return nil, fmt.Errorf("Raft RPC layer closed")
	}
}
1365771
func (p *File_Template_Parameter) Accepts(v *Value) error {
	if v.IsNull() {
		if !p.Nullable {
			return errors.New("not nullable")
		}
	} else if err := p.Schema.Accepts(v); err != nil {
		return err
	} else if err := v.Check(p.Schema); err != nil {
		return err
	}
	return nil
}
942072
func (n *CreateTableStmt) Accept(v Visitor) (Node, bool) {
	newNode, skipChildren := v.Enter(n)
	if skipChildren {
		return v.Leave(newNode)
	}
	n = newNode.(*CreateTableStmt)
	node, ok := n.Table.Accept(v)
	if !ok {
		return n, false
	}
	n.Table = node.(*TableName)
	for i, val := range n.Cols {
		node, ok = val.Accept(v)
		if !ok {
			return n, false
		}
		n.Cols[i] = node.(*ColumnDef)
	}
	for i, val := range n.Constraints {
		node, ok = val.Accept(v)
		if !ok {
			return n, false
		}
		n.Constraints[i] = node.(*Constraint)
	}
	return v.Leave(n)
}
107059
func (listener *httpListener) Accept() (conn net.Conn, err error) {
	result, ok := <-listener.acceptCh
	if ok {
		return result.conn, result.err
	}

	return nil, syscall.EINVAL
}
920191
func (t *Transport) Accept() (net.Conn, error) {
	c, err := t.ln.Accept()
	if err != nil {
		fmt.Println("error accepting: ", err.Error())
	}
	return c, err
}
343039
func Accept(ct string) RequestOption {
	return func(req *http.Request) (*http.Request, error) {
		req.Header.Set("Accept", ct)
		return req, nil
	}
}
153944
func (server *Server) Accept(lis net.Listener) {
	for {
		conn, err := lis.Accept()
		if err != nil {
			log.Fatal("rpc.Serve: accept:", err.Error()) // TODO(r): exit?
		}
		go server.ServeConn(conn)
	}
}
1136065
func (f *EndpointFilter) Accept(peer fab.Peer) bool {

	peerConfig, err := comm.SearchPeerConfigFromURL(f.ctx.EndpointConfig(), peer.URL())
	if err != nil {
		return true
	}

	chPeer := f.getChannelPeer(peerConfig)
	if chPeer == nil {
		return true
	}

	switch t := f.endpointType; t {
	case ChaincodeQuery:
		return chPeer.ChaincodeQuery
	case EndorsingPeer:
		return chPeer.EndorsingPeer
	case LedgerQuery:
		return chPeer.LedgerQuery
	case EventSource:
		return chPeer.EventSource
	}

	return true
}