-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Functionality and tests for OCM integration
There's a lot here, and it's a bit of a mess. We needed some additional views for internal users who want to use RBAC's format without necessarily all of the functionality. Originally, attempts were made at using a redirect to get the requests into our normal flow, but this resulted in multiple passes through multiple middleware, so now I'm attempting to just re-use our normal views with the new request data. Signed-off-by: Chris Mitchell <[email protected]>
- Loading branch information
1 parent
1853e7c
commit b207668
Showing
9 changed files
with
81 additions
and
80 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
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 |
---|---|---|
|
@@ -37,21 +37,36 @@ def process_request(self, request): # pylint: disable=no-self-use | |
""" | ||
if hasattr(request, "META"): | ||
identity_header = { | ||
"identity": { | ||
"account_number": "10001", | ||
"org_id": "11111", | ||
"type": "Associate", | ||
"associate": { | ||
"username": "user_dev", | ||
"email": "[email protected]", | ||
"is_org_admin": True, | ||
"is_internal": True, | ||
"user_id": "51736777", | ||
}, | ||
"internal": {"cross_access": False}, | ||
user_type = request.headers.get("User-Type") | ||
if user_type and user_type in ["associate", "internal", "turnpike"]: | ||
identity_header = { | ||
"identity": { | ||
"associate": { | ||
"Role": ["role"], | ||
"email": "[email protected]", | ||
"givenName": "Associate", | ||
"surname": "dev", | ||
}, | ||
"auth_type": "saml-auth", | ||
"type": "Associate", | ||
} | ||
} | ||
else: | ||
identity_header = { | ||
"identity": { | ||
"account_number": "10001", | ||
"org_id": "11111", | ||
"type": "User", | ||
"user": { | ||
"username": "user_dev", | ||
"email": "[email protected]", | ||
"is_org_admin": True, | ||
"is_internal": True, | ||
"user_id": "51736777", | ||
}, | ||
"internal": {"cross_access": False}, | ||
} | ||
} | ||
} | ||
json_identity = json_dumps(identity_header) | ||
dev_header = b64encode(json_identity.encode("utf-8")) | ||
request.META[self.header] = dev_header |
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