-
Notifications
You must be signed in to change notification settings - Fork 5.6k
[Components] pingone - WIP #15068
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jcortes
wants to merge
1
commit into
master
Choose a base branch
from
pingone-new-components
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[Components] pingone - WIP #15068
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,84 @@ | ||
| import app from "../../pingone.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "pingone-create-user", | ||
| name: "Create User", | ||
| description: "Creates a new user in PingOne. [See the documentation](https://apidocs.pingidentity.com/pingone/platform/v1/api/#post-create-user).", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| username: { | ||
| propDefinition: [ | ||
| app, | ||
| "username", | ||
| ], | ||
| }, | ||
| email: { | ||
| propDefinition: [ | ||
| app, | ||
| "email", | ||
| ], | ||
| }, | ||
| givenName: { | ||
| propDefinition: [ | ||
| app, | ||
| "givenName", | ||
| ], | ||
| }, | ||
| familyName: { | ||
| propDefinition: [ | ||
| app, | ||
| "familyName", | ||
| ], | ||
| }, | ||
| department: { | ||
| propDefinition: [ | ||
| app, | ||
| "department", | ||
| ], | ||
| }, | ||
| locales: { | ||
| propDefinition: [ | ||
| app, | ||
| "locales", | ||
| ], | ||
| }, | ||
| }, | ||
| methods: { | ||
| createUser(args = {}) { | ||
| return this.app.post({ | ||
| path: "/users", | ||
| ...args, | ||
| }); | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const { | ||
| createUser, | ||
| username, | ||
| email, | ||
| givenName, | ||
| familyName, | ||
| department, | ||
| locales, | ||
| } = this; | ||
|
|
||
| const response = await createUser({ | ||
| $, | ||
| data: { | ||
| username, | ||
| email, | ||
| name: { | ||
| given: givenName, | ||
| family: familyName, | ||
| }, | ||
| department, | ||
| locales, | ||
| }, | ||
| }); | ||
|
|
||
| $.export("$summary", "Successfully created user."); | ||
| return response; | ||
| }, | ||
| }; |
This file contains hidden or 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,93 @@ | ||
| import app from "../../pingone.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "pingone-update-user", | ||
| name: "Update User in PingOne", | ||
| description: "Update an existing user's attributes in PingOne. [See the documentation](https://apidocs.pingidentity.com/pingone/platform/v1/api/#patch-update-user).", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| userId: { | ||
| propDefinition: [ | ||
| app, | ||
| "userId", | ||
| ], | ||
| }, | ||
| username: { | ||
| optional: false, | ||
| propDefinition: [ | ||
| app, | ||
| "username", | ||
| ], | ||
| }, | ||
| email: { | ||
| propDefinition: [ | ||
| app, | ||
| "email", | ||
| ], | ||
| }, | ||
| givenName: { | ||
| propDefinition: [ | ||
| app, | ||
| "givenName", | ||
| ], | ||
| }, | ||
| familyName: { | ||
| propDefinition: [ | ||
| app, | ||
| "familyName", | ||
| ], | ||
| }, | ||
| department: { | ||
| propDefinition: [ | ||
| app, | ||
| "department", | ||
| ], | ||
| }, | ||
| locales: { | ||
| propDefinition: [ | ||
| app, | ||
| "locales", | ||
| ], | ||
| }, | ||
| }, | ||
| methods: { | ||
| updateUser({ | ||
| userId, ...args | ||
| } = {}) { | ||
| return this.app.patch({ | ||
| path: `/users/${userId}`, | ||
| ...args, | ||
| }); | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const { | ||
| updateUser, | ||
| userId, | ||
| username, | ||
| email, | ||
| givenName, | ||
| familyName, | ||
| department, | ||
| locales, | ||
| } = this; | ||
|
|
||
| const response = await updateUser({ | ||
| $, | ||
| userId, | ||
| data: { | ||
| username, | ||
| email, | ||
| givenName, | ||
| familyName, | ||
| department, | ||
| locales, | ||
| }, | ||
| }); | ||
|
|
||
| $.export("$summary", "Successfully updated user."); | ||
| return response; | ||
| }, | ||
| }; |
This file contains hidden or 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,11 @@ | ||
| const BASE_URL = "https://api.pingone.com"; | ||
| const VERSION_PATH = "/v1"; | ||
| const ENV_PATH = "/environments"; | ||
| const SUBSCRIPTION_ID = "subscriptionId"; | ||
|
|
||
| export default { | ||
| BASE_URL, | ||
| VERSION_PATH, | ||
| ENV_PATH, | ||
| SUBSCRIPTION_ID, | ||
| }; |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,11 +1,191 @@ | ||
| import { axios } from "@pipedream/platform"; | ||
| import constants from "./common/constants.mjs"; | ||
|
|
||
| export default { | ||
| type: "app", | ||
| app: "pingone", | ||
| propDefinitions: {}, | ||
| propDefinitions: { | ||
| username: { | ||
| type: "string", | ||
| label: "Username", | ||
| description: "The user's username. This must either be a well-formed email address or another unique identifier.", | ||
| }, | ||
| email: { | ||
| type: "string", | ||
| label: "Email", | ||
| description: "The user's email address.", | ||
| optional: true, | ||
| }, | ||
| givenName: { | ||
| type: "string", | ||
| label: "First Name", | ||
| description: "The user's first name.", | ||
| optional: true, | ||
| }, | ||
| familyName: { | ||
| type: "string", | ||
| label: "Last Name", | ||
| description: "The user's last name.", | ||
| optional: true, | ||
| }, | ||
| department: { | ||
| type: "string", | ||
| label: "Department", | ||
| description: "The user's department. E.g., `Engineering`.", | ||
| optional: true, | ||
| }, | ||
| locales: { | ||
| type: "string[]", | ||
| label: "Locales", | ||
| description: "The user's locales. E.g., `London`.", | ||
| optional: true, | ||
| async options({ prevContext: { url } }) { | ||
| if (url === null) { | ||
| return []; | ||
| } | ||
| const { | ||
| _embedded: { languages }, | ||
| _links: { next }, | ||
| } = await this.listLanguages({ | ||
| url, | ||
| }); | ||
| return { | ||
| options: languages.map(({ name }) => name), | ||
| context: { | ||
| url: next?.href || null, | ||
| }, | ||
| }; | ||
| }, | ||
| }, | ||
| userId: { | ||
| type: "string", | ||
| label: "User ID", | ||
| description: "The unique identifier for the user.", | ||
| async options({ prevContext: { url } }) { | ||
| if (url === null) { | ||
| return []; | ||
| } | ||
| const { | ||
| _embedded: { users }, | ||
| _links: { next }, | ||
| } = await this.listUsers({ | ||
| url, | ||
| }); | ||
| return { | ||
| options: users.map(({ | ||
| id: value, username: label, | ||
| }) => ({ | ||
| label, | ||
| value, | ||
| })), | ||
| context: { | ||
| url: next?.href || null, | ||
| }, | ||
| }; | ||
| }, | ||
| }, | ||
| applicationId: { | ||
| type: "string", | ||
| label: "Application ID", | ||
| description: "The unique identifier for the application.", | ||
| async options({ prevContext: { url } }) { | ||
| if (url === null) { | ||
| return []; | ||
| } | ||
| const { | ||
| _embedded: { applications }, | ||
| _links: { next }, | ||
| } = await this.listApplications({ | ||
| url, | ||
| }); | ||
| return { | ||
| options: applications.map(({ | ||
| id: value, name: label, | ||
| }) => ({ | ||
| label, | ||
| value, | ||
| })), | ||
| context: { | ||
| url: next?.href || null, | ||
| }, | ||
| }; | ||
| }, | ||
| }, | ||
| userAttributes: { | ||
| type: "object", | ||
| label: "User Attributes", | ||
| description: "The attributes to update the user with.", | ||
| optional: true, | ||
| }, | ||
| groupId: { | ||
| type: "string", | ||
| label: "Group ID", | ||
| description: "The unique identifier for the group.", | ||
| optional: true, | ||
| }, | ||
| status: { | ||
| type: "string", | ||
| label: "User Status", | ||
| description: "The current status of the user, e.g., active, inactive.", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| methods: { | ||
| // this.$auth contains connected account data | ||
| authKeys() { | ||
| console.log(Object.keys(this.$auth)); | ||
| getUrl(path) { | ||
| return `${constants.BASE_URL}${constants.VERSION_PATH}${constants.ENV_PATH}/${this.$auth.environment_id}${path}`; | ||
| }, | ||
| getHeaders(headers) { | ||
| return { | ||
| "Content-Type": "application/json", | ||
| "Authorization": `Bearer ${this.$auth.oauth_access_token}`, | ||
| ...headers, | ||
| }; | ||
| }, | ||
| _makeRequest({ | ||
| $ = this, url, path, headers, ...args | ||
| } = {}) { | ||
| return axios($, { | ||
| ...args, | ||
| debug: true, | ||
| url: url || this.getUrl(path), | ||
| headers: this.getHeaders(headers), | ||
| }); | ||
| }, | ||
| post(args = {}) { | ||
| return this._makeRequest({ | ||
| method: "POST", | ||
| ...args, | ||
| }); | ||
| }, | ||
| patch(args = {}) { | ||
| return this._makeRequest({ | ||
| method: "PATCH", | ||
| ...args, | ||
| }); | ||
| }, | ||
| delete(args = {}) { | ||
| return this._makeRequest({ | ||
| method: "DELETE", | ||
| ...args, | ||
| }); | ||
| }, | ||
| listUsers(args = {}) { | ||
| return this._makeRequest({ | ||
| path: "/users", | ||
| ...args, | ||
| }); | ||
| }, | ||
| listApplications(args = {}) { | ||
| return this._makeRequest({ | ||
| path: "/applications", | ||
| ...args, | ||
| }); | ||
| }, | ||
| listLanguages(args = {}) { | ||
| return this._makeRequest({ | ||
| path: "/languages", | ||
| ...args, | ||
| }); | ||
| }, | ||
| }, | ||
| }; | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure safe handling of sensitive data in debug logs
Setting
debug: truein_makeRequest()(line 149) could potentially log sensitive information. Make sure no confidential data (like OAuth tokens or user PII) is exposed in the logs.