// FindByPublicId find profile in Database by public_id
198630
func (crud *repo) FindByPublicId(publicId string) (profile service.Entity, err error) {
	if err = dbconn.DB.Where("public_id = ?", publicId).First(&profile).Error; err != nil {
		return service.Entity{}, err
	}
	return profile, nil
}
534661
func (g *GPGKey) GetPublicKey() string {
	if g == nil || g.PublicKey == nil {
		return ""
	}
	return *g.PublicKey
}
1112279
func (s *BucketService) FindBucketByID(ctx context.Context, id influxdb.ID) (*influxdb.Bucket, error) {
	span, ctx := tracing.StartSpanFromContext(ctx)
	defer span.Finish()

	b, err := s.s.FindBucketByID(ctx, id)
	if err != nil {
		return nil, err
	}

	if err := authorizeReadBucket(ctx, b.OrgID, id); err != nil {
		return nil, err
	}

	return b, nil
}
702706
func (g *GistStats) GetPublicGists() int {
	if g == nil || g.PublicGists == nil {
		return 0
	}
	return *g.PublicGists
}
1070967
func (s *Service) FindSourceByID(ctx context.Context, id influxdb.ID) (*influxdb.Source, error) {
	var sr *influxdb.Source

	err := s.kv.View(ctx, func(tx Tx) error {
		src, pe := s.findSourceByID(ctx, tx, id)
		if pe != nil {
			return &influxdb.Error{
				Err: pe,
			}
		}
		sr = src
		return nil
	})
	return sr, err
}
1098327
func (s *DbSession) FindByID(id string, result Document) error {
	if !bson.IsObjectIdHex(id) {
		return errors.New("invalid id")
	}
	coll := s.collection(result.CollectionName())
	if err := coll.FindId(bson.ObjectIdHex(id)).One(result); err != nil {
		if err.Error() != mgo.ErrNotFound.Error() {
			log.Printf("Error fetching %s with id %s. Error: %s\n", result.CollectionName(), id, err)
		}
		return err
	}
	return nil
}
774943
func (u *User) GetPublicKeyByLabel(label string) (publicKey PublicKey, err error) {
	for _, publicKey = range u.PublicKeys {
		if publicKey.Label == label {
			return
		}
	}
	err = errors.New("Could not find PublicKey with label " + label)
	return
}
883136
func GetOrgIDsByUserID(userID int64, showPrivate bool) ([]int64, error) {
	orgIDs := make([]int64, 0, 5)
	sess := x.Table("org_user").Where("uid = ?", userID)
	if !showPrivate {
		sess.And("is_public = ?", true)
	}
	return orgIDs, sess.Distinct("org_id").Find(&orgIDs)
}
921370
func (c *Client) FindUserByID(ctx context.Context, id platform.ID) (*platform.User, error) {
	var u *platform.User

	err := c.db.View(func(tx *bolt.Tx) error {
		usr, pe := c.findUserByID(ctx, tx, id)
		if pe != nil {
			return pe
		}
		u = usr
		return nil
	})

	if err != nil {
		return nil, &platform.Error{
			Op:  getOp(platform.OpFindUserByID),
			Err: err,
		}
	}

	return u, nil
}
83752
func (p *Profile) Find(target interface{}) interface{} {
	switch target.(type) {
	case *Service:
	case *Characteristic:
	case *Descriptor:
	default:
		return nil
	}
	for _, s := range p.Services {
		ts, ok := target.(*Service)
		if ok && s.UUID.Equal(ts.UUID) {
			target = s
			return s
		}
		for _, c := range s.Characteristics {
			tc, ok := target.(*Characteristic)
			if ok && c.UUID.Equal(tc.UUID) {
				return c
			}
			for _, d := range c.Descriptors {
				td, ok := target.(*Descriptor)
				if ok && d.UUID.Equal(td.UUID) {
					return d
				}
			}
		}
	}
	return nil
}
941026
func (x *XC) ListPublicKeyIDs(ctx context.Context) ([]string, error) {
	return x.pubring.KeyIDs(), nil
}
454927
func (s *UserService) FindUserByID(ctx context.Context, id platform.ID) (*platform.User, error) {
	return s.FindUserByIDFn(ctx, id)
}
229368
func (ct *ClaimTree) Find(id *identity.ID, mustActive bool) (*apitypes.PublicKeySegment, error) {
	for _, pks := range ct.PublicKeys {
		if *pks.PublicKey.ID == *id {
			if mustActive && pks.Revoked() {
				continue
			}

			return &pks, nil
		}
	}

	return nil, ErrKeyNotFound
}
56857
func (c *cache) getPUIDsbyPod(podNamespace string, podName string) []string {
	c.RLock()
	defer c.RUnlock()

	kubeIdentifier := kubePodIdentifier(podName, podNamespace)
	podEntry, ok := c.podCache[kubeIdentifier]
	if !ok {
		return []string{}
	}

	return keysFromMap(podEntry.puIDs)
}
1038131
func (g *GPG) ListPublicKeyIDs(ctx context.Context) ([]string, error) {
	if g.pubKeys == nil {
		kl, err := g.listKeys(ctx, "public")
		if err != nil {
			return nil, err
		}
		g.pubKeys = kl
	}
	if gpg.IsAlwaysTrust(ctx) {
		return g.pubKeys.Recipients(), nil
	}
	return g.pubKeys.UseableKeys().Recipients(), nil
}
783940
func IsPublicIP(ip net.IP) bool {
	if !ip.IsGlobalUnicast() {
		return false
	}
	return !ipInMasks(ip, privateMasks)
}
604467
func (s *AuthorizationService) FindAuthorizationByID(ctx context.Context, id platform.ID) (a *platform.Authorization, err error) {
	defer func() {
		if err != nil {
			s.Logger.Info("error finding authorization by id", zap.Error(err))
		}
	}()

	return s.AuthorizationService.FindAuthorizationByID(ctx, id)
}