-
Notifications
You must be signed in to change notification settings - Fork 325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add more debug logging #828
Changes from 8 commits
85f1315
cc6c0ef
3887f70
939daa4
32ec445
4debcf1
01b9600
3b98bd7
1cc8715
8084a86
dfabfec
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -3,12 +3,12 @@ module Galley.API.LegalHold where | |||||
import Imports | ||||||
import Galley.API.Error | ||||||
import Brig.Types.Provider | ||||||
import Brig.Types.Team.LegalHold | ||||||
import Brig.Types.Team.LegalHold hiding (userId) | ||||||
import Brig.Types.Client.Prekey | ||||||
import Control.Monad.Catch | ||||||
import Control.Lens (view, (^.)) | ||||||
import Data.Id | ||||||
import Data.ByteString.Conversion (toByteString') | ||||||
import Data.ByteString.Conversion (toByteString', toByteString) | ||||||
import Data.Misc | ||||||
import Data.LegalHold (UserLegalHoldStatus(..)) | ||||||
import Galley.API.Util | ||||||
|
@@ -42,6 +42,10 @@ createSettings (zusr ::: tid ::: req ::: _) = do | |||||
assertLegalHoldEnabled tid | ||||||
|
||||||
membs <- Data.teamMembers tid | ||||||
let zothers = map (view userId) membs | ||||||
Log.debug $ Log.field "targets" (toByteString (show zothers)) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (you're still using show on the (speaking of which: why debug? are customers going to want to use this? then it should at least be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't do |
||||||
. Log.msg (Log.val "LegalHold.createSettings") | ||||||
arianvp marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
void $ permissionCheck zusr ChangeLegalHoldTeamSettings membs | ||||||
|
||||||
newService :: NewLegalHoldService | ||||||
|
@@ -71,8 +75,11 @@ getSettings (zusr ::: tid ::: _) = do | |||||
removeSettings :: UserId ::: TeamId ::: JsonRequest RemoveLegalHoldSettingsRequest ::: JSON -> Galley Response | ||||||
removeSettings (zusr ::: tid ::: req ::: _) = do | ||||||
assertLegalHoldEnabled tid | ||||||
|
||||||
membs <- Data.teamMembers tid | ||||||
let zothers = map (view userId) membs | ||||||
Log.debug $ Log.field "targets" (toByteString (show zothers)) | ||||||
. Log.msg (Log.val "LegalHold.removeSettings") | ||||||
|
||||||
void $ permissionCheck zusr ChangeLegalHoldTeamSettings membs | ||||||
RemoveLegalHoldSettingsRequest mPassword <- fromJsonBody req | ||||||
ensureReAuthorised zusr mPassword | ||||||
|
@@ -87,6 +94,10 @@ removeSettings' | |||||
-> Galley () | ||||||
removeSettings' tid mMembers = do | ||||||
membs <- maybe (Data.teamMembers tid) pure mMembers | ||||||
let zothers = map (view userId) membs | ||||||
Log.debug $ Log.field "targets" (toByteString (show zothers)) | ||||||
. Log.msg (Log.val "LegalHold.removeSettings'") | ||||||
|
||||||
let lhMembers = filter ((== UserLegalHoldEnabled) . view legalHoldStatus) membs | ||||||
-- I picked this number by fair dice roll, feel free to change it :P | ||||||
pooledMapConcurrentlyN_ 6 removeLHForUser lhMembers | ||||||
|
@@ -129,6 +140,8 @@ requestDevice :: UserId ::: TeamId ::: UserId ::: JSON -> Galley Response | |||||
requestDevice (zusr ::: tid ::: uid ::: _) = do | ||||||
assertLegalHoldEnabled tid | ||||||
|
||||||
Log.debug $ Log.field "targets" (toByteString uid) | ||||||
. Log.msg (Log.val "LegalHold.requestDevice") | ||||||
membs <- Data.teamMembers tid | ||||||
void $ permissionCheck zusr ChangeLegalHoldUserSettings membs | ||||||
|
||||||
|
@@ -164,6 +177,8 @@ approveDevice | |||||
-> Galley Response | ||||||
approveDevice (zusr ::: tid ::: uid ::: connId ::: req ::: _) = do | ||||||
assertLegalHoldEnabled tid | ||||||
Log.debug $ Log.field "targets" (toByteString uid) | ||||||
. Log.msg (Log.val "LegalHold.approveDevice") | ||||||
|
||||||
unless (zusr == uid) (throwM accessDenied) | ||||||
assertOnTeam uid tid | ||||||
|
@@ -199,6 +214,8 @@ disableForUser | |||||
:: UserId ::: TeamId ::: UserId ::: JsonRequest DisableLegalHoldForUserRequest ::: JSON | ||||||
-> Galley Response | ||||||
disableForUser (zusr ::: tid ::: uid ::: req ::: _) = do | ||||||
Log.debug $ Log.field "targets" (toByteString uid) | ||||||
. Log.msg (Log.val "LegalHold.disableForUser") | ||||||
membs <- Data.teamMembers tid | ||||||
void $ permissionCheck zusr ChangeLegalHoldUserSettings membs | ||||||
if userLHNotDisabled membs | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These TODOs are removed in the next PR btw