-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Poke plugin to disable SSO enforcement (#9129)
- Loading branch information
Showing
3 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
front/lib/api/poke/plugins/workspaces/disable_sso_enforcement.ts
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,44 @@ | ||
import { Err, Ok } from "@dust-tt/types"; | ||
|
||
import { createPlugin } from "@app/lib/api/poke/types"; | ||
import { disableSSOEnforcement } from "@app/lib/api/workspace"; | ||
|
||
export const disableSSOPlugin = createPlugin( | ||
{ | ||
id: "disable-sso", | ||
name: "Disable SSO Enforcement", | ||
description: "Disable SSO enforcement on a workspace", | ||
resourceTypes: ["workspaces"], | ||
args: { | ||
force: { | ||
type: "boolean", | ||
label: "Force", | ||
description: "Are you sure?", | ||
}, | ||
}, | ||
}, | ||
async (auth, _, args) => { | ||
const workspace = auth.workspace(); | ||
if (!workspace) { | ||
return new Err(new Error("Cannot find workspace.")); | ||
} | ||
|
||
const { force } = args; | ||
if (!force) { | ||
return new Err( | ||
new Error("You must confirm that you want to disable SSO enforcement.") | ||
); | ||
} | ||
|
||
const res = await disableSSOEnforcement(workspace); | ||
|
||
if (res.isErr()) { | ||
return new Err(res.error); | ||
} | ||
|
||
return new Ok({ | ||
display: "text", | ||
value: "SSO enforcement disabled.", | ||
}); | ||
} | ||
); |
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