Skip to content

Commit

Permalink
Added ux.table to permset/assign.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
Venkat Polisetti authored and Venkat Polisetti committed Nov 27, 2018
1 parent d09605a commit 242eac7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 38 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ crm-sfdx-plugin

[![Version](https://img.shields.io/npm/v/@venkat.polisetti/crm-sfdx-plugin.svg)](https://npmjs.org/package/@venkat.polisetti/crm-sfdx-plugin)
[![Downloads/week](https://img.shields.io/npm/dw/@venkat.polisetti/crm-sfdx-plugin.svg)](https://npmjs.org/package/@venkat.polisetti/crm-sfdx-plugin)
[![License](https://img.shields.io/npm/l/@venkat.polisetti/crm-sfdx-plugin.svg)](https://github.com/ecrm-plugins/@venkat.polisetti/crm-sfdx-plugin/blob/master/package.json)
[![License](https://img.shields.io/npm/l/@venkat.polisetti/crm-sfdx-plugin.svg)](https://github.com/ecrm-plugins/crm-sfdx-plugin/blob/master/package.json)

<!-- install -->
```sh-session
Expand Down Expand Up @@ -61,7 +61,7 @@ EXAMPLE
--o='myuser@testorg.com'
```

_See code: [src/commands/crm/permset/assign.ts](https://github.com/venkatpolisetti/crm-sfdx-plugin/blob/v2.0.4/src/commands/crm/permset/assign.ts)_
_See code: [src/commands/crm/permset/assign.ts](https://github.com/venkatpolisetti/crm-sfdx-plugin/blob/v2.0.5/src/commands/crm/permset/assign.ts)_

## `sfdx crm:profile:fieldpermissions:set`

Expand Down Expand Up @@ -121,7 +121,7 @@ EXAMPLE
--readaccess=true --editaccess=false
```

_See code: [src/commands/crm/profile/fieldpermissions/set.ts](https://github.com/venkatpolisetti/crm-sfdx-plugin/blob/v2.0.4/src/commands/crm/profile/fieldpermissions/set.ts)_
_See code: [src/commands/crm/profile/fieldpermissions/set.ts](https://github.com/venkatpolisetti/crm-sfdx-plugin/blob/v2.0.5/src/commands/crm/profile/fieldpermissions/set.ts)_

## `sfdx crm:profile:objectpermissions:set`

Expand Down Expand Up @@ -180,7 +180,7 @@ EXAMPLE
--modifyallaccess=false
```

_See code: [src/commands/crm/profile/objectpermissions/set.ts](https://github.com/venkatpolisetti/crm-sfdx-plugin/blob/v2.0.4/src/commands/crm/profile/objectpermissions/set.ts)_
_See code: [src/commands/crm/profile/objectpermissions/set.ts](https://github.com/venkatpolisetti/crm-sfdx-plugin/blob/v2.0.5/src/commands/crm/profile/objectpermissions/set.ts)_

## `sfdx crm:profile:recordtypevisibilities:set`

Expand Down Expand Up @@ -223,5 +223,5 @@ EXAMPLE
"visible":true},{"name":"CustomObj__c.CustomRecType2", "visible":false}]'
```

_See code: [src/commands/crm/profile/recordtypevisibilities/set.ts](https://github.com/venkatpolisetti/crm-sfdx-plugin/blob/v2.0.4/src/commands/crm/profile/recordtypevisibilities/set.ts)_
<!-- commandsstop -->
_See code: [src/commands/crm/profile/recordtypevisibilities/set.ts](https://github.com/venkatpolisetti/crm-sfdx-plugin/blob/v2.0.5/src/commands/crm/profile/recordtypevisibilities/set.ts)_
<!-- commandsstop -->
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@venkat.polisetti/crm-sfdx-plugin",
"description": "Sfdx CLI plugin for automating mundane tasks such as setting FLS etc.,",
"version": "2.0.4",
"version": "2.0.5",
"author": "Venkat Polisetti",
"bugs": "https://github.com/venkatpolisetti/crm-sfdx-plugin/issues",
"dependencies": {
Expand Down
34 changes: 3 additions & 31 deletions src/commands/crm/permset/assign.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { core, flags, SfdxCommand } from '@salesforce/command';
import * as _ from 'lodash';
import chalk from 'chalk';
import { SaveResult } from 'jsforce';
import * as interfaces from '../../../shared/interfaces';
import * as profileInfo from '../../../shared/profile';

core.Messages.importMessagesDirectory(__dirname);
const messages = core.Messages.loadMessages('@venkat.polisetti/crm-sfdx-plugin', 'assign');
Expand Down Expand Up @@ -84,14 +81,12 @@ export default class assign extends SfdxCommand {

userResults.records.map((u:{Id, Name, Username}) => {
assignments.push({PermissionSetId:permsetId, AssigneeId: u.Id})
assignmentUserDetails.push({PermissionSetId:permsetId, UserId: u.Id, Name: u.Name, Username: u.Username});
assignmentUserDetails.push({"Permissionset Name": this.flags.permsetlabel, "Id":permsetId, "User Id": u.Id, "Name": u.Name, "Username": u.Username});
});

if (this.flags.verbose) {
this.ux.log('PermissionSet Name, PermissionSet Id, User Name, User Login');
assignmentUserDetails.forEach((a:{PermissionSetId, UserId, Name, Username}) => {
this.ux.log(`${this.flags.permsetlabel}, ${a.PermissionSetId}, ${a.Name}, ${a.Username}`);
});
const heading = ["Permissionset Name", "Id", "User Id", "Name", "Username"];
this.ux.table(assignmentUserDetails, heading);
}

if (this.flags.checkonly) {
Expand Down Expand Up @@ -138,29 +133,6 @@ export default class assign extends SfdxCommand {
this.ux.stopSpinner('done');
this.ux.log(chalk.greenBright('\nProcess Completed'));

/*
let results = await conn.sobject('PermissionSetAssignment').create(assignments);
let isSuccess: boolean = true;
if (Array.isArray(results)) {
results.forEach(r => {
if (r.success == false) {
isSuccess = false;
this.ux.log(r);
}
});
} else {
if (results.success == false) {
isSuccess = false;
this.ux.log(results);
}
}
if (isSuccess) {
this.ux.log(chalk.yellowBright('Processed Successfully'));
} else {
this.ux.log(chalk.redBright('\nFailed with errros. See above error messages'));
}
*/

return JSON.stringify(totalResults, null, 2);
}

Expand Down

0 comments on commit 242eac7

Please sign in to comment.