-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[VERY EARLY DRAFT - DO NOT MERGE] AAP integration
Signed-off-by: Djebran Lezzoum <ldjebran@gmail.com>
- Loading branch information
Showing
10 changed files
with
80 additions
and
14 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 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 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,35 @@ | ||
from ansible_base.resource_registry.registry import ( | ||
ResourceConfig, | ||
ServiceAPIConfig, | ||
SharedResource, | ||
) | ||
from ansible_base.resource_registry.shared_types import UserType | ||
from ansible_base.resource_registry.utils.resource_type_processor import ( | ||
ResourceTypeProcessor, | ||
) | ||
from django.contrib.auth import get_user_model | ||
|
||
|
||
class UserProcessor(ResourceTypeProcessor): | ||
def pre_serialize_additional(self): | ||
# These fields aren't supported in app, so we'll set them to blank | ||
setattr(self.instance, "external_auth_provider", None) | ||
setattr(self.instance, "external_auth_uid", None) | ||
setattr(self.instance, "organizations", []) | ||
setattr(self.instance, "organizations_administered", []) | ||
|
||
return self.instance | ||
|
||
|
||
class APIConfig(ServiceAPIConfig): | ||
custom_resource_processors = {"shared.user": UserProcessor} | ||
service_type = "lightspeed" | ||
|
||
|
||
RESOURCE_LIST = [ | ||
ResourceConfig( | ||
get_user_model(), | ||
shared_resource=SharedResource(serializer=UserType, is_provider=False), | ||
name_field="username", | ||
), | ||
] |
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 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 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 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 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 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 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