Skip to content
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

New Components - onelogin #15611

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
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
170 changes: 170 additions & 0 deletions components/onelogin/actions/create-user/create-user.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
import { ConfigurationError } from "@pipedream/platform";
import { parseObject } from "../../common/utils.mjs";
import onelogin from "../../onelogin.app.mjs";

export default {
key: "onelogin-create-user",
name: "Create User",
description: "Creates a new user in OneLogin. [See the documentation](https://developers.onelogin.com/api-docs/1/users/create-user)",
version: "0.0.{{ts}}",

Check warning on line 9 in components/onelogin/actions/create-user/create-user.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

{{ts}} macro should be removed before committing
type: "action",
props: {
onelogin,
firstname: {
propDefinition: [
onelogin,
"firstname",
],
},
lastname: {
propDefinition: [
onelogin,
"lastname",
],
},
email: {
propDefinition: [
onelogin,
"email",
],
optional: true,
},
username: {
propDefinition: [
onelogin,
"username",
],
optional: true,
},
company: {
propDefinition: [
onelogin,
"company",
],
optional: true,
},
department: {
propDefinition: [
onelogin,
"department",
],
optional: true,
},
directoryId: {
propDefinition: [
onelogin,
"directoryId",
],
optional: true,
},
distinguishedName: {
propDefinition: [
onelogin,
"distinguishedName",
],
optional: true,
},
externalId: {
propDefinition: [
onelogin,
"externalId",
],
optional: true,
},
groupId: {
propDefinition: [
onelogin,
"groupId",
],
optional: true,
},
invalidLoginAttempts: {
propDefinition: [
onelogin,
"invalidLoginAttempts",
],
optional: true,
},
localeCode: {
propDefinition: [
onelogin,
"localeCode",
],
optional: true,
},
memberOf: {
propDefinition: [
onelogin,
"memberOf",
],
optional: true,
},
openidName: {
propDefinition: [
onelogin,
"openidName",
],
optional: true,
},
phone: {
propDefinition: [
onelogin,
"phone",
],
optional: true,
},
samaccountname: {
propDefinition: [
onelogin,
"samaccountname",
],
optional: true,
},
title: {
propDefinition: [
onelogin,
"title",
],
optional: true,
},
customAttributes: {
propDefinition: [
onelogin,
"customAttributes",
],
optional: true,
},
},
async run({ $ }) {
if (!this.email && !this.username) {
throw new ConfigurationError("Either email or username must be provided.");
}

const response = await this.onelogin.createUser({
$,
data: {
firstname: this.firstname,
lastname: this.lastname,
email: this.email,
username: this.username,
company: this.company,
department: this.department,
directory_id: this.directoryId,
distinguished_name: this.distinguishedName,
external_id: this.externalId,
group_id: this.groupId,
invalid_login_attempts: this.invalidLoginAttempts,
locale_code: this.localeCode,
member_of: this.memberOf,
openid_name: this.openidName,
phone: this.phone,
samaccountname: this.samaccountname,
title: this.title,
custom_attributes: parseObject(this.customAttributes),
},
});

$.export("$summary", `Created user ${response.username} with ID ${response.id}`);
return response;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import onelogin from "../../onelogin.app.mjs";

export default {
key: "onelogin-revoke-user-sessions",
name: "Revoke User Sessions",
description: "Revokes all active sessions for a specified user in OneLogin. [See the documentation]()",
version: "0.0.{{ts}}",

Check warning on line 7 in components/onelogin/actions/revoke-user-sessions/revoke-user-sessions.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

{{ts}} macro should be removed before committing
type: "action",
props: {
onelogin,
revokeUserId: {
propDefinition: [
onelogin,
"revokeUserId",
],
},
},
async run({ $ }) {
const response = await this.onelogin.revokeUserSessions(this.revokeUserId);
$.export("$summary", `Successfully revoked sessions for user ID ${this.revokeUserId}`);
return response;
},
};
Loading
Loading