scim2-models 0.3.6__py3-none-any.whl → 0.4.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- scim2_models/__init__.py +52 -52
- scim2_models/annotations.py +104 -0
- scim2_models/attributes.py +57 -0
- scim2_models/base.py +195 -554
- scim2_models/constants.py +3 -3
- scim2_models/context.py +168 -0
- scim2_models/{rfc7644 → messages}/bulk.py +4 -4
- scim2_models/{rfc7644 → messages}/error.py +13 -13
- scim2_models/messages/list_response.py +75 -0
- scim2_models/messages/message.py +119 -0
- scim2_models/messages/patch_op.py +478 -0
- scim2_models/{rfc7644 → messages}/search_request.py +55 -6
- scim2_models/reference.py +82 -0
- scim2_models/{rfc7643 → resources}/enterprise_user.py +4 -4
- scim2_models/{rfc7643 → resources}/group.py +5 -5
- scim2_models/resources/resource.py +468 -0
- scim2_models/{rfc7643 → resources}/resource_type.py +13 -22
- scim2_models/{rfc7643 → resources}/schema.py +51 -45
- scim2_models/{rfc7643 → resources}/service_provider_config.py +7 -7
- scim2_models/{rfc7643 → resources}/user.py +9 -9
- scim2_models/scim_object.py +66 -0
- scim2_models/urn.py +109 -0
- scim2_models/utils.py +108 -6
- {scim2_models-0.3.6.dist-info → scim2_models-0.4.0.dist-info}/METADATA +1 -1
- scim2_models-0.4.0.dist-info/RECORD +30 -0
- scim2_models/rfc7643/resource.py +0 -355
- scim2_models/rfc7644/list_response.py +0 -136
- scim2_models/rfc7644/message.py +0 -10
- scim2_models/rfc7644/patch_op.py +0 -70
- scim2_models-0.3.6.dist-info/RECORD +0 -24
- /scim2_models/{rfc7643 → messages}/__init__.py +0 -0
- /scim2_models/{rfc7644 → resources}/__init__.py +0 -0
- {scim2_models-0.3.6.dist-info → scim2_models-0.4.0.dist-info}/WHEEL +0 -0
- {scim2_models-0.3.6.dist-info → scim2_models-0.4.0.dist-info}/licenses/LICENSE +0 -0
scim2_models/__init__.py
CHANGED
|
@@ -1,56 +1,56 @@
|
|
|
1
|
+
from .annotations import CaseExact
|
|
2
|
+
from .annotations import Mutability
|
|
3
|
+
from .annotations import Required
|
|
4
|
+
from .annotations import Returned
|
|
5
|
+
from .annotations import Uniqueness
|
|
6
|
+
from .attributes import ComplexAttribute
|
|
7
|
+
from .attributes import MultiValuedComplexAttribute
|
|
1
8
|
from .base import BaseModel
|
|
2
|
-
from .
|
|
3
|
-
from .
|
|
4
|
-
from .
|
|
5
|
-
from .
|
|
6
|
-
from .
|
|
7
|
-
from .
|
|
8
|
-
from .
|
|
9
|
-
from .
|
|
10
|
-
from .
|
|
11
|
-
from .
|
|
12
|
-
from .
|
|
13
|
-
from .
|
|
14
|
-
from .
|
|
15
|
-
from .
|
|
16
|
-
from .
|
|
17
|
-
from .
|
|
18
|
-
from .
|
|
19
|
-
from .
|
|
20
|
-
from .
|
|
21
|
-
from .
|
|
22
|
-
from .
|
|
23
|
-
from .
|
|
24
|
-
from .
|
|
25
|
-
from .
|
|
26
|
-
from .
|
|
27
|
-
from .
|
|
28
|
-
from .
|
|
29
|
-
from .
|
|
30
|
-
from .
|
|
31
|
-
from .
|
|
32
|
-
from .
|
|
33
|
-
from .
|
|
34
|
-
from .
|
|
35
|
-
from .
|
|
36
|
-
from .
|
|
37
|
-
from .
|
|
38
|
-
from .
|
|
39
|
-
from .
|
|
40
|
-
from .
|
|
41
|
-
from .
|
|
42
|
-
from .
|
|
43
|
-
from .
|
|
44
|
-
from .
|
|
45
|
-
from .
|
|
46
|
-
from .
|
|
47
|
-
from .rfc7644.bulk import BulkResponse
|
|
48
|
-
from .rfc7644.error import Error
|
|
49
|
-
from .rfc7644.list_response import ListResponse
|
|
50
|
-
from .rfc7644.message import Message
|
|
51
|
-
from .rfc7644.patch_op import PatchOp
|
|
52
|
-
from .rfc7644.patch_op import PatchOperation
|
|
53
|
-
from .rfc7644.search_request import SearchRequest
|
|
9
|
+
from .context import Context
|
|
10
|
+
from .messages.bulk import BulkOperation
|
|
11
|
+
from .messages.bulk import BulkRequest
|
|
12
|
+
from .messages.bulk import BulkResponse
|
|
13
|
+
from .messages.error import Error
|
|
14
|
+
from .messages.list_response import ListResponse
|
|
15
|
+
from .messages.message import Message
|
|
16
|
+
from .messages.patch_op import PatchOp
|
|
17
|
+
from .messages.patch_op import PatchOperation
|
|
18
|
+
from .messages.search_request import SearchRequest
|
|
19
|
+
from .reference import ExternalReference
|
|
20
|
+
from .reference import Reference
|
|
21
|
+
from .reference import URIReference
|
|
22
|
+
from .resources.enterprise_user import EnterpriseUser
|
|
23
|
+
from .resources.enterprise_user import Manager
|
|
24
|
+
from .resources.group import Group
|
|
25
|
+
from .resources.group import GroupMember
|
|
26
|
+
from .resources.resource import AnyExtension
|
|
27
|
+
from .resources.resource import AnyResource
|
|
28
|
+
from .resources.resource import Extension
|
|
29
|
+
from .resources.resource import Meta
|
|
30
|
+
from .resources.resource import Resource
|
|
31
|
+
from .resources.resource_type import ResourceType
|
|
32
|
+
from .resources.resource_type import SchemaExtension
|
|
33
|
+
from .resources.schema import Attribute
|
|
34
|
+
from .resources.schema import Schema
|
|
35
|
+
from .resources.service_provider_config import AuthenticationScheme
|
|
36
|
+
from .resources.service_provider_config import Bulk
|
|
37
|
+
from .resources.service_provider_config import ChangePassword
|
|
38
|
+
from .resources.service_provider_config import ETag
|
|
39
|
+
from .resources.service_provider_config import Filter
|
|
40
|
+
from .resources.service_provider_config import Patch
|
|
41
|
+
from .resources.service_provider_config import ServiceProviderConfig
|
|
42
|
+
from .resources.service_provider_config import Sort
|
|
43
|
+
from .resources.user import Address
|
|
44
|
+
from .resources.user import Email
|
|
45
|
+
from .resources.user import Entitlement
|
|
46
|
+
from .resources.user import GroupMembership
|
|
47
|
+
from .resources.user import Im
|
|
48
|
+
from .resources.user import Name
|
|
49
|
+
from .resources.user import PhoneNumber
|
|
50
|
+
from .resources.user import Photo
|
|
51
|
+
from .resources.user import Role
|
|
52
|
+
from .resources.user import User
|
|
53
|
+
from .resources.user import X509Certificate
|
|
54
54
|
|
|
55
55
|
__all__ = [
|
|
56
56
|
"Address",
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
from enum import Enum
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class Mutability(str, Enum):
|
|
5
|
+
"""A single keyword indicating the circumstances under which the value of the attribute can be (re)defined."""
|
|
6
|
+
|
|
7
|
+
read_only = "readOnly"
|
|
8
|
+
"""The attribute SHALL NOT be modified."""
|
|
9
|
+
|
|
10
|
+
read_write = "readWrite"
|
|
11
|
+
"""The attribute MAY be updated and read at any time."""
|
|
12
|
+
|
|
13
|
+
immutable = "immutable"
|
|
14
|
+
"""The attribute MAY be defined at resource creation (e.g., POST) or at
|
|
15
|
+
record replacement via a request (e.g., a PUT).
|
|
16
|
+
|
|
17
|
+
The attribute SHALL NOT be updated.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
write_only = "writeOnly"
|
|
21
|
+
"""The attribute MAY be updated at any time.
|
|
22
|
+
|
|
23
|
+
Attribute values SHALL NOT be returned (e.g., because the value is a
|
|
24
|
+
stored hash). Note: An attribute with a mutability of "writeOnly"
|
|
25
|
+
usually also has a returned setting of "never".
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
_default = read_write
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class Returned(str, Enum):
|
|
32
|
+
"""A single keyword that indicates when an attribute and associated values are returned in response to a GET request or in response to a PUT, POST, or PATCH request."""
|
|
33
|
+
|
|
34
|
+
always = "always" # cannot be excluded
|
|
35
|
+
"""The attribute is always returned, regardless of the contents of the
|
|
36
|
+
"attributes" parameter.
|
|
37
|
+
|
|
38
|
+
For example, "id" is always returned to identify a SCIM resource.
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
never = "never" # always excluded
|
|
42
|
+
"""The attribute is never returned, regardless of the contents of the
|
|
43
|
+
"attributes" parameter."""
|
|
44
|
+
|
|
45
|
+
default = "default" # included by default but can be excluded
|
|
46
|
+
"""The attribute is returned by default in all SCIM operation responses
|
|
47
|
+
where attribute values are returned, unless it is explicitly excluded."""
|
|
48
|
+
|
|
49
|
+
request = "request" # excluded by default but can be included
|
|
50
|
+
"""The attribute is returned in response to any PUT, POST, or PATCH
|
|
51
|
+
operations if specified in the "attributes" parameter."""
|
|
52
|
+
|
|
53
|
+
_default = default
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
class Uniqueness(str, Enum):
|
|
57
|
+
"""A single keyword value that specifies how the service provider enforces uniqueness of attribute values."""
|
|
58
|
+
|
|
59
|
+
none = "none"
|
|
60
|
+
"""The values are not intended to be unique in any way."""
|
|
61
|
+
|
|
62
|
+
server = "server"
|
|
63
|
+
"""The value SHOULD be unique within the context of the current SCIM
|
|
64
|
+
endpoint (or tenancy) and MAY be globally unique (e.g., a "username", email
|
|
65
|
+
address, or other server-generated key or counter).
|
|
66
|
+
|
|
67
|
+
No two resources on the same server SHOULD possess the same value.
|
|
68
|
+
"""
|
|
69
|
+
|
|
70
|
+
global_ = "global"
|
|
71
|
+
"""The value SHOULD be globally unique (e.g., an email address, a GUID, or
|
|
72
|
+
other value).
|
|
73
|
+
|
|
74
|
+
No two resources on any server SHOULD possess the same value.
|
|
75
|
+
"""
|
|
76
|
+
|
|
77
|
+
_default = none
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
class Required(Enum):
|
|
81
|
+
"""A Boolean value that specifies whether the attribute is required or not.
|
|
82
|
+
|
|
83
|
+
Missing required attributes raise a :class:`~pydantic.ValidationError` on :attr:`~scim2_models.Context.RESOURCE_CREATION_REQUEST` and :attr:`~scim2_models.Context.RESOURCE_REPLACEMENT_REQUEST` validations.
|
|
84
|
+
"""
|
|
85
|
+
|
|
86
|
+
true = True
|
|
87
|
+
false = False
|
|
88
|
+
|
|
89
|
+
_default = false
|
|
90
|
+
|
|
91
|
+
def __bool__(self) -> bool:
|
|
92
|
+
return self.value
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
class CaseExact(Enum):
|
|
96
|
+
"""A Boolean value that specifies whether a string attribute is case- sensitive or not."""
|
|
97
|
+
|
|
98
|
+
true = True
|
|
99
|
+
false = False
|
|
100
|
+
|
|
101
|
+
_default = false
|
|
102
|
+
|
|
103
|
+
def __bool__(self) -> bool:
|
|
104
|
+
return self.value
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
from inspect import isclass
|
|
2
|
+
from typing import Annotated
|
|
3
|
+
from typing import Any
|
|
4
|
+
from typing import Optional
|
|
5
|
+
from typing import get_origin
|
|
6
|
+
|
|
7
|
+
from pydantic import Field
|
|
8
|
+
|
|
9
|
+
from .annotations import Mutability
|
|
10
|
+
|
|
11
|
+
# This import will work because we'll import this module after BaseModel is defined
|
|
12
|
+
from .base import BaseModel
|
|
13
|
+
from .reference import Reference
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class ComplexAttribute(BaseModel):
|
|
17
|
+
"""A complex attribute as defined in :rfc:`RFC7643 §2.3.8 <7643#section-2.3.8>`."""
|
|
18
|
+
|
|
19
|
+
_attribute_urn: Optional[str] = None
|
|
20
|
+
|
|
21
|
+
def get_attribute_urn(self, field_name: str) -> str:
|
|
22
|
+
"""Build the full URN of the attribute.
|
|
23
|
+
|
|
24
|
+
See :rfc:`RFC7644 §3.10 <7644#section-3.10>`.
|
|
25
|
+
"""
|
|
26
|
+
alias = (
|
|
27
|
+
self.__class__.model_fields[field_name].serialization_alias or field_name
|
|
28
|
+
)
|
|
29
|
+
return f"{self._attribute_urn}.{alias}"
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class MultiValuedComplexAttribute(ComplexAttribute):
|
|
33
|
+
type: Optional[str] = None
|
|
34
|
+
"""A label indicating the attribute's function."""
|
|
35
|
+
|
|
36
|
+
primary: Optional[bool] = None
|
|
37
|
+
"""A Boolean value indicating the 'primary' or preferred attribute value
|
|
38
|
+
for this attribute."""
|
|
39
|
+
|
|
40
|
+
display: Annotated[Optional[str], Mutability.immutable] = None
|
|
41
|
+
"""A human-readable name, primarily used for display purposes."""
|
|
42
|
+
|
|
43
|
+
value: Optional[Any] = None
|
|
44
|
+
"""The value of an entitlement."""
|
|
45
|
+
|
|
46
|
+
ref: Optional[Reference] = Field(None, serialization_alias="$ref")
|
|
47
|
+
"""The reference URI of a target resource, if the attribute is a
|
|
48
|
+
reference."""
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def is_complex_attribute(type_: type) -> bool:
|
|
52
|
+
# issubclass raise a TypeError with 'Reference' on python < 3.11
|
|
53
|
+
return (
|
|
54
|
+
get_origin(type_) != Reference
|
|
55
|
+
and isclass(type_)
|
|
56
|
+
and issubclass(type_, (ComplexAttribute, MultiValuedComplexAttribute))
|
|
57
|
+
)
|