-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A lightweight user management kit definitions (#84)
* A lightweight user management kit definitions
- Loading branch information
Showing
7 changed files
with
118 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
File renamed without changes.
Empty file.
40 changes: 40 additions & 0 deletions
40
flux_sdk/user_management/capabilities/user_lifecycle_management/interface.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from abc import ABC, abstractmethod | ||
|
||
from flux_sdk.user_management.data_models.data_models import ( | ||
GetOrganizationsRequest, | ||
GetOrganizationsResponse, | ||
GetUsersRequest, | ||
GetUsersResponse, | ||
) | ||
|
||
|
||
class UserLifecycleManagement(ABC): | ||
""" | ||
This class represents the "user_lifecycle_management" capability. | ||
This capability is used to manage the lifecycle of users in the third-party system with supports including: | ||
- Getting user's organizations from the third-party system | ||
- Getting users from the third-party system | ||
""" | ||
|
||
@abstractmethod | ||
def get_users(self, request: GetUsersRequest) -> GetUsersResponse: | ||
""" | ||
A function that get users from the third-party system. | ||
Use this hook fetch users from the third-party system so that they can be matched with employees in Rippling. | ||
:param request: The request to get users from the third-party system. This request may contain the | ||
organizations to get users from. | ||
:return: The response containing the users from the third-party system. | ||
""" | ||
|
||
|
||
@abstractmethod | ||
def get_organizations(self, request: GetOrganizationsRequest) -> GetOrganizationsResponse: | ||
""" | ||
A function that get organizations from the third-party system. | ||
Use this hook to fetch organizations from the third-party system so that the organization information can be | ||
used to get users from the third-party system. | ||
:param request: The request to get organizations from the third-party system. | ||
:return: The response containing the organizations from the third-party system. | ||
""" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
from dataclasses import dataclass | ||
from typing import Optional | ||
|
||
|
||
@dataclass(kw_only=True) | ||
class Organization: | ||
""" | ||
This represents an organization in the third party system. | ||
An organization is used to group users in the third party system. | ||
Different third party systems may have different names of organizations: | ||
Github calls it "Organization", while Google Workspace calls it "Domain". | ||
""" | ||
|
||
id: str | ||
"""The unique identifier of the organization in the third party system.""" | ||
|
||
name: Optional[str] = None | ||
"""The name of the organization in the third party system.""" | ||
|
||
|
||
@dataclass(kw_only=True) | ||
class User: | ||
"""This represents a user in the third party system.""" | ||
|
||
id: Optional[str] = None | ||
"""The unique identifier of the user in the third party system. | ||
This field is required when getting users from the third party system.""" | ||
|
||
first_name: Optional[str] = None | ||
"""The first name of the user.""" | ||
|
||
middle_name: Optional[str] = None | ||
"""The middle name of the user.""" | ||
|
||
last_name: Optional[str] = None | ||
"""The last name of the user.""" | ||
|
||
email: Optional[str] = None | ||
"""The email address of the user.""" | ||
|
||
|
||
@dataclass(kw_only=True) | ||
class GetUsersRequest: | ||
"""This represents a request to get users from the third party system.""" | ||
|
||
organizations: Optional[list[Organization]] = None | ||
"""The organizations to get users from. If this field is not provided, | ||
the users from all organizations should be returned.""" | ||
|
||
|
||
@dataclass(kw_only=True) | ||
class GetUsersResponse: | ||
"""This represents a response containing the users from the third party system.""" | ||
|
||
users: list[User] | ||
"""The users from the third party system.""" | ||
|
||
|
||
@dataclass(kw_only=True) | ||
class GetOrganizationsRequest: | ||
"""This represents a request to get organizations from the third party system.""" | ||
|
||
pass | ||
|
||
|
||
@dataclass(kw_only=True) | ||
class GetOrganizationsResponse: | ||
"""This represents a response containing the organizations from the third party system.""" | ||
|
||
organizations: list[Organization] | ||
"""The organizations from the third party system.""" |