Skip to content

Commit

Permalink
Allow features to be set with HTTP method PATCH (SQPIT-1142) (#2575)
Browse files Browse the repository at this point in the history
This reflects a prior behavior that is used (required) by Ibis. Additionally, it's more consistent when all setters can be called with PUT and PATCH.
  • Loading branch information
supersven authored Aug 12, 2022
1 parent 6d5ddb7 commit 13b0d3e
Show file tree
Hide file tree
Showing 5 changed files with 188 additions and 48 deletions.
4 changes: 4 additions & 0 deletions changelog.d/5-internal/allow-patch-method-for-feature-setting
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Allow features to be set with HTTP method PATCH. This reflects a prior behavior
that is used by Ibis. Additionally, it's more consistent when all setters can be
called with PUT and PATCH. As this will fix calls by Ibis, the deployment order
doesn't matter.
2 changes: 1 addition & 1 deletion libs/wire-api/src/Wire/API/MLS/CipherSuite.hs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ instance ToSchema CipherSuite where
cipherSuiteNumber .= fmap CipherSuite (unnamed schema)

data CipherSuiteTag = MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519
deriving stock (Bounded, Enum, Eq, Show, Generic)
deriving stock (Bounded, Enum, Eq, Show, Generic, Ord)
deriving (Arbitrary) via (GenericUniform CipherSuiteTag)

instance S.ToSchema CipherSuiteTag where
Expand Down
55 changes: 40 additions & 15 deletions services/galley/src/Galley/API/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -108,41 +108,52 @@ import Wire.API.Team.Feature
import Wire.API.Team.Member
import Wire.API.Team.SearchVisibility

type LegalHoldFeatureStatusChangeErrors =
'( 'ActionDenied 'RemoveConversationMember,
'( AuthenticationError,
'( 'CannotEnableLegalHoldServiceLargeTeam,
'( 'LegalHoldNotEnabled,
'( 'LegalHoldDisableUnimplemented,
'( 'LegalHoldServiceNotRegistered,
'( 'UserLegalHoldIllegalOperation,
'( 'LegalHoldCouldNotBlockConnections, '())
)
)
)
)
)
)
)

type IFeatureAPI =
-- SSOConfig
IFeatureStatusGet SSOConfig
:<|> IFeatureStatusPut '() SSOConfig
:<|> IFeatureStatusPatch '() SSOConfig
-- LegalholdConfig
:<|> IFeatureStatusGet LegalholdConfig
:<|> IFeatureStatusPut
'( 'ActionDenied 'RemoveConversationMember,
'( AuthenticationError,
'( 'CannotEnableLegalHoldServiceLargeTeam,
'( 'LegalHoldNotEnabled,
'( 'LegalHoldDisableUnimplemented,
'( 'LegalHoldServiceNotRegistered,
'( 'UserLegalHoldIllegalOperation,
'( 'LegalHoldCouldNotBlockConnections, '())
)
)
)
)
)
)
)
LegalHoldFeatureStatusChangeErrors
LegalholdConfig
:<|> IFeatureStatusPatch
LegalHoldFeatureStatusChangeErrors
LegalholdConfig
-- SearchVisibilityAvailableConfig
:<|> IFeatureStatusGet SearchVisibilityAvailableConfig
:<|> IFeatureStatusPut '() SearchVisibilityAvailableConfig
:<|> IFeatureStatusPatch '() SearchVisibilityAvailableConfig
-- ValidateSAMLEmailsConfig
:<|> IFeatureStatusGet ValidateSAMLEmailsConfig
:<|> IFeatureStatusPut '() ValidateSAMLEmailsConfig
:<|> IFeatureStatusPatch '() ValidateSAMLEmailsConfig
-- DigitalSignaturesConfig
:<|> IFeatureStatusGet DigitalSignaturesConfig
:<|> IFeatureStatusPut '() DigitalSignaturesConfig
:<|> IFeatureStatusPatch '() DigitalSignaturesConfig
-- AppLockConfig
:<|> IFeatureStatusGet AppLockConfig
:<|> IFeatureStatusPut '() AppLockConfig
:<|> IFeatureStatusPatch '() AppLockConfig
-- FileSharingConfig
:<|> IFeatureStatusGet FileSharingConfig
:<|> IFeatureStatusPut '() FileSharingConfig
Expand All @@ -151,6 +162,7 @@ type IFeatureAPI =
-- ConferenceCallingConfig
:<|> IFeatureStatusGet ConferenceCallingConfig
:<|> IFeatureStatusPut '() ConferenceCallingConfig
:<|> IFeatureStatusPatch '() ConferenceCallingConfig
-- SelfDeletingMessagesConfig
:<|> IFeatureStatusGet SelfDeletingMessagesConfig
:<|> IFeatureStatusPut '() SelfDeletingMessagesConfig
Expand All @@ -169,15 +181,18 @@ type IFeatureAPI =
-- SearchVisibilityInboundConfig
:<|> IFeatureStatusGet SearchVisibilityInboundConfig
:<|> IFeatureStatusPut '() SearchVisibilityInboundConfig
:<|> IFeatureStatusPatch '() SearchVisibilityInboundConfig
:<|> IFeatureNoConfigMultiGet SearchVisibilityInboundConfig
-- ClassifiedDomainsConfig
:<|> IFeatureStatusGet ClassifiedDomainsConfig
-- MLSConfig
:<|> IFeatureStatusGet MLSConfig
:<|> IFeatureStatusPut '() MLSConfig
:<|> IFeatureStatusPatch '() MLSConfig
-- SearchVisibilityInboundConfig
:<|> IFeatureStatusGet SearchVisibilityInboundConfig
:<|> IFeatureStatusPut '() SearchVisibilityInboundConfig
:<|> IFeatureStatusPatch '() SearchVisibilityInboundConfig
-- all feature configs
:<|> Named
"feature-configs-internal"
Expand Down Expand Up @@ -470,22 +485,29 @@ featureAPI :: API IFeatureAPI GalleyEffects
featureAPI =
mkNamedAPI @'("iget", SSOConfig) (getFeatureStatus @Cassandra DontDoAuth)
<@> mkNamedAPI @'("iput", SSOConfig) (setFeatureStatusInternal @Cassandra)
<@> mkNamedAPI @'("ipatch", SSOConfig) (patchFeatureStatusInternal @Cassandra)
<@> mkNamedAPI @'("iget", LegalholdConfig) (getFeatureStatus @Cassandra DontDoAuth)
<@> mkNamedAPI @'("iput", LegalholdConfig) (setFeatureStatusInternal @Cassandra)
<@> mkNamedAPI @'("ipatch", LegalholdConfig) (patchFeatureStatusInternal @Cassandra)
<@> mkNamedAPI @'("iget", SearchVisibilityAvailableConfig) (getFeatureStatus @Cassandra DontDoAuth)
<@> mkNamedAPI @'("iput", SearchVisibilityAvailableConfig) (setFeatureStatusInternal @Cassandra)
<@> mkNamedAPI @'("ipatch", SearchVisibilityAvailableConfig) (patchFeatureStatusInternal @Cassandra)
<@> mkNamedAPI @'("iget", ValidateSAMLEmailsConfig) (getFeatureStatus @Cassandra DontDoAuth)
<@> mkNamedAPI @'("iput", ValidateSAMLEmailsConfig) (setFeatureStatusInternal @Cassandra)
<@> mkNamedAPI @'("ipatch", ValidateSAMLEmailsConfig) (patchFeatureStatusInternal @Cassandra)
<@> mkNamedAPI @'("iget", DigitalSignaturesConfig) (getFeatureStatus @Cassandra DontDoAuth)
<@> mkNamedAPI @'("iput", DigitalSignaturesConfig) (setFeatureStatusInternal @Cassandra)
<@> mkNamedAPI @'("ipatch", DigitalSignaturesConfig) (patchFeatureStatusInternal @Cassandra)
<@> mkNamedAPI @'("iget", AppLockConfig) (getFeatureStatus @Cassandra DontDoAuth)
<@> mkNamedAPI @'("iput", AppLockConfig) (setFeatureStatusInternal @Cassandra)
<@> mkNamedAPI @'("ipatch", AppLockConfig) (patchFeatureStatusInternal @Cassandra)
<@> mkNamedAPI @'("iget", FileSharingConfig) (getFeatureStatus @Cassandra DontDoAuth)
<@> mkNamedAPI @'("iput", FileSharingConfig) (setFeatureStatusInternal @Cassandra)
<@> mkNamedAPI @'("ilock", FileSharingConfig) (updateLockStatus @Cassandra @FileSharingConfig)
<@> mkNamedAPI @'("ipatch", FileSharingConfig) (patchFeatureStatusInternal @Cassandra)
<@> mkNamedAPI @'("iget", ConferenceCallingConfig) (getFeatureStatus @Cassandra DontDoAuth)
<@> mkNamedAPI @'("iput", ConferenceCallingConfig) (setFeatureStatusInternal @Cassandra)
<@> mkNamedAPI @'("ipatch", ConferenceCallingConfig) (patchFeatureStatusInternal @Cassandra)
<@> mkNamedAPI @'("iget", SelfDeletingMessagesConfig) (getFeatureStatus @Cassandra DontDoAuth)
<@> mkNamedAPI @'("iput", SelfDeletingMessagesConfig) (setFeatureStatusInternal @Cassandra)
<@> mkNamedAPI @'("ilock", SelfDeletingMessagesConfig) (updateLockStatus @Cassandra @SelfDeletingMessagesConfig)
Expand All @@ -500,12 +522,15 @@ featureAPI =
<@> mkNamedAPI @'("ipatch", SndFactorPasswordChallengeConfig) (patchFeatureStatusInternal @Cassandra)
<@> mkNamedAPI @'("iget", SearchVisibilityInboundConfig) (getFeatureStatus @Cassandra DontDoAuth)
<@> mkNamedAPI @'("iput", SearchVisibilityInboundConfig) (setFeatureStatusInternal @Cassandra)
<@> mkNamedAPI @'("ipatch", SearchVisibilityInboundConfig) (patchFeatureStatusInternal @Cassandra)
<@> mkNamedAPI @'("igetmulti", SearchVisibilityInboundConfig) (getFeatureStatusMulti @Cassandra)
<@> mkNamedAPI @'("iget", ClassifiedDomainsConfig) (getFeatureStatus @Cassandra DontDoAuth)
<@> mkNamedAPI @'("iget", MLSConfig) (getFeatureStatus @Cassandra DontDoAuth)
<@> mkNamedAPI @'("iput", MLSConfig) (setFeatureStatusInternal @Cassandra)
<@> mkNamedAPI @'("ipatch", MLSConfig) (patchFeatureStatusInternal @Cassandra)
<@> mkNamedAPI @'("iget", SearchVisibilityInboundConfig) (getFeatureStatus @Cassandra DontDoAuth)
<@> mkNamedAPI @'("iput", SearchVisibilityInboundConfig) (setFeatureStatusInternal @Cassandra)
<@> mkNamedAPI @'("ipatch", SearchVisibilityInboundConfig) (patchFeatureStatusInternal @Cassandra)
<@> mkNamedAPI @"feature-configs-internal" (maybe (getAllFeatureConfigsForServer @Cassandra) (getAllFeatureConfigsForUser @Cassandra))

internalSitemap :: Routes a (Sem GalleyEffects) ()
Expand Down
Loading

0 comments on commit 13b0d3e

Please sign in to comment.