Просмотр исходного кода

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

Mohammed Nafees 4 лет назад
Родитель
Сommit
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