// HasManager returns true/false if a manager was already attached
351850
func (em *EventManager) HasManager(esm EventManagers) bool {
	//have we already attached before
	em.wo.RLock()
	ok := em.attaches[esm]
	em.wo.RUnlock()
	return ok
}
199334
func (_m *ChannelPolicyManagerGetter) Manager(channelID string) (policies.Manager, bool) {
	ret := _m.Called(channelID)

	var r0 policies.Manager
	if rf, ok := ret.Get(0).(func(string) policies.Manager); ok {
		r0 = rf(channelID)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).(policies.Manager)
		}
	}

	var r1 bool
	if rf, ok := ret.Get(1).(func(string) bool); ok {
		r1 = rf(channelID)
	} else {
		r1 = ret.Get(1).(bool)
	}

	return r0, r1
}
923709
func (a *Auth) HasRole(id string, roles ...string) bool {
	user, err := a.robot.Users.Get(id)
	if err != nil {
		return false
	}

	if len(user.Roles) == 0 {
		return false
	}

	for _, r := range roles {
		for _, b := range user.Roles {
			if b == r {
				return true
			}
		}
	}

	return false
}
232984
func AccessTokenWithManager(s string, manager tokens.Manager) Strategy {
	return &accessToken{
		accessToken: s,
		manager:     manager,
	}
}
338408
func (claims *Claims) HasScope(scope string) bool {
	return claims != nil && contains(claims.Scope, scope)
}
1264832
func (s Service) HasPlist() bool {
	plistDest := s.plistDestination()
	if _, err := os.Stat(plistDest); os.IsNotExist(err) {
		s.log.Info("HasPlist: %s does not exist", plistDest)
		return false
	} else if err != nil {
		s.log.Info("HasPlist: %s stat error: %s", plistDest, err)
		return false
	}

	return true
}
313508
func HasModelAdmin(
	authorizer facade.Authorizer,
	user names.UserTag,
	controllerTag names.ControllerTag,
	model Model,
) (bool, error) {
	// superusers have admin for all models.
	if isSuperUser, err := authorizer.HasPermission(permission.SuperuserAccess, controllerTag); err != nil || isSuperUser {
		return isSuperUser, err
	}
	return authorizer.HasPermission(permission.AdminAccess, model.ModelTag())
}
1180245
func (cp *OrdererProvider) HasCapability(capability string) bool {
	switch capability {
	// Add new capability names here
	case OrdererV1_1:
		return true
	case OrdererV2_0:
		return true
	default:
		return false
	}
}
805357
func (m *Manager) Manager(path []string) (policies.Manager, bool) {
	if len(path) == 0 {
		return m, true
	}
	manager, ok := m.SubManagersMap[path[len(path)-1]]
	return manager, ok
}
513157
func (r *apiHandler) AuthController() bool {
	type hasIsManager interface {
		IsManager() bool
	}
	m, ok := r.entity.(hasIsManager)
	return ok && m.IsManager()
}
624354
func (p *MSPProvider) IdentityManager(orgName string) (msp.IdentityManager, bool) {
	im, ok := p.identityManager[strings.ToLower(orgName)]
	if !ok {
		return nil, false
	}
	return im, true
}
1212471
func HasExtension(pb Message, extension *ExtensionDesc) bool {
	// TODO: Check types, field numbers, etc.?
	epb, err := extendable(pb)
	if err != nil {
		return false
	}
	extmap, mu := epb.extensionsRead()
	if extmap == nil {
		return false
	}
	mu.Lock()
	_, ok := extmap[extension.Field]
	mu.Unlock()
	return ok
}
919035
func hasOrganizationAdmin(roles *roles, organizatioName string) bool {
	for _, role := range roles.Role {
		if role.Name == "orgadmin" && role.Organization == organizatioName {
			return true
		}
	}

	return false
}
928269
func IsSystemAdminUser() (isAdminUser bool, match string, err error) {
	u, err := user.Current()
	if err != nil {
		return
	}

	if u.Uid == "0" {
		match = "Uid: 0"
		isAdminUser = true
		return
	}
	return
}
709143
func (i *instanceManager) HasDevices(d *structs.AllocatedDeviceResource) bool {
	i.deviceLock.RLock()
	defer i.deviceLock.RUnlock()

OUTER:
	for _, dev := range i.devices {
		if dev.Name != d.Name || dev.Type != d.Type || dev.Vendor != d.Vendor {
			continue
		}

		// Check that we have all the requested devices
		ids := make(map[string]struct{}, len(dev.Devices))
		for _, inst := range dev.Devices {
			ids[inst.ID] = struct{}{}
		}

		for _, reqID := range d.DeviceIDs {
			if _, ok := ids[reqID]; !ok {
				continue OUTER
			}
		}

		return true
	}

	return false
}
452910
func (g *InstanceGroup) IsMaster() bool {
	switch g.Spec.Role {
	case InstanceGroupRoleMaster:
		return true
	case InstanceGroupRoleNode:
		return false
	case InstanceGroupRoleBastion:
		return false
	default:
		glog.Fatalf("Role not set in group %v", g)
		return false
	}
}
988506
func NewEventManager() EventManagers {
	em := EventManager{
		events:   make(map[string]EventSubs),
		attaches: make(map[EventManagers]bool),
	}

	return &em
}