wireapp / wireapp/wire-server

Do Spar things transactionally

Open
#913 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Haskell
Stars
2.8k
Forks
334
Avg merge
1d 7h
Merged PRs (30d)
50

Description

Right, I think this might still be worth it in this one, and should look like something in the lines of:

insertScimAndSamlUser :: (HasCallStack, MonadClient m) => UserId -> SAML.UserRef -> ScimC.User.StoredUser SparTag -> m ()
insertScimAndSamlUser uid (SAML.UserRef tenant subject) scimUsr = retry x5 . batch $ do
  setType BatchLogged
  setConsistency Quorum
  addPrepQuery insScim (uid, WrappedScimStoredUser scimUsr)
  addPrepQuery insSaml (tenant, subject, uid)
  where
    insScim :: PrepQuery W (UserId, WrappedScimStoredUser SparTag) ()
    insScim = "INSERT INTO scim_user (id, json) VALUES (?, ?)"

    insSaml :: PrepQuery W (SAML.Issuer, SAML.NameID, UserId) ()
    insSaml = "INSERT INTO user (issuer, sso_id, uid) VALUES (?, ?, ?)"

The main annoyance I see with this is that you will need a Show instance for WrappedScimStoredUser SparTag -> not sure how trivial it is to come up with a meaningful one.

Originally posted by @tiago-loureiro in https://github.com/wireapp/wire-server/pull/905

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the proposed insertScimAndSamlUser definition and the referenced pull request #905 first. Trace the existing Spar SCIM and SAML insertion path, including the batch and retry behavior shown in the issue. Done means the two inserts are handled transactionally as described and the WrappedScimStoredUser SparTag serialization concern is resolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
backend, databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.