hscim-0.4.0.4: hscim json schema and server implementation
Safe HaskellSafe-Inferred
LanguageHaskell2010

Web.Scim.Schema.User

Description

SCIM user representation.

Our interpretation of the spec

The spec can be read at https://tools.ietf.org/html/rfc7643#section-4.1. While implementing the spec we had to resolve some ambiguities and place some additional constraints on the possible SCIM server behavior we can support.

Resource ID / user ID

The User object doesn't contain a user ID (as in "opaque server-assigned immutable ID") by design. IDs and metadata are added to types in a uniform fashion by using WithId and WithMeta.

Optional fields

The spec only mandates the userName and id attribute. All other attributes seem optional.

Multi-valued fields

When a multi-valued field (e.g. emails) doesn't contain any values, it's unclear whether we should serialize it as [] or omit it entirely. We have opted for the latter to conform to an example in the spec: https://tools.ietf.org/html/rfc7644#section-3.5.1.

TODO(arianvp): Multi-valued attributes actually have some more quirky semantics that we currently don't support yet. E.g. if the multi-values have a primary field then only one of the entires must have 'primary: true' and all the others are either implied 'primary: false' or must be checked that they're false

Attribute names

When parsing JSON objects, we ignore capitalization differences in field names -- e.g. both USERNAME and userName are accepted. This is described by the spec https://tools.ietf.org/html/rfc7643#section-2.1

Synopsis

Documentation

data User tag Source #

SCIM user record, parametrized with type-level tag (see UserTypes).

Instances

Instances details
FromJSON (UserExtra tag) => FromJSON (User tag) Source # 
Instance details

Defined in Web.Scim.Schema.User

Methods

parseJSON :: Value -> Parser (User tag) #

parseJSONList :: Value -> Parser [User tag] #

ToJSON (UserExtra tag) => ToJSON (User tag) Source # 
Instance details

Defined in Web.Scim.Schema.User

Methods

toJSON :: User tag -> Value #

toEncoding :: User tag -> Encoding #

toJSONList :: [User tag] -> Value #

toEncodingList :: [User tag] -> Encoding #

Generic (User tag) Source # 
Instance details

Defined in Web.Scim.Schema.User

Associated Types

type Rep (User tag) :: Type -> Type #

Methods

from :: User tag -> Rep (User tag) x #

to :: Rep (User tag) x -> User tag #

Show (UserExtra tag) => Show (User tag) Source # 
Instance details

Defined in Web.Scim.Schema.User

Methods

showsPrec :: Int -> User tag -> ShowS #

show :: User tag -> String #

showList :: [User tag] -> ShowS #

Eq (UserExtra tag) => Eq (User tag) Source # 
Instance details

Defined in Web.Scim.Schema.User

Methods

(==) :: User tag -> User tag -> Bool #

(/=) :: User tag -> User tag -> Bool #

(UserTypes tag, FromJSON (User tag), Patchable (UserExtra tag)) => Patchable (User tag) Source # 
Instance details

Defined in Web.Scim.Schema.User

Methods

applyOperation :: MonadError ScimError m => User tag -> Operation -> m (User tag) Source #

type Rep (User tag) Source # 
Instance details

Defined in Web.Scim.Schema.User

type Rep (User tag) = D1 ('MetaData "User" "Web.Scim.Schema.User" "hscim-0.4.0.4-2j6MXcQGp1TDKeruswPvhg" 'False) (C1 ('MetaCons "User" 'PrefixI 'True) ((((S1 ('MetaSel ('Just "schemas") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Schema]) :*: S1 ('MetaSel ('Just "userName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)) :*: (S1 ('MetaSel ('Just "externalId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text)) :*: (S1 ('MetaSel ('Just "name") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Name)) :*: S1 ('MetaSel ('Just "displayName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text))))) :*: ((S1 ('MetaSel ('Just "nickName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text)) :*: (S1 ('MetaSel ('Just "profileUrl") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe URI)) :*: S1 ('MetaSel ('Just "title") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text)))) :*: (S1 ('MetaSel ('Just "userType") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text)) :*: (S1 ('MetaSel ('Just "preferredLanguage") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text)) :*: S1 ('MetaSel ('Just "locale") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text)))))) :*: (((S1 ('MetaSel ('Just "active") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe ScimBool)) :*: S1 ('MetaSel ('Just "password") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text))) :*: (S1 ('MetaSel ('Just "emails") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Email]) :*: (S1 ('MetaSel ('Just "phoneNumbers") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Phone]) :*: S1 ('MetaSel ('Just "ims") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [IM])))) :*: ((S1 ('MetaSel ('Just "photos") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Photo]) :*: (S1 ('MetaSel ('Just "addresses") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Address]) :*: S1 ('MetaSel ('Just "entitlements") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Text]))) :*: (S1 ('MetaSel ('Just "roles") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Text]) :*: (S1 ('MetaSel ('Just "x509Certificates") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Certificate]) :*: S1 ('MetaSel ('Just "extra") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (UserExtra tag))))))))

empty Source #

Arguments

:: [Schema]

Schemas

-> Text

userName

-> UserExtra tag

Extra data

-> User tag 

data NoUserExtra Source #

A type used to indicate that the SCIM record doesn't have any extra data. Encoded as an empty map.

Constructors

NoUserExtra 

applyPatch :: (Patchable (UserExtra tag), FromJSON (UserExtra tag), MonadError ScimError m, UserTypes tag) => User tag -> PatchOp tag -> m (User tag) Source #

Applies a JSON Patch to a SCIM Core User Only supports the core attributes. Evenmore, only some hand-picked ones currently. We'll have to think how patch is going to work in the presence of extensions. Also, we can probably make PatchOp type-safe to some extent (Read arianvp's thesis :))