// MethodNotAllowed sets MethodNotAllowed handler
498867
func (app *App) MethodNotAllowed(c func(ctx *Context)) *App {
	app.defaultRouter.router.MethodNotAllowed = c
	return app
}
1005535
func (p *DNSProxy) UpdateAllowed(reStrToAdd, reStrToRemove []string, endpointID string) {
	for i := range reStrToAdd {
		reStrToAdd[i] = prepareNameMatch(reStrToAdd[i])
	}
	for i := range reStrToRemove {
		reStrToRemove[i] = prepareNameMatch(reStrToRemove[i])
	}

	p.Lock()
	defer p.Unlock()
	for _, reStr := range reStrToRemove {
		p.allowed.Remove(reStr, endpointID)
	}
	for _, reStr := range reStrToAdd {
		p.allowed.Add(reStr, endpointID)
	}
}
1284602
func notFoundHandler(w http.ResponseWriter, r *http.Request) {
	writeErrorResponse(context.Background(), w, errorCodes.ToAPIErr(ErrMethodNotAllowed), r.URL, guessIsBrowserReq(r))
}
1080454
func NewMethodHandler(handler interface{}, defaultCode int) *MethodHandler {
	return &MethodHandler{
		DefaultCode: defaultCode,
		Handler:     handler,
	}
}
1308890
func validateRequestMethod(requestMethod string, config Config) bool {
	if !config.ValidateHeaders {
		return true
	}

	if requestMethod != "" {
		for _, value := range config.methods {
			if value == requestMethod {
				return true
			}
		}
	}

	return false
}
1266671
func notFoundHandlerJSON(w http.ResponseWriter, r *http.Request) {
	writeErrorResponseJSON(context.Background(), w, errorCodes.ToAPIErr(ErrMethodNotAllowed), r.URL)
}
637035
func (c *Cors) areHeadersAllowed(requestedHeaders []string) bool {
	if c.allowedHeadersAll || len(requestedHeaders) == 0 {
		return true
	}
	for _, header := range requestedHeaders {
		header = http.CanonicalHeaderKey(header)
		found := false
		for _, h := range c.allowedHeaders {
			if h == header {
				found = true
			}
		}
		if !found {
			return false
		}
	}
	return true
}
882109
func ChannelAllowed(user, org, app_name, ident, channelName string) bool {

	var available = []string{"email", "web", "push"}
	var preference map[string]availableTopics.ChotaTopic

	appTopics, err := availableTopics.GetAppTopics(app_name, org)
	channels := []string{}
	for _, idnt := range available {
		channels = append(channels, idnt)
	}
	preference, err = availableTopics.GetUserPreferences(user, org, appTopics, &channels)

	if err != nil {
		log.Println(err)
		return false
	}

	if _, ok := preference[ident]; !ok {
		return false
	}

	if _, ok := preference[ident][channelName]; !ok {
		return false
	}

	return preference[ident][channelName].Value
}
1088272
func (s *RelationalDatabaseParameter) SetAllowedValues(v string) *RelationalDatabaseParameter {
	s.AllowedValues = &v
	return s
}
1360153
func NotAllowed(w http.ResponseWriter, r *http.Request) {
	handlerMu.RLock()
	f, ok := handlerMap[http.StatusMethodNotAllowed]
	handlerMu.RUnlock()
	if ok {
		f.ServeHTTP(w, r)
	} else {
		defaultNotAllowed(w, r)
	}
}
1178275
func (s *AvailableProcessorFeature) SetAllowedValues(v string) *AvailableProcessorFeature {
	s.AllowedValues = &v
	return s
}
564736
func methodNotAllowedHandler(w http.ResponseWriter, r *http.Request) {
	ctx := r.Context()
	allow := w.Header().Get("Allow")
	pe := &platform.Error{
		Code: platform.EMethodNotAllowed,
		Msg:  fmt.Sprintf("allow: %s", allow),
	}

	EncodeError(ctx, pe, w)
}
584202
func (s *OptionGroupOptionSetting) SetAllowedValues(v string) *OptionGroupOptionSetting {
	s.AllowedValues = &v
	return s
}
1295877
func (s *ParameterDefinition) SetAllowedPattern(v string) *ParameterDefinition {
	s.AllowedPattern = &v
	return s
}
620466
func isPutAllowed(atype authType, bucketName, objectName string, r *http.Request) (s3Err APIErrorCode) {
	var cred auth.Credentials
	var owner bool
	switch atype {
	case authTypeUnknown:
		return ErrAccessDenied
	case authTypeSignedV2, authTypePresignedV2:
		cred, owner, s3Err = getReqAccessKeyV2(r)
	case authTypeStreamingSigned, authTypePresigned, authTypeSigned:
		region := globalServerConfig.GetRegion()
		cred, owner, s3Err = getReqAccessKeyV4(r, region, serviceS3)
	}
	if s3Err != ErrNone {
		return s3Err
	}

	claims, s3Err := checkClaimsFromToken(r, cred)
	if s3Err != ErrNone {
		return s3Err
	}

	if cred.AccessKey == "" {
		if globalPolicySys.IsAllowed(policy.Args{
			AccountName:     cred.AccessKey,
			Action:          policy.PutObjectAction,
			BucketName:      bucketName,
			ConditionValues: getConditionValues(r, "", ""),
			IsOwner:         false,
			ObjectName:      objectName,
		}) {
			return ErrNone
		}
		return ErrAccessDenied
	}

	if globalIAMSys.IsAllowed(iampolicy.Args{
		AccountName:     cred.AccessKey,
		Action:          policy.PutObjectAction,
		BucketName:      bucketName,
		ConditionValues: getConditionValues(r, "", cred.AccessKey),
		ObjectName:      objectName,
		IsOwner:         owner,
		Claims:          claims,
	}) {
		return ErrNone
	}
	return ErrAccessDenied
}
837946
func (r *Router) MethodNotAllowed(c func(ctx *Context)) {
	r.router.MethodNotAllowed = c
}
1214996
func (s *CORSRule) SetAllowedMethods(v []*string) *CORSRule {
	s.AllowedMethods = v
	return s
}