From f684c12cf35a465494192dccfe30a761316bb690 Mon Sep 17 00:00:00 2001 From: Natraj Yegnaraman Date: Thu, 4 Feb 2021 23:15:21 +0000 Subject: [PATCH] Rollback priv check --- app/manifest.json | 2 +- app/scripts/background.ts | 21 ------------- app/scripts/inject/levelup.servicecalls.ts | 36 ---------------------- app/scripts/interfaces/types.ts | 5 +-- app/scripts/options.ts | 21 ++----------- package.json | 2 +- 6 files changed, 5 insertions(+), 82 deletions(-) diff --git a/app/manifest.json b/app/manifest.json index 1963418..2f37a3b 100644 --- a/app/manifest.json +++ b/app/manifest.json @@ -43,6 +43,6 @@ "/scripts/Sdk.Soap.min.js", "/scripts/levelup.extension.js" ], - "version": "3.5.6", + "version": "3.5.7", "manifest_version": 2 } \ No newline at end of file diff --git a/app/scripts/background.ts b/app/scripts/background.ts index 0bfb039..072699b 100644 --- a/app/scripts/background.ts +++ b/app/scripts/background.ts @@ -16,15 +16,6 @@ chrome.runtime.onMessage.addListener(function (message: IExtensionMessage, sende if (message.type === 'Page') { let c = message.category.toString(); switch (c) { - case 'canImpersonate': - chrome.tabs.query({ active: true }, function (tabs) { - chrome.tabs.sendMessage(tabs[0].id, { - category: 'canImpersonate', - type: 'Background', - content: message.content, - }); - }); - break; case 'allUsers': chrome.tabs.query({ active: true }, function (tabs) { chrome.tabs.sendMessage(tabs[0].id, { @@ -121,18 +112,6 @@ chrome.runtime.onMessage.addListener(function (message: IExtensionMessage, sende } ); break; - case 'canImpersonate': - chrome.tabs.query( - { - active: true, - }, - function (tabs) { - chrome.tabs.executeScript(tabs[0].id, { - code: `window.postMessage({ type: '${c}', category: '${message.type}' }, '*');`, - }); - } - ); - break; } } else { chrome.tabs.query( diff --git a/app/scripts/inject/levelup.servicecalls.ts b/app/scripts/inject/levelup.servicecalls.ts index 8a02f71..5935531 100644 --- a/app/scripts/inject/levelup.servicecalls.ts +++ b/app/scripts/inject/levelup.servicecalls.ts @@ -169,42 +169,6 @@ export class Service { }); } - canImpersonate() { - const userId = this.utility.Xrm?.Utility?.getGlobalContext()?.getUserId() ?? this.utility.Xrm.Page.context.getUserId(); - this.utility - .fetch( - 'systemusers', - null, - null, - null, - ` - - - - - - - - - - - - - - - - - ` - ) - .then((entities) => { - let canImpersonate = entities.length > 0; - this.utility.messageExtension(canImpersonate, 'canImpersonate'); - }) - .catch((err) => { - console.log(err); - }); - } - entityMetadata() { this.utility .fetch(`EntityDefinitions`, 'LogicalName,ObjectTypeCode,LogicalCollectionName,ChangeTrackingEnabled,DisplayName') diff --git a/app/scripts/interfaces/types.ts b/app/scripts/interfaces/types.ts index 5a0ab65..64ffaf5 100644 --- a/app/scripts/interfaces/types.ts +++ b/app/scripts/interfaces/types.ts @@ -65,8 +65,7 @@ export type Category = | 'optionsets' | 'environment' | 'activation' - | 'changeUser' - | 'canImpersonate'; + | 'changeUser'; export type ExtensionState = 'On' | 'Off'; @@ -129,7 +128,6 @@ export enum LocalStorage { isImpersonating = 'isImpersonating', userId = 'userId', userName = 'userName', - canImpersonate = 'canImpersonate' } export interface IExtensionLocalStorage { @@ -139,5 +137,4 @@ export interface IExtensionLocalStorage { isImpersonating: boolean; userId: string; userName: string; - canImpersonate: boolean; } diff --git a/app/scripts/options.ts b/app/scripts/options.ts index de3759e..a57aa90 100644 --- a/app/scripts/options.ts +++ b/app/scripts/options.ts @@ -3,14 +3,6 @@ import { IExtensionMessage, LocalStorage, IExtensionLocalStorage } from './inter chrome.runtime.onMessage.addListener((message: IExtensionMessage, sender, response) => { if (message.type === 'Page') { switch (message.category) { - case 'canImpersonate': - var canImpersonate = message.content; - document.getElementById('impersonate-tab').style.display = !canImpersonate ? 'none' : 'block'; - - chrome.storage.local.set({ - [LocalStorage.canImpersonate]: canImpersonate, - }); - break; case 'allUsers': chrome.storage.local.set({ [LocalStorage.usersList]: message.content, @@ -120,18 +112,9 @@ window.addEventListener('DOMContentLoaded', function () { }); function initImpersonateTab() { - chrome.storage.local.get([LocalStorage.usersList,LocalStorage.canImpersonate], function (result: IExtensionLocalStorage) { + chrome.storage.local.get([LocalStorage.usersList], function (result: IExtensionLocalStorage) { let users = result.usersList; - let canImpersonate = result.canImpersonate; - - if(canImpersonate == undefined){ - chrome.runtime.sendMessage({ - category: 'canImpersonate', - type: 'API', - }); - }else{ - document.getElementById('impersonate-tab').style.display = !canImpersonate ? 'none' : 'block'; - } + document.getElementById('impersonate-tab').style.display = 'block'; if (!users) { chrome.runtime.sendMessage({ diff --git a/package.json b/package.json index a30fcbf..9940893 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "levelup-for-dynamics-365-power-apps", "private": true, - "version": "3.5.6", + "version": "3.5.7", "description": "Quickly perform advanced/hidden actions in Dynamics 365/Power Apps, without bookmarklets.", "scripts": { "start": "npm run dev:chrome",