Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 93 additions & 0 deletions components/okta/actions/create-user/create-user.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
import { ConfigurationError } from "@pipedream/platform";
import okta from "../../okta.app.mjs";

export default {
key: "okta-create-user",
name: "Create User",
description: "Creates a new user in the Okta system. [See the documentation](https://developer.okta.com/docs/api/openapi/okta-management/management/tag/User/#tag/User/operation/createUser)",
version: "0.0.1",
type: "action",
props: {
okta,
activate: {
type: "boolean",
label: "Activate",
description: "Executes activation lifecycle operation when creating the user. Defaults to true.",
optional: true,
},
firstName: {
propDefinition: [
okta,
"firstName",
],
},
lastName: {
propDefinition: [
okta,
"lastName",
],
},
email: {
propDefinition: [
okta,
"email",
],
},
login: {
propDefinition: [
okta,
"login",
],
},
mobilePhone: {
propDefinition: [
okta,
"mobilePhone",
],
optional: true,
},
typeId: {
propDefinition: [
okta,
"typeId",
],
optional: true,
},
},
async run({ $ }) {
try {
const {
okta,
activate,
typeId,
...profile
} = this;

const data = {
profile,
};

if (typeId) {
data.type = {
id: this.typeId,
};
}

const response = await okta.createUser({
$,
data,
params: {
activate,
},
});

$.export("$summary", `Successfully created user with ID ${response.id}`);
return response;
} catch ({ message }) {
const messageError = JSON.parse(message);
throw new ConfigurationError(messageError.errorCauses.length
? messageError.errorCauses[0].errorSummary
: messageError.errorSummary);
}
},
};
26 changes: 26 additions & 0 deletions components/okta/actions/get-user/get-user.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import okta from "../../okta.app.mjs";

export default {
key: "okta-get-user",
name: "Get User",
description: "Fetches the information of a specific user from the Okta system. [See the documentation](https://developer.okta.com/docs/api/openapi/okta-management/management/tag/User/#tag/User/operation/getUser)",
version: "0.0.1",
type: "action",
props: {
okta,
userId: {
propDefinition: [
okta,
"userId",
],
},
},
async run({ $ }) {
const response = await this.okta.getUser({
$,
userId: this.userId,
});
$.export("$summary", `Successfully fetched user details for user ID ${this.userId}`);
return response;
},
};
93 changes: 93 additions & 0 deletions components/okta/actions/update-user/update-user.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
import okta from "../../okta.app.mjs";

export default {
key: "okta-update-user",
name: "Update User",
description: "Updates the profile of a specific user in the Okta system. [See the documentation](https://developer.okta.com/docs/api/openapi/okta-management/management/tag/User/#tag/User/operation/updateUser)",
version: "0.0.1",
type: "action",
props: {
okta,
userId: {
propDefinition: [
okta,
"userId",
],
},
firstName: {
propDefinition: [
okta,
"firstName",
],
optional: true,
},
lastName: {
propDefinition: [
okta,
"lastName",
],
optional: true,
},
email: {
propDefinition: [
okta,
"email",
],
optional: true,
},
login: {
propDefinition: [
okta,
"login",
],
optional: true,
},
mobilePhone: {
propDefinition: [
okta,
"mobilePhone",
],
optional: true,
},
typeId: {
propDefinition: [
okta,
"typeId",
],
optional: true,
},
},
async run({ $ }) {
const {
okta,
userId,
typeId,
...profile
} = this;

const { profile: userProfile } = await okta.getUser({
userId,
});

const response = await okta.updateUser({
$,
userId,
data: {
profile: {
...userProfile,
...profile,
},
...(typeId
? {
type: {
id: this.typeId,
},
} :
{}),
},
});

$.export("$summary", `Successfully updated user with ID ${userId}`);
return response;
},
};
1 change: 1 addition & 0 deletions components/okta/common/constants.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const LIMIT = 1000;
Loading