//IsParticipant check if name is participant in contract with id contractID
770898
func (m *Manager) IsParticipant(contractID string, name string) (isparticipant bool, err error) {
	count, err := m.collection.Find(bson.M{"contractid": contractID, "parties.name": name}).Count()
	if err != nil {
		return
	}
	isparticipant = count != 0
	return

}
663025
func CheckCertificate(d Depot, name string) bool {
	return d.Check(CrtTag(name))
}
167822
func (p *Plugin) NewPartitionWatcher(name string) messaging.ProtoPartitionWatcher {
	return p.NewProtoManualConnection(name)
}
884291
func isValid(cur_person Person, other_person Person, check_pairing bool) bool {
	if other_person.Id == cur_person.Id {
		dbg.Printf("  same person %v\n", other_person)
		return false
	}

	if pairedTooRecently(cur_person, other_person) {
		dbg.Printf("  too recent %v\n", other_person)
		return false
	}

	return true
}
1146056
func (v *Verifier) isSpent(spentKey string, simulator ledger.LedgerReader) (bool, error) {
	verifierLogger.Debugf("checking if input with ID '%s' has been spent", spentKey)
	result, err := simulator.GetState(tokenNameSpace, spentKey)
	return result != nil, err
}
318551
func (id PKIidType) IsNotSameFilter(that PKIidType) bool {
	return !bytes.Equal(id, that)
}
1009813
func (c *Client) GetInitiator(id string, name string) (Initiator, error) {
	i, err := c.api.GetInitiator(id, name)
	if err != nil {
		return nil, err
	}

	return i.Content, nil
}
203514
func (issue *Issue) MailParticipants() (err error) {
	mentions := markup.FindAllMentions(issue.Content)
	if err = updateIssueMentions(x, issue.ID, mentions); err != nil {
		return fmt.Errorf("UpdateIssueMentions [%d]: %v", issue.ID, err)
	}

	if err = mailIssueCommentToParticipants(issue, issue.Poster, mentions); err != nil {
		log.Error(2, "mailIssueCommentToParticipants: %v", err)
	}

	return nil
}
924157
func (u *User) IsPublicMember(orgId int64) bool {
	return IsPublicMembership(orgId, u.ID)
}
1227623
func (ch Challenge) CheckConsistencyForClientOffer() error {
	if err := ch.checkConsistency(); err != nil {
		return err
	}

	// Before completion, the key authorization field should be empty
	if ch.ProvidedKeyAuthorization != "" {
		return fmt.Errorf("A response to this challenge was already submitted.")
	}
	return nil
}
353411
func (o *Ownership) IsPermitted(
	user *auth.UserInfo,
	accessType Ownership_AccessType,
) bool {
	// There is no owner, so it is a public resource
	if o.IsPublic() {
		return true
	}

	// If we are missing user information then do not allow.
	// It is ok for the the user claims to have an empty Groups setting
	if user == nil ||
		len(user.Username) == 0 {
		return false
	}

	if o.IsOwner(user) ||
		o.IsUserAllowedByGroup(user, accessType) ||
		o.IsUserAllowedByCollaborators(user, accessType) {
		return true
	}

	return false
}
250723
func (ch Challenge) CheckConsistencyForValidation() error {
	if err := ch.checkConsistency(); err != nil {
		return err
	}

	// If the challenge is completed, then there should be a key authorization
	return looksLikeKeyAuthorization(ch.ProvidedKeyAuthorization)
}
1285235
func (o *Ownership) IsMatch(check *Ownership) bool {
	if check == nil {
		return false
	}

	// Check user
	if o.Owner == check.GetOwner() {
		return true
	}
	if check.GetAcls() == nil || o.GetAcls() == nil {
		return false
	}

	// Check groups
	for group, _ := range check.GetAcls().GetGroups() {
		if _, ok := o.GetAcls().GetGroups()[group]; ok {
			return true
		}
	}

	// Check collaborators
	for collaborator, _ := range check.GetAcls().GetCollaborators() {
		if _, ok := o.GetAcls().GetCollaborators()[collaborator]; ok {
			return true
		}
	}

	return false
}
1223709
func (ctx *macaroonAuthContext) CheckThirdPartyCaveat(cavInfo *bakery.ThirdPartyCaveatInfo) ([]checkers.Caveat, error) {
	tag, err := ctx.CheckLocalLoginCaveat(cavInfo.Condition)
	if err != nil {
		return nil, errors.Trace(err)
	}
	firstPartyCaveats, err := ctx.CheckLocalLoginRequest(ctx.req, tag)
	if err != nil {
		if _, ok := errors.Cause(err).(*bakery.VerificationError); ok {
			waitId, err := ctx.localUserInteractions.Start(
				cavInfo.CaveatId,
				ctx.clock.Now().Add(authentication.LocalLoginInteractionTimeout),
			)
			if err != nil {
				return nil, errors.Trace(err)
			}
			visitURL := localUserIdentityLocationPath + "/login?waitid=" + waitId
			waitURL := localUserIdentityLocationPath + "/wait?waitid=" + waitId
			return nil, httpbakery.NewInteractionRequiredError(visitURL, waitURL, nil, ctx.req)
		}
		return nil, errors.Trace(err)
	}
	return firstPartyCaveats, nil
}
465126
func (r *CollaboratorsService) IsCollaborator(uri *Hyperlink,
	params M) (collabStatus bool, result *Result) {
	if uri == nil {
		uri = &CollaboratorsURL
	}
	url, err := uri.Expand(params)
	if err != nil {
		return false, &Result{Err: err}
	}
	result = r.client.get(url, nil)
	collabStatus = false
	if result.Err == nil && result.Response.Response.StatusCode == 204 {
		collabStatus = true
	}
	return
}
1016746
func (lobby *Lobby) IsSlotOccupied(slot int) bool {
	var count int
	db.DB.Model(&LobbySlot{}).Where("lobby_id = ? AND slot = ?", lobby.ID, slot).Count(&count)
	return count != 0
}
1059490
func (session *ProxySession) AddParticipant(req ParticipantRequest) (response Participant, exception *Exception, err error) {

	twilioUrl := fmt.Sprintf("%s/%s/%s/%s/%s/%s", ProxyBaseUrl, "Services", session.ServiceSid, "Sessions", session.Sid, "Participants")

	res, err := session.twilio.post(participantFormValues(req), twilioUrl)
	if err != nil {
		return response, exception, err
	}
	defer res.Body.Close()

	responseBody, err := ioutil.ReadAll(res.Body)
	if err != nil {
		return response, exception, err
	}

	if res.StatusCode != http.StatusCreated {
		exception = new(Exception)
		err = json.Unmarshal(responseBody, exception)

		// We aren't checking the error because we don't actually care.
		// It's going to be passed to the client either way.
		return response, exception, err
	}

	err = json.Unmarshal(responseBody, &response)
	return response, exception, err

}