Skip to content

Commit

Permalink
Merge pull request #44 from hudec117/dev
Browse files Browse the repository at this point in the history
1.2.3 Hotfix
  • Loading branch information
hudec117 authored Jun 16, 2022
2 parents 8a95636 + 1d4ec2b commit 76479bb
Show file tree
Hide file tree
Showing 9 changed files with 204 additions and 105 deletions.
22 changes: 3 additions & 19 deletions PUBLISHING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,20 @@
- Ensure the version in `manifest.json` and `package.json` is updated.

## Chrome
1. Build production version by running `npm run build` in `src` folder.
1. Build production version by running `npm run prod` in `src` folder.
2. Copy `report.html`, `icons`, `background.js`, `content-script.js`, `manifest.json` and (optionally) `build.js.map` from the `src` folder into the new `dist` folder.
3. Side load the `dist` folder into Chrome and test it works correctly.
4. Zip up all the files inside the `dist` folder and name it `salesforce-user-perm-report-VERSION-chrome.zip`
5. Upload new version to Chrome Developer Dashboard

## Edge

1. Build production version by running `npm run build` in `src` folder.
1. Build production version by running `npm run prod` in `src` folder.
2. Copy `report.html`, `icons`, `background.js`, `content-script.js`, `manifest.json` and (optionally) `build.js.map` from the `src` folder into the new `dist` folder.
3. Add the following line to `manifest.json`
```json
"update_URL": "https://edge.microsoft.com/extensionwebstorebase/v1/crx",
```
4. Side load the `dist` folder into Edge and test it works correctly.
5. Zip up all the files inside the `dist` folder and name it `salesforce-user-perm-report-VERSION-edge.zip`
6. Upload new version to Microsoft Partner Center

## Opera (incl OperaGX)

1. Build production version by running `npm run build` in `src` folder.
2. Copy `report.html`, `icons`, `background.js`, `content-script.js`, `manifest.json` and (optionally) `build.js.map` from the `src` folder into the new `dist` folder.
3. Replace `minimum_chrome_version` with the following in `manifest.json`
```json
"minimum_opera_version": "74",
```
4. Side load the `dist` folder into Opera and OperaGX and test it works correctly.
5. Zip up all the files inside the `dist` folder and name it `salesforce-user-perm-report-VERSION-opera.zip`
6. Upload new version to TODO

## Firefox

At the time of writing, Firefox has not yet implemented support for manifest v3 and therefore this extension is not compatible with Firefox.
6. Upload new version to Microsoft Partner Center
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ Features

Roadmap
- ✅ Edge support
- 🔄 Opera support
- 🔄 Firefox support
- 🔄 Various QoL & UI improvements
- ✅ Various QoL & UI improvements
- 🔄 Firefox support (likely next year when Firefox adds manifest v3 support)
- Modifying & saving permissions
- Toggle between labels and full names
- Toggle showing only granted permissions
Expand Down Expand Up @@ -87,9 +86,9 @@ Navigate to any user detail record in Classic or Lightning and click the "Open P

<br />

**Q**: Is this extension available on Edge/Firefox/Safari?
**Q**: Is this extension available on Firefox/Safari?

**A**: I plan on making the extension available on the latest Edge and Firefox versions. I do not have a Mac so I'm not planning for Safari support.
**A**: I plan on making the extension available on Firefox. I do not have a Mac so I'm not planning for Safari support.

## Support

Expand Down
204 changes: 135 additions & 69 deletions src/front-end/App.vue

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions src/front-end/components/MetadataTypeCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
'flowAccesses': 'Flow Accesses',
'pageAccesses': 'Visualforce Accesses',
'recordTypeVisibilities': 'Record Type Visibilities',
'categoryGroupVisibilities': 'Category Group Visibilities',
'loginFlows': 'Login Flows'
'categoryGroupVisibilities': 'Category Group Visibilities'
};
export default {
Expand Down
1 change: 0 additions & 1 deletion src/front-end/components/Table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
watch: {
tree: function() {
this.metadataTypes = [];
this.permissionSetNames = [];
for (const typeName of Object.keys(this.tree)) {
const metadataTypeRow = {
Expand Down
62 changes: 57 additions & 5 deletions src/front-end/services/SalesforceService.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const METADATA_ENDPOINT = '/services/Soap/m/54.0';
const PARTNER_ENDPOINT = '/services/Soap/u/54.0';
const QUERY_ENDPOINT = '/services/data/v54.0/query';
const TOOLING_QUERY_ENDPOINT = '/services/data/v54.0/tooling/query';

Expand Down Expand Up @@ -67,7 +68,7 @@ export default class SalesforceService {
const responseXml = new window.DOMParser().parseFromString(responseXmlRaw, 'text/xml');

if (!response.ok) {
return this._constructResultFromMetadataFault(responseXml);
return this._constructResultFromSoapFault(responseXml);
}

const recordNodes = responseXml.querySelectorAll('Envelope Body readMetadataResponse result records');
Expand All @@ -85,6 +86,38 @@ export default class SalesforceService {
};
}

async getUserInfo() {
const message = this._constructGetUserInfoMessage();

const requestUrl = new URL(PARTNER_ENDPOINT, this.serverBaseUrl);
const response = await fetch(requestUrl, {
method: 'POST',
headers: {
'Content-Type': 'text/xml',
'SOAPAction': '""'
},
body: message
});

const responseXmlRaw = await response.text();

const responseXml = new window.DOMParser().parseFromString(responseXmlRaw, 'text/xml');

if (!response.ok) {
return this._constructResultFromSoapFault(responseXml);
}

const resultNode = responseXml.querySelectorAll('Envelope Body getUserInfoResponse result')[0];

return {
success: true,
userInfo: Array.from(resultNode.childNodes).reduce((prev, curr) => {
prev[curr.nodeName] = curr.textContent;
return prev;
}, {})
}
}

async getManagedPrefixes() {
const namespacePrefixQuery = 'SELECT SubscriberPackage.NamespacePrefix FROM InstalledSubscriberPackage';
const namespacePrefixQueryResult = await this.query(namespacePrefixQuery, true);
Expand All @@ -109,8 +142,7 @@ export default class SalesforceService {
<sessionId>${this.sessionId}</sessionId>
</SessionHeader>
</soapenv:Header>
<soapenv:Body
xmlns="http://soap.sforce.com/2006/04/metadata">
<soapenv:Body xmlns="http://soap.sforce.com/2006/04/metadata">
<readMetadata>
<type>${type}</type>`;

Expand All @@ -126,6 +158,25 @@ export default class SalesforceService {
return message.trim();
}

_constructGetUserInfoMessage() {
let message = `
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header xmlns="urn:partner.soap.sforce.com">
<SessionHeader>
<sessionId>${this.sessionId}</sessionId>
</SessionHeader>
</soapenv:Header>
<soapenv:Body xmlns="urn:partner.soap.sforce.com">
<getUserInfo />
</soapenv:Body>
</soapenv:Envelope>`;

return message.trim();
}

_authFetch(requestUrl) {
const actualRequestUrl = requestUrl.toString().replace('+', '%20');

Expand All @@ -136,7 +187,7 @@ export default class SalesforceService {
});
}

_constructResultFromMetadataFault(responseXml) {
_constructResultFromSoapFault(responseXml) {
const faultNodes = responseXml.querySelectorAll('Envelope Body Fault faultcode');

let faultCode = 'unknown';
Expand All @@ -146,7 +197,8 @@ export default class SalesforceService {

return {
success: false,
error: `Metadata operation failed with fault ${faultCode}`
error: `SOAP operation failed`,
faultCode: faultCode
};
}
}
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "SUPR - Salesforce User Permission Report",
"short_name": "SUPR",
"description": "Salesforce User Permission Report allows you to see a report of all the permissions a user has and where they are set.",
"version": "1.2.2",
"version": "1.2.3",
"author": "Aurel Hudec",
"homepage_url": "https://github.com/hudec117/sf-user-perm-report",
"incognito": "split",
Expand Down
2 changes: 1 addition & 1 deletion src/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "salesforce-user-perm-report",
"version": "1.2.2",
"version": "1.2.3",
"description": "Salesforce User Permission Report allows you to see a report of all the permissions a user has and where they are set.",
"scripts": {
"dev": "webpack --watch --config webpack.dev.js",
Expand Down
4 changes: 2 additions & 2 deletions src/report.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
<main role="main">
<div id="app"></div>
</main>
<footer class="fixed-bottom mb-2">
<footer>
<div class="container-fluid">
<span class="text-muted float-right">Made with &#10084;&#65039; on <a href="https://github.com/hudec117/sf-user-perm-report" target="_blank">GitHub</a></span>
<span class="text-muted float-right mb-2">Made with &#10084;&#65039; on <a href="https://github.com/hudec117/sf-user-perm-report" target="_blank">GitHub</a></span>
</div>
</footer>
<script src="/build.js"></script>
Expand Down

0 comments on commit 76479bb

Please sign in to comment.