Skip to content

Commit 9abb25f

Browse files
committed
fix: implement attribute classes for User and Group
1 parent d399aa0 commit 9abb25f

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

scim2_models/rfc7643/group.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
from typing import Annotated
2+
from typing import ClassVar
23
from typing import Literal
34
from typing import Optional
45
from typing import Union
56

67
from pydantic import Field
78

9+
from ..base import ComplexAttribute
810
from ..base import MultiValuedComplexAttribute
911
from ..base import Mutability
1012
from ..base import Reference
@@ -39,5 +41,6 @@ class Group(Resource):
3941
display_name: Optional[str] = None
4042
"""A human-readable name for the Group."""
4143

44+
Members: ClassVar[type[ComplexAttribute]] = GroupMember
4245
members: Optional[list[GroupMember]] = None
4346
"""A list of members of the Group."""

scim2_models/rfc7643/user.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from enum import Enum
2+
from typing import ClassVar
23
from typing import Annotated
34
from typing import Literal
45
from typing import Optional
@@ -223,6 +224,7 @@ class User(Resource[AnyExtension]):
223224
"""Unique identifier for the User, typically used by the user to directly
224225
authenticate to the service provider."""
225226

227+
Name: ClassVar[type[ComplexAttribute]] = Name
226228
name: Optional[Name] = None
227229
"""The components of the user's real name."""
228230

@@ -268,32 +270,41 @@ class User(Resource[AnyExtension]):
268270
password: Annotated[Optional[str], Mutability.write_only, Returned.never] = None
269271
"""The User's cleartext password."""
270272

273+
Emails: ClassVar[type[ComplexAttribute]] = Email
271274
emails: Optional[list[Email]] = None
272275
"""Email addresses for the user."""
273276

277+
PhoneNumbers: ClassVar[type[ComplexAttribute]] = PhoneNumber
274278
phone_numbers: Optional[list[PhoneNumber]] = None
275279
"""Phone numbers for the User."""
276280

281+
Ims: ClassVar[type[ComplexAttribute]] = Im
277282
ims: Optional[list[Im]] = None
278283
"""Instant messaging addresses for the User."""
279284

285+
Photos: ClassVar[type[ComplexAttribute]] = Photo
280286
photos: Optional[list[Photo]] = None
281287
"""URLs of photos of the User."""
282288

289+
Addresses: ClassVar[type[ComplexAttribute]] = Address
283290
addresses: Optional[list[Address]] = None
284291
"""A physical mailing address for this User."""
285292

293+
Groups: ClassVar[type[ComplexAttribute]] = GroupMembership
286294
groups: Annotated[Optional[list[GroupMembership]], Mutability.read_only] = None
287295
"""A list of groups to which the user belongs, either through direct
288296
membership, through nested groups, or dynamically calculated."""
289297

298+
Entitlements: ClassVar[type[ComplexAttribute]] = Entitlement
290299
entitlements: Optional[list[Entitlement]] = None
291300
"""A list of entitlements for the User that represent a thing the User
292301
has."""
293302

303+
Roles: ClassVar[type[ComplexAttribute]] = Role
294304
roles: Optional[list[Role]] = None
295305
"""A list of roles for the User that collectively represent who the User
296306
is, e.g., 'Student', 'Faculty'."""
297307

308+
X509Certificates: ClassVar[type[ComplexAttribute]] = X509Certificate
298309
x509_certificates: Optional[list[X509Certificate]] = None
299310
"""A list of certificates issued to the User."""

0 commit comments

Comments
 (0)