Skip to content

user_group

UserGroupCreate

Bases: BaseModel

Schema for UserGroup creation

Attributes:

Name Type Description
name str

Group name

Source code in fractal_server/app/schemas/user_group.py
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
class UserGroupCreate(BaseModel, extra=Extra.forbid):
    """
    Schema for `UserGroup` creation

    Attributes:
        name: Group name
    """

    name: str
    viewer_paths: list[str] = Field(default_factory=list)

    @validator("viewer_paths")
    def viewer_paths_validator(cls, value):
        for i, path in enumerate(value):
            value[i] = val_absolute_path(f"viewer_paths[{i}]")(path)
        value = val_unique_list("viewer_paths")(value)
        return value

UserGroupRead

Bases: BaseModel

Schema for UserGroup read

NOTE: user_ids does not correspond to a column of the UserGroup table, but it is rather computed dynamically in relevant endpoints.

Attributes:

Name Type Description
id int

Group ID

name str

Group name

timestamp_created datetime

Creation timestamp

user_ids Optional[list[int]]

IDs of users of this group

Source code in fractal_server/app/schemas/user_group.py
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
class UserGroupRead(BaseModel):
    """
    Schema for `UserGroup` read

    NOTE: `user_ids` does not correspond to a column of the `UserGroup` table,
    but it is rather computed dynamically in relevant endpoints.

    Attributes:
        id: Group ID
        name: Group name
        timestamp_created: Creation timestamp
        user_ids: IDs of users of this group
    """

    id: int
    name: str
    timestamp_created: datetime
    user_ids: Optional[list[int]] = None
    viewer_paths: list[str]

UserGroupUpdate

Bases: BaseModel

Schema for UserGroup update

Source code in fractal_server/app/schemas/user_group.py
59
60
61
62
63
64
65
66
67
68
69
70
71
class UserGroupUpdate(BaseModel, extra=Extra.forbid):
    """
    Schema for `UserGroup` update
    """

    viewer_paths: Optional[list[str]] = None

    @validator("viewer_paths")
    def viewer_paths_validator(cls, value):
        for i, path in enumerate(value):
            value[i] = val_absolute_path(f"viewer_paths[{i}]")(path)
        value = val_unique_list("viewer_paths")(value)
        return value