-- | Convert shareFull value read from db into a policy
-- value, applying a default if needed.
toPolicyDefaulting :: Maybe Bool -> a -> a -> a
toPolicyDefaulting mShareFull noPolicy restrictedPolicy =
    let
        -- in the rare circumstance that a volume access
        -- entry in db improperly contains null for public/shared group,
        -- arbitrarily use True to follow old convention before sharefull
        -- was introduced.
        shareFull = fromMaybe True mShareFull
    in
        if shareFull then noPolicy else restrictedPolicy
toPolicyDefaulting :: Maybe Bool -> a -> a -> a
toPolicyDefaulting mShareFull noPolicy restrictedPolicy =
    let
        -- in the rare circumstance that a volume access
        -- entry in db improperly contains null for public/shared group,
        -- arbitrarily use True to follow old convention before sharefull
        -- was introduced.
        shareFull = fromMaybe True mShareFull
    in
        if shareFull then noPolicy else restrictedPolicy
toPolicyDefaulting mShareFull noPolicy restrictedPolicy =
    let
        -- in the rare circumstance that a volume access
        -- entry in db improperly contains null for public/shared group,
        -- arbitrarily use True to follow old convention before sharefull
        -- was introduced.
        shareFull = fromMaybe True mShareFull
    in
        if shareFull then noPolicy else restrictedPolicy