Skip to content

Commit

Permalink
Revert "Do not send member updates to all (#3431)"
Browse files Browse the repository at this point in the history
This reverts commit e124b2c.
  • Loading branch information
pcapriotti committed Jul 18, 2023
1 parent 6db29bb commit 0a8fa39
Show file tree
Hide file tree
Showing 19 changed files with 235 additions and 259 deletions.
20 changes: 0 additions & 20 deletions cassandra-schema.cql
Original file line number Diff line number Diff line change
Expand Up @@ -1415,26 +1415,6 @@ CREATE TABLE galley_test.group_id_conv_id (
AND read_repair_chance = 0.0
AND speculative_retry = '99PERCENTILE';

CREATE TABLE galley_test.team_admin (
team uuid,
user uuid,
PRIMARY KEY (team, user)
) WITH CLUSTERING ORDER BY (user ASC)
AND bloom_filter_fp_chance = 0.1
AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
AND comment = ''
AND compaction = {'class': 'org.apache.cassandra.db.compaction.LeveledCompactionStrategy'}
AND compression = {'chunk_length_in_kb': '64', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}
AND crc_check_chance = 1.0
AND dclocal_read_repair_chance = 0.1
AND default_time_to_live = 0
AND gc_grace_seconds = 864000
AND max_index_interval = 2048
AND memtable_flush_period_in_ms = 0
AND min_index_interval = 128
AND read_repair_chance = 0.0
AND speculative_retry = '99PERCENTILE';

-- NOTE: this table is unused. It was replaced by mls_group_member_client
CREATE TABLE galley_test.member_client (
conv uuid,
Expand Down
10 changes: 0 additions & 10 deletions libs/galley-types/src/Galley/Types/Teams.hs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ module Galley.Types.Teams
rolePermissions,
roleHiddenPermissions,
permissionsRole,
isAdminOrOwner,
HiddenPerm (..),
IsPerm (..),
)
Expand Down Expand Up @@ -102,15 +101,6 @@ permissionsRole (Permissions p p') =
rolePerms role `Set.isSubsetOf` perms
]

isAdminOrOwner :: Permissions -> Bool
isAdminOrOwner perms =
case permissionsRole perms of
Just RoleOwner -> True
Just RoleAdmin -> True
Just RoleMember -> False
Just RoleExternalPartner -> False
Nothing -> False

-- | Internal function for 'rolePermissions'. (It works iff the two sets in 'Permissions' are
-- identical for every 'Role', otherwise it'll need to be specialized for the resp. sides.)
rolePerms :: Role -> Set Perm
Expand Down
3 changes: 0 additions & 3 deletions libs/wire-api/src/Wire/API/Error/Galley.hs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ data GalleyError
| UserBindingExists
| NoAddToBinding
| TooManyTeamMembers
| TooManyTeamAdmins
| -- FUTUREWORK: possibly make MissingPermission take a list of Perm
MissingPermission (Maybe Perm)
| ActionDenied Action
Expand Down Expand Up @@ -169,8 +168,6 @@ type instance MapError 'NoAddToBinding = 'StaticError 403 "binding-team" "Cannot

type instance MapError 'TooManyTeamMembers = 'StaticError 403 "too-many-team-members" "Maximum number of members per team reached"

type instance MapError 'TooManyTeamAdmins = 'StaticError 403 "too-many-team-admins" "Maximum number of admins per team reached"

type instance MapError ('MissingPermission mperm) = 'StaticError 403 "operation-denied" (MissingPermissionMessage mperm)

type instance MapError ('ActionDenied action) = 'StaticError 403 "action-denied" ("Insufficient authorization (missing " `AppendSymbol` ActionName action `AppendSymbol` ")")
Expand Down
2 changes: 0 additions & 2 deletions libs/wire-api/src/Wire/API/Routes/Internal/Galley.hs
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,6 @@ type ITeamsAPIBase =
"unchecked-add-team-member"
( CanThrow 'TooManyTeamMembers
:> CanThrow 'TooManyTeamMembersOnTeamWithLegalhold
:> CanThrow 'TooManyTeamAdmins
:> ReqBody '[Servant.JSON] NewTeamMember
:> MultiVerb1 'POST '[Servant.JSON] (RespondEmpty 200 "OK")
)
Expand All @@ -321,7 +320,6 @@ type ITeamsAPIBase =
:> CanThrow 'InvalidPermissions
:> CanThrow 'TeamNotFound
:> CanThrow 'TeamMemberNotFound
:> CanThrow 'TooManyTeamAdmins
:> CanThrow 'NotATeamMember
:> CanThrow OperationDenied
:> ReqBody '[Servant.JSON] NewTeamMember
Expand Down
2 changes: 0 additions & 2 deletions libs/wire-api/src/Wire/API/Routes/Public/Galley/TeamMember.hs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ type TeamMemberAPI =
:> CanThrow OperationDenied
:> CanThrow 'TeamNotFound
:> CanThrow 'TooManyTeamMembers
:> CanThrow 'TooManyTeamAdmins
:> CanThrow 'UserBindingExists
:> CanThrow 'TooManyTeamMembersOnTeamWithLegalhold
:> ZLocalUser
Expand Down Expand Up @@ -170,7 +169,6 @@ type TeamMemberAPI =
:> CanThrow 'InvalidPermissions
:> CanThrow 'TeamNotFound
:> CanThrow 'TeamMemberNotFound
:> CanThrow 'TooManyTeamAdmins
:> CanThrow 'NotATeamMember
:> CanThrow OperationDenied
:> ZLocalUser
Expand Down
2 changes: 1 addition & 1 deletion services/brig/test/integration/API/Federation.hs
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ testRemoteUserGetsDeleted opts brig cannon fedBrigClient = do
runFedClient @"on-user-deleted-connections" fedBrigClient (qDomain remoteUser) $
UserDeletedConnectionsNotification (qUnqualified remoteUser) (unsafeRange localUsers)

WS.assertMatchN_ (60 # Second) [cc] $ matchDeleteUserNotification remoteUser
WS.assertMatchN_ (5 # Second) [cc] $ matchDeleteUserNotification remoteUser
WS.assertNoEvent (1 # Second) [pc, bc, uc]

for_ localUsers $ \u ->
Expand Down
3 changes: 0 additions & 3 deletions services/galley/galley.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,6 @@ executable galley-migrate-data
Paths_galley
V1_BackfillBillingTeamMembers
V2_MigrateMLSMembers
V3_BackfillTeamAdmins

hs-source-dirs: migrate-data/src
default-extensions:
Expand Down Expand Up @@ -585,7 +584,6 @@ executable galley-migrate-data
, exceptions
, extended
, galley
, galley-types
, imports
, lens
, optparse-applicative
Expand Down Expand Up @@ -670,7 +668,6 @@ executable galley-schema
V80_AddConversationCodePassword
V81_TeamFeatureMlsE2EIdUpdate
V82_RemoteDomainIndexes
V83_CreateTableTeamAdmin

hs-source-dirs: schema/src
default-extensions:
Expand Down
4 changes: 1 addition & 3 deletions services/galley/migrate-data/src/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import Options.Applicative
import qualified System.Logger.Extended as Log
import qualified V1_BackfillBillingTeamMembers
import qualified V2_MigrateMLSMembers
import qualified V3_BackfillTeamAdmins

main :: IO ()
main = do
Expand All @@ -33,8 +32,7 @@ main = do
l
o
[ V1_BackfillBillingTeamMembers.migration,
V2_MigrateMLSMembers.migration,
V3_BackfillTeamAdmins.migration
V2_MigrateMLSMembers.migration
]
where
desc = header "Galley Cassandra Data Migrations" <> fullDesc
74 changes: 0 additions & 74 deletions services/galley/migrate-data/src/V3_BackfillTeamAdmins.hs

This file was deleted.

4 changes: 1 addition & 3 deletions services/galley/schema/src/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ import qualified V79_TeamFeatureMlsE2EId
import qualified V80_AddConversationCodePassword
import qualified V81_TeamFeatureMlsE2EIdUpdate
import qualified V82_RemoteDomainIndexes
import qualified V83_CreateTableTeamAdmin

main :: IO ()
main = do
Expand Down Expand Up @@ -156,8 +155,7 @@ main = do
V79_TeamFeatureMlsE2EId.migration,
V80_AddConversationCodePassword.migration,
V81_TeamFeatureMlsE2EIdUpdate.migration,
V82_RemoteDomainIndexes.migration,
V83_CreateTableTeamAdmin.migration
V82_RemoteDomainIndexes.migration
-- When adding migrations here, don't forget to update
-- 'schemaVersion' in Galley.Cassandra
-- (see also docs/developer/cassandra-interaction.md)
Expand Down
36 changes: 0 additions & 36 deletions services/galley/schema/src/V83_CreateTableTeamAdmin.hs

This file was deleted.

5 changes: 2 additions & 3 deletions services/galley/src/Galley/API/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ import Galley.Effects.MemberStore
import qualified Galley.Effects.MemberStore as E
import Galley.Effects.ProposalStore
import Galley.Effects.TeamStore
import qualified Galley.Effects.TeamStore as E
import qualified Galley.Intra.Push as Intra
import Galley.Monad
import Galley.Options
Expand Down Expand Up @@ -377,8 +376,8 @@ rmUser lusr conn = do
goConvPages range newCids

leaveTeams page = for_ (pageItems page) $ \tid -> do
admins <- E.getTeamAdmins tid
uncheckedDeleteTeamMember lusr conn tid (tUnqualified lusr) admins
mems <- getTeamMembersForFanout tid
uncheckedDeleteTeamMember lusr conn tid (tUnqualified lusr) mems
page' <- listTeams @p2 (tUnqualified lusr) (Just (pageState page)) maxBound
leaveTeams page'

Expand Down
Loading

0 comments on commit 0a8fa39

Please sign in to comment.