소스 검색

Merge branch 'belanger/api-tokens-refactor-2' into nafees/api-v1

Mohammed Nafees 4 년 전
부모
커밋
e83ce6fa5c
1개의 변경된 파일1개의 추가작업 그리고 6개의 파일을 삭제
  1. 1 6
      api/server/authz/policy.go

+ 1 - 6
api/server/authz/policy.go

@@ -47,13 +47,8 @@ func (h *PolicyHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
 	// first check if an api token exists in context
 	if r.Context().Value("api_token") != nil {
 		projID := reqScopes[types.ProjectScope].Resource.UInt
-		proj, _ := r.Context().Value(types.ProjectScope).(*models.Project)
 
-		if !proj.APITokensEnabled {
-			apierrors.HandleAPIError(h.config.Logger, h.config.Alerter, w, r,
-				apierrors.NewErrForbidden(fmt.Errorf("api tokens are not enabled for this project")), true)
-			return
-		}
+		// FIXME: find a clean way to get the project
 
 		apiToken, _ := r.Context().Value("api_token").(*models.APIToken)
 		policyLoaderOpts.ProjectToken = apiToken