Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export default function setup() {
[],
deploymentTypes
);
// TO DO: adding a realm option to export all-static for specific realm
program
.description('Export all static config.')
.action(async (host, realm, user, password, options, command) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export default function setup() {
[],
deploymentTypes
);
// TO DO: Adding a realm option to export all config for a specific realm
program
.description('Export all config.')
.addOption(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ export default function setup() {

program
.description('Export authentication objects.')
.addOption(
new Option(
'-r, --realm <realm>',
'Specifies the realm to export from. Only the entity object from this realm will be exported.'
)
)
.action(async (host, realm, user, password, options, command) => {
command.handleDefaultArgsAndOpts(
host,
Expand All @@ -38,9 +32,6 @@ export default function setup() {
options,
command
);
if (options.realm) {
realm = options.realm;
}
if (await getTokens(false, true, deploymentTypes)) {
verboseMessage('Exporting config entity authentication');
const outcome = await configManagerExportAuthentication(realm);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ export default function setup() {

program
.description('Export authorization policies from realm.')
.addOption(
new Option(
'-r, --realm <realm>',
'Specifies the realm to export from. Only policy sets from this realm will be exported. Ignored with -f'
)
)
.addOption(
new Option(
'-n, --policy-name <policy-set-name>',
Expand Down Expand Up @@ -79,11 +73,6 @@ export default function setup() {
command
);

// -r/--realm flag has precedence over [realm] arguement
if (options.realm) {
realm = options.realm;
}

if (await getTokens(false, true, deploymentTypes)) {
let outcome: boolean;

Expand Down Expand Up @@ -141,7 +130,7 @@ export default function setup() {
outcome = await configManagerExportAuthzPolicySets(options.file);
}

// -r/--realm
// realm argument
else if (realm !== constants.DEFAULT_REALM_KEY) {
printMessage(
`Exporting all the policy sets in the ${state.getRealm()} realm.`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ export default function setup() {
'Journey name, It only export the journey with the name.'
)
)
.addOption(
new Option(
'-r, --realm <realm>',
'Specific realm to get journeys from (overrides environment)'
)
)
.addOption(new Option('-d, --pull-dependencies', 'Pull dependencies.'))
// TO DO: implementing for 'clean'
// .addOption(
Expand All @@ -49,9 +43,6 @@ export default function setup() {
options,
command
);
if (options.realm) {
realm = options.realm;
}

if (await getTokens(false, true, deploymentTypes)) {
verboseMessage('Exporting config entity journeys');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ export default function setup() {

program
.description('Export OAuth2 Agents')
.addOption(
new Option(
'-r, --realm <realm>',
'Specifies the realm to export from. Only the agents from this realm will be exported.'
)
)
.addOption(
new Option(
'-n, --agent-name <agent name>',
Expand Down Expand Up @@ -94,11 +88,6 @@ export default function setup() {
command
);

// -r/--realm flag has precedence over [realm] arguement
if (options.realm) {
realm = options.realm;
}

if (await getTokens(false, true, deploymentTypes)) {
let outcome: boolean;

Expand Down Expand Up @@ -152,7 +141,7 @@ export default function setup() {
outcome = await configManagerExportConfigAgents(options.file);
}

// -r/--realm
// realm arugment
else if (realm !== constants.DEFAULT_REALM_KEY) {
printMessage(
`Exporting all the agents from the ${state.getRealm()} realm.`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { frodo } from '@rockcarver/frodo-lib';
import { Option } from 'commander';

import {
configManagerExportOrgPrivileges,
Expand Down Expand Up @@ -28,12 +27,6 @@ export default function setup() {

program
.description('Export organization privileges config.')
.addOption(
new Option(
'-r, --realm <realm>',
'Specifies the realm to export from. Only the entity object from this realm will be exported.'
)
)
.action(async (host, realm, user, password, options, command) => {
command.handleDefaultArgsAndOpts(
host,
Expand All @@ -44,11 +37,6 @@ export default function setup() {
command
);

// -r flag has precedence
if (options.realm) {
realm = options.realm;
}

if (await getTokens(false, true, deploymentTypes)) {
let outcome: boolean;
if (realm !== constants.DEFAULT_REALM_KEY) {
Expand All @@ -57,7 +45,7 @@ export default function setup() {
);
outcome =
(await configManagerExportOrgPrivileges()) &&
(await configManagerExportOrgPrivilegesRealm(realm));
(await configManagerExportOrgPrivilegesRealm(realm));
} else {
printMessage(
'Exporting oranization privileges config from all realms'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ export default function setup() {

program
.description('Export password-policy objects.')
.addOption(
new Option(
'-r, --realm <realm>',
'Specifies the realm to export from. Only the entity object from this realm will be exported.'
)
)
.action(async (host, realm, user, password, options, command) => {
command.handleDefaultArgsAndOpts(
host,
Expand All @@ -38,9 +32,6 @@ export default function setup() {
options,
command
);
if (options.realm) {
realm = options.realm;
}
if (await getTokens(false, true, deploymentTypes)) {
verboseMessage('Exporting config entity password-policy');
const outcome = await configManagerExportPasswordPolicy(realm);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@ export default function setup() {
options,
command
);
if (options.realm) {
realm = options.realm;
}

if (await getTokens(false, true, deploymentTypes)) {
verboseMessage('Exporting config entity saml');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@ export default function setup() {

program
.description('Export authorization scripts.')
.addOption(
new Option(
'-r, --realm <realm>',
'Specifies the realm to export from. Only the scripts from this realm will be exported.'
)
)
.addOption(
new Option(
'-n, --script-name <script name>',
Expand Down Expand Up @@ -109,11 +103,6 @@ export default function setup() {
command
);

// -r/--realm flag has precedence over [realm] arguement
if (options.realm) {
realm = options.realm;
}

const hasOptions: boolean =
options.language ||
options.scriptType ||
Expand Down Expand Up @@ -170,7 +159,7 @@ export default function setup() {
}
}

// -r/--realm
// realm argument
else if (realm !== constants.DEFAULT_REALM_KEY) {
printMessage(
`Exporting scripts from the ${state.getRealm()} realm${hasOptions ? ' with custom options.' : '.'}`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ export default function setup() {
'Name of the secret mapping, It will only export secret mapping with the name. Works both with mapping._id or alias. '
)
)
.addOption(
new Option(
'-r, --realm <realm>',
'Specific realm to get secret mappings from (overrides environment)'
)
)
.action(async (host, realm, user, password, options, command) => {
command.handleDefaultArgsAndOpts(
host,
Expand All @@ -44,9 +38,6 @@ export default function setup() {
options,
command
);
if (options.realm) {
realm = options.realm;
}

if (await getTokens(false, true, deploymentTypes)) {
verboseMessage('Exporting config entity secret-mappings');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ export default function setup() {
'Service name, It only export the service with the name.'
)
)
.addOption(
new Option('-r, --realm <realm>', 'Specific realm to get service from')
)

.action(async (host, realm, user, password, options, command) => {
command.handleDefaultArgsAndOpts(
Expand All @@ -43,10 +40,6 @@ export default function setup() {
command
);

if (options.realm) {
realm = options.realm;
}

if (await getTokens(false, true, deploymentTypes)) {
verboseMessage('Exporting services');
const outcome = await configManagerExportServices(realm, options.name);
Expand Down
13 changes: 10 additions & 3 deletions src/configManagerOps/FrConfigOrgPrivilegesOps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,18 @@ export async function configManagerExportOrgPrivilegesRealm(
realm: string
): Promise<boolean> {
try {
const realmPrivileges: IdObjectSkeletonInterface =
await config.readConfigEntity(`${realm}OrgPrivileges`);
let realmPrivileges: IdObjectSkeletonInterface
let realmFileName: string
if (realm === '/') {
realmPrivileges = await config.readConfigEntity(`privileges`);
realmFileName = 'privileges'
} else {
realmPrivileges = await config.readConfigEntity(`${realm}OrgPrivileges`);
realmFileName = `${realm}OrgPrivileges`
}
saveJsonToFile(
realmPrivileges,
getFilePath(`org-privileges/${realm}OrgPrivileges.json`, true),
getFilePath(`org-privileges/${realmFileName}.json`, true),
false,
true
);
Expand Down
7 changes: 4 additions & 3 deletions src/configManagerOps/FrConfigServiceOps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { frodo, state } from '@rockcarver/frodo-lib';

import { printError } from '../utils/Console';
import { realmList } from '../utils/FrConfig';
import { FullService } from '@rockcarver/frodo-lib/types/api/ServiceApi';

const { getFilePath, saveJsonToFile } = frodo.utils;
const { getFullServices } = frodo.service;
Expand All @@ -11,8 +12,8 @@ const { getFullServices } = frodo.service;
* @returns {Promise<boolean>} true if successful, false otherwise
*/
export async function configManagerExportServices(
realm?,
name?
realm?: string,
name?: string
): Promise<boolean> {
try {
if (realm && realm !== '__default__realm__') {
Expand All @@ -32,7 +33,7 @@ export async function configManagerExportServices(
return false;
}

async function processServices(services, realm, name) {
async function processServices(services: FullService[], realm: string, name: string) {
const fileDir = `realms/${realm}/services`;
for (const service of services) {
if (name && name !== service._type._id) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing

exports[`CLI help interface for 'config export' should be expected english 1`] = `
"Usage: frodo config-manager pull all-static [options] [host] [realm] [username] [password]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing

exports[`CLI help interface for 'config export' should be expected english 1`] = `
"Usage: frodo config-manager pull all [options] [host] [realm] [username] [password]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing

exports[`CLI help interface for 'config export' should be expected english 1`] = `
"Usage: frodo config-manager pull authentication [options] [host] [realm] [username] [password]

[Experimental] Export authentication objects.

Arguments:
host AM base URL, e.g.: https://cdk.iam.example.com/am. To use
a connection profile, just specify a unique substring or
alias.
realm Realm. Specify realm as '/' for the root realm or 'realm'
or '/parent/child' otherwise. (default: "alpha" for
Identity Cloud tenants, "/" otherwise.)
username Username to login with. Must be an admin user with
appropriate rights to manage authentication
journeys/trees.
password Password.
host AM base URL, e.g.: https://cdk.iam.example.com/am. To use a
connection profile, just specify a unique substring or
alias.
realm Realm. Specify realm as '/' for the root realm or 'realm' or
'/parent/child' otherwise. (default: "alpha" for Identity
Cloud tenants, "/" otherwise.)
username Username to login with. Must be an admin user with
appropriate rights to manage authentication journeys/trees.
password Password.

Options:
-r, --realm <realm> Specifies the realm to export from. Only the entity
object from this realm will be exported.
-h, --help Help
-hh, --help-more Help with all options.
-hhh, --help-all Help with all options, environment variables, and usage
examples.
-h, --help Help
-hh, --help-more Help with all options.
-hhh, --help-all Help with all options, environment variables, and usage
examples.
"
`;
Loading