// IsBlocked reports whether specified user is blocked by the authenticated user.
//
// GitHub API docs: https://developer.github.com/v3/users/blocking/#check-whether-youve-blocked-a-user
493191
func (s *UsersService) IsBlocked(ctx context.Context, user string) (bool, *Response, error) {
	u := fmt.Sprintf("user/blocks/%v", user)

	req, err := s.client.NewRequest("GET", u, nil)
	if err != nil {
		return false, nil, err
	}

	// TODO: remove custom Accept header when this API fully launches.
	req.Header.Set("Accept", mediaTypeBlockUsersPreview)

	resp, err := s.client.Do(ctx, req, nil)
	isBlocked, err := parseBoolResponse(err)
	return isBlocked, resp, err
}
885085
func (v *CredentialAuthority) CheckUsers(ctx context.Context, users []keybase1.UID) (err error) {
	for _, uid := range users {
		if uid == keybase1.PUBLIC_UID {
			continue
		}
		if err = v.CheckUserKey(ctx, uid, nil, nil, false); err != nil {
			break
		}
	}
	return err
}
892847
func (s *NetworkConnectionAction) SetBlocked(v bool) *NetworkConnectionAction {
	s.Blocked = &v
	return s
}
790984
func (ssec) IsRequested(h http.Header) bool {
	if _, ok := h[SSECAlgorithm]; ok {
		return true
	}
	if _, ok := h[SSECKey]; ok {
		return true
	}
	if _, ok := h[SSECKeyMD5]; ok {
		return true
	}
	return false
}
485198
func (c *BlockChecker) checkBlock(blockType state.BlockType) error {
	aBlock, isEnabled, err := c.getter.GetBlockForType(blockType)
	if err != nil {
		return errors.Trace(err)
	}
	if isEnabled {
		return OperationBlockedError(aBlock.Message())
	}
	return nil
}
344673
func (r *Rules) IsAuthorizedRequestor(c context.Context, id identity.Identity) (bool, error) {
	return r.requestors.IsMember(c, id)
}
987728
func (s3KMS) IsRequested(h http.Header) bool {
	if _, ok := h[SSEKmsID]; ok {
		return true
	}
	if _, ok := h[SSEKmsContext]; ok {
		return true
	}
	if _, ok := h[SSEHeader]; ok {
		return strings.ToUpper(h.Get(SSEHeader)) != SSEAlgorithmAES256 // Return only true if the SSE header is specified and does not contain the SSE-S3 value
	}
	return false
}
1334286
func (user *User) Lock(post ExistingPost, users ...*User) (*[]Lock, error) {
	if post == nil {
		return nil, errors.New("Unable to lurk undefined post!")
	}

	switch post.(type) {
	case *UserPost:
		userPost := post.(*UserPost)
		if len(users) == 0 {
			lock := UserPostLock{User: user.ID(), Hpid: userPost.ID()}
			err := Db().Create(&lock)
			return &[]Lock{&lock}, err
		}
		var locks []Lock
		for _, other := range users {
			lock := UserPostUserLock{From: user.ID(), To: other.ID(), Hpid: userPost.ID()}
			if err := Db().Create(&lock); err != nil {
				return nil, err
			}
			locks = append(locks, Lock(&lock))
		}
		return &locks, nil

	case *ProjectPost:
		projectPost := post.(*ProjectPost)
		if len(users) == 0 {
			projectPost := post.(*ProjectPost)
			lock := ProjectPostLock{User: user.ID(), Hpid: projectPost.ID()}
			err := Db().Create(&lock)
			return &[]Lock{&lock}, err
		}
		var locks []Lock
		for _, other := range users {
			lock := ProjectPostUserLock{From: user.ID(), To: other.ID(), Hpid: projectPost.ID()}
			if err := Db().Create(&lock); err != nil {
				return nil, err
			}
			locks = append(locks, Lock(&lock))
		}
		return &locks, nil
	}

	return nil, errors.New("Invalid post type " + reflect.TypeOf(post).String())
}
134117
func (p *Peer) LastAnnouncedBlock() *chainhash.Hash {
	p.statsMtx.RLock()
	lastAnnouncedBlock := p.lastAnnouncedBlock
	p.statsMtx.RUnlock()

	return lastAnnouncedBlock
}
271605
func (t *Thread) Blocked() bool {
	regs, err := t.Registers(false)
	if err != nil {
		return false
	}
	pc := regs.PC()
	f, ln, fn := t.BinInfo().PCToLine(pc)
	if fn == nil {
		if f == "" && ln == 0 {
			return true
		}
		return false
	}
	switch fn.Name {
	case "runtime.futex", "runtime.usleep", "runtime.clone":
		return true
	case "runtime.kevent":
		return true
	case "runtime.mach_semaphore_wait", "runtime.mach_semaphore_timedwait":
		return true
	default:
		return strings.HasPrefix(fn.Name, "syscall.Syscall") || strings.HasPrefix(fn.Name, "syscall.RawSyscall")
	}
}
1273625
func IsAllowed(ctx context.Context, p influxdb.Permission) error {
	a, err := influxdbcontext.GetAuthorizer(ctx)
	if err != nil {
		return err
	}

	if !a.Allowed(p) {
		return &influxdb.Error{
			Code: influxdb.EUnauthorized,
			Msg:  fmt.Sprintf("%s is unauthorized", p),
		}
	}

	return nil
}
611496
func (this *Request) IsValid(rw http.ResponseWriter, req *http.Request) bool {
	if !this.checkSignature(req) {
		rw.WriteHeader(http.StatusUnauthorized)
		rw.Write([]byte(http.StatusText(http.StatusUnauthorized)))
		return false
	}
	if req.Method != "POST" {
		rw.WriteHeader(http.StatusOK)
		rw.Write([]byte(req.FormValue("echostr")))
		return false
	}
	if err := this.parseRequest(req); err != nil {
		rw.WriteHeader(http.StatusBadRequest)
		rw.Write([]byte(err.Error()))
		return false
	}
	return true
}
1147060
func (fw *firewall) isBlocked(remoteAddr string) bool {
	fw.blockListMutex.Lock()

	// Check if the remote address exists in the blocked map
	_, exists := fw.blockList[remoteAddr]

	fw.blockListMutex.Unlock()
	return exists
}
537244
func (bc *BlockChain) HasBlock(hash common.Hash, number uint64) bool {
	if bc.blockCache.Contains(hash) {
		return true
	}
	return rawdb.HasBody(bc.db, hash, number)
}
838886
func (tx *transaction) hasBlock(hash *chainhash.Hash) bool {
	// Return true if the block is pending to be written on commit since
	// it exists from the viewpoint of this transaction.
	if _, exists := tx.pendingBlocks[*hash]; exists {
		return true
	}

	return tx.hasKey(bucketizedKey(blockIdxBucketID, hash[:]))
}
1017633
func (s *UsersService) ListBlockedUsers(ctx context.Context, opt *ListOptions) ([]*User, *Response, error) {
	u := "user/blocks"
	u, err := addOptions(u, opt)
	if err != nil {
		return nil, nil, err
	}

	req, err := s.client.NewRequest("GET", u, nil)
	if err != nil {
		return nil, nil, err
	}

	// TODO: remove custom Accept header when this API fully launches.
	req.Header.Set("Accept", mediaTypeBlockUsersPreview)

	var blockedUsers []*User
	resp, err := s.client.Do(ctx, req, &blockedUsers)
	if err != nil {
		return nil, resp, err
	}

	return blockedUsers, resp, nil
}
462133
func (b *bmBlock) isMarked(i uintptr) bool {
	return (b[i/uintptrBits] & (1 << (i % uintptrBits))) != 0
}