-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adjusted SCIM templates and added Resource Type Template
- Loading branch information
1 parent
d9413af
commit 11cea33
Showing
7 changed files
with
110 additions
and
10 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,40 @@ | ||
from server.scim.schema_template import SCIM_SCHEMA_CORE, SCIM_API_MESSAGES | ||
|
||
|
||
def _resource_type(name): | ||
return { | ||
"description": f"Defined resource types for the {name} schema", | ||
"endpoint": f"/{name}s", | ||
"id": f"{name}", | ||
"meta": { | ||
"location": f"/ResourceTypes/{name}", | ||
"resourceType": "ResourceType" | ||
}, | ||
"name": f"{name}", | ||
"schema": f"{SCIM_SCHEMA_CORE}:{name}", | ||
"schemas": [ | ||
f"{SCIM_SCHEMA_CORE}:ResourceType" | ||
] | ||
} | ||
|
||
|
||
def resource_type_user_template(): | ||
return _resource_type("User") | ||
|
||
|
||
def resource_type_group_template(): | ||
return _resource_type("Group") | ||
|
||
|
||
def resource_type_template(): | ||
resources = [resource_type_user_template(), resource_type_group_template()] | ||
|
||
return { | ||
"schemas": [ | ||
f"{SCIM_API_MESSAGES}:ListResponse" | ||
], | ||
"totalResults": len(resources), | ||
"startIndex": 1, | ||
"itemsPerPage": len(resources), | ||
"Resources": resources | ||
} |
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,17 @@ | ||
summary: "Get Resource Types." | ||
description: "Retrieves the SCIM Resource Types provided by SRAM." | ||
|
||
tags: | ||
- "SCIM Services" | ||
|
||
consumes: | ||
- "application/json" | ||
|
||
produces: | ||
- "application/json" | ||
|
||
responses: | ||
200: | ||
description: All users | ||
schema: | ||
$ref: "/swagger/schemas/ScimResourceTypes.yml" |
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,25 @@ | ||
--- | ||
type: object | ||
properties: | ||
itemsPerPage: | ||
type: number | ||
description: "Number of item per page" | ||
example: 15 | ||
startIndex: | ||
type: number | ||
description: "Zero-based start index of the result for pagination" | ||
example: 0 | ||
totalResults: | ||
type: number | ||
description: "Total number of results" | ||
example: 15 | ||
schemas: | ||
type: array | ||
description: "SCIM schema's" | ||
items: | ||
type: string | ||
example: "urn:ietf:params:scim:api:messages:2.0:ListResponse" | ||
Resources: | ||
type: array | ||
items: | ||
type: object |