Skip to content

Commit

Permalink
Remove subscription check on fossa report preflight check (#1474)
Browse files Browse the repository at this point in the history
* Remove subscription check on fossa report preflight check
  • Loading branch information
JeffreyHuynh1 authored Sep 30, 2024
1 parent ea1991c commit 9d8190f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 21 deletions.
3 changes: 2 additions & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# FOSSA CLI Changelog

## Unreleased
## 3.9.36

- fossa-deps: Fixed an issue where Rocky Linux deps were not supported in the fossa-deps file ([#1473](https://github.com/fossas/fossa-cli/pull/1473))
- `fossa report`: Remove subscription type check in preflight checks ([#1474](https://github.com/fossas/fossa-cli/pull/1474))

## 3.9.35

Expand Down
17 changes: 1 addition & 16 deletions src/App/Fossa/PreflightChecks.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import Data.Text.IO qualified as TIO
import Diag.Diagnostic (ToDiagnostic (..))
import Effect.Logger (renderIt)
import Errata (Errata (..))
import Fossa.API.Types (ApiOpts, CustomBuildUploadPermissions (..), Organization (..), ProjectPermissionStatus (..), ReleaseGroupPermissionStatus (..), Subscription (..), TokenType (..), TokenTypeResponse (..))
import Fossa.API.Types (ApiOpts, CustomBuildUploadPermissions (..), Organization (..), ProjectPermissionStatus (..), ReleaseGroupPermissionStatus (..), TokenType (..), TokenTypeResponse (..))
import Path (
File,
Path,
Expand Down Expand Up @@ -78,7 +78,6 @@ preflightChecks cmd = context "preflight-checks" $ do
ReportChecks -> do
tokenType <- getTokenType
fullAccessTokenCheck tokenType
premiumSubscriptionCheck org
_ -> pure ()
pure org

Expand Down Expand Up @@ -128,14 +127,6 @@ fullAccessTokenCheck TokenTypeResponse{..} = case tokenType of
$ fatal TokenTypeErr
_ -> pure ()

premiumSubscriptionCheck :: Has Diagnostics sig m => Organization -> m ()
premiumSubscriptionCheck Organization{..} = case orgSubscription of
Free ->
errHelp ("To proceed, please upgrade your subscription" :: Text)
. errCtx ("You currently have a free subscription" :: Text)
$ fatal SubscriptionTypeErr
_ -> pure ()

preflightCheckFileName :: Path Rel File
preflightCheckFileName = $(mkRelFile "preflight-check.txt")

Expand All @@ -151,12 +142,6 @@ instance ToDiagnostic TokenTypeErr where
renderDiagnostic TokenTypeErr =
Errata (Just "Invalid API token type") [] $ Just "The action you are trying to perform requires a `Full Access` API token"

data SubscriptionTypeErr = SubscriptionTypeErr
instance ToDiagnostic SubscriptionTypeErr where
renderDiagnostic :: SubscriptionTypeErr -> Errata
renderDiagnostic SubscriptionTypeErr =
Errata (Just "Invalid subscription type") [] $ Just "The action you are trying to perform requires a premium subscription"

projectPermissionErrHeader :: Text
projectPermissionErrHeader = "Invalid project permission"

Expand Down
4 changes: 0 additions & 4 deletions test/App/Fossa/PreflightChecksSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ spec = do
expectOrganizationWithPremiumSubscription
expectPushToken
expectFatal' $ ignoreDebug $ preflightChecks ReportChecks
it' "should fail premium subscription check for report command" $ do
expectOrganizationWithPreflightChecks
expectFullAccessToken
expectFatal' $ ignoreDebug $ preflightChecks ReportChecks
it' "should pass all custom upload permission checks for analyze command" $ do
expectOrganizationWithPreflightChecks
(GetCustomBuildPermissons Fixtures.projectRevision Fixtures.projectMetadata) `returnsOnce` Fixtures.validCustomUploadPermissions
Expand Down

0 comments on commit 9d8190f

Please sign in to comment.