Skip to content

Commit f684c12

Browse files
committed
Rollback priv check
1 parent 52568db commit f684c12

File tree

6 files changed

+5
-82
lines changed

6 files changed

+5
-82
lines changed

app/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,6 @@
4343
"/scripts/Sdk.Soap.min.js",
4444
"/scripts/levelup.extension.js"
4545
],
46-
"version": "3.5.6",
46+
"version": "3.5.7",
4747
"manifest_version": 2
4848
}

app/scripts/background.ts

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,6 @@ chrome.runtime.onMessage.addListener(function (message: IExtensionMessage, sende
1616
if (message.type === 'Page') {
1717
let c = message.category.toString();
1818
switch (c) {
19-
case 'canImpersonate':
20-
chrome.tabs.query({ active: true }, function (tabs) {
21-
chrome.tabs.sendMessage(tabs[0].id, {
22-
category: 'canImpersonate',
23-
type: 'Background',
24-
content: message.content,
25-
});
26-
});
27-
break;
2819
case 'allUsers':
2920
chrome.tabs.query({ active: true }, function (tabs) {
3021
chrome.tabs.sendMessage(tabs[0].id, {
@@ -121,18 +112,6 @@ chrome.runtime.onMessage.addListener(function (message: IExtensionMessage, sende
121112
}
122113
);
123114
break;
124-
case 'canImpersonate':
125-
chrome.tabs.query(
126-
{
127-
active: true,
128-
},
129-
function (tabs) {
130-
chrome.tabs.executeScript(tabs[0].id, {
131-
code: `window.postMessage({ type: '${c}', category: '${message.type}' }, '*');`,
132-
});
133-
}
134-
);
135-
break;
136115
}
137116
} else {
138117
chrome.tabs.query(

app/scripts/inject/levelup.servicecalls.ts

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -169,42 +169,6 @@ export class Service {
169169
});
170170
}
171171

172-
canImpersonate() {
173-
const userId = this.utility.Xrm?.Utility?.getGlobalContext()?.getUserId() ?? this.utility.Xrm.Page.context.getUserId();
174-
this.utility
175-
.fetch(
176-
'systemusers',
177-
null,
178-
null,
179-
null,
180-
`<fetch top="1" >
181-
<entity name="systemuser" >
182-
<filter>
183-
<condition attribute="systemuserid" operator="eq" value="${userId}" />
184-
</filter>
185-
<link-entity name="systemuserroles" from="systemuserid" to="systemuserid" intersect="true" >
186-
<link-entity name="role" from="roleid" to="roleid" intersect="true" >
187-
<link-entity name="roleprivileges" from="roleid" to="roleid" intersect="true" >
188-
<link-entity name="privilege" from="privilegeid" to="privilegeid" intersect="true" >
189-
<filter>
190-
<condition attribute="name" operator="eq" value="prvActOnBehalfOfAnotherUser " />
191-
</filter>
192-
</link-entity>
193-
</link-entity>
194-
</link-entity>
195-
</link-entity>
196-
</entity>
197-
</fetch>`
198-
)
199-
.then((entities) => {
200-
let canImpersonate = entities.length > 0;
201-
this.utility.messageExtension(canImpersonate, 'canImpersonate');
202-
})
203-
.catch((err) => {
204-
console.log(err);
205-
});
206-
}
207-
208172
entityMetadata() {
209173
this.utility
210174
.fetch(`EntityDefinitions`, 'LogicalName,ObjectTypeCode,LogicalCollectionName,ChangeTrackingEnabled,DisplayName')

app/scripts/interfaces/types.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@ export type Category =
6565
| 'optionsets'
6666
| 'environment'
6767
| 'activation'
68-
| 'changeUser'
69-
| 'canImpersonate';
68+
| 'changeUser';
7069

7170
export type ExtensionState = 'On' | 'Off';
7271

@@ -129,7 +128,6 @@ export enum LocalStorage {
129128
isImpersonating = 'isImpersonating',
130129
userId = 'userId',
131130
userName = 'userName',
132-
canImpersonate = 'canImpersonate'
133131
}
134132

135133
export interface IExtensionLocalStorage {
@@ -139,5 +137,4 @@ export interface IExtensionLocalStorage {
139137
isImpersonating: boolean;
140138
userId: string;
141139
userName: string;
142-
canImpersonate: boolean;
143140
}

app/scripts/options.ts

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,6 @@ import { IExtensionMessage, LocalStorage, IExtensionLocalStorage } from './inter
33
chrome.runtime.onMessage.addListener((message: IExtensionMessage, sender, response) => {
44
if (message.type === 'Page') {
55
switch (message.category) {
6-
case 'canImpersonate':
7-
var canImpersonate = message.content;
8-
document.getElementById('impersonate-tab').style.display = !canImpersonate ? 'none' : 'block';
9-
10-
chrome.storage.local.set({
11-
[LocalStorage.canImpersonate]: canImpersonate,
12-
});
13-
break;
146
case 'allUsers':
157
chrome.storage.local.set({
168
[LocalStorage.usersList]: message.content,
@@ -120,18 +112,9 @@ window.addEventListener('DOMContentLoaded', function () {
120112
});
121113

122114
function initImpersonateTab() {
123-
chrome.storage.local.get([LocalStorage.usersList,LocalStorage.canImpersonate], function (result: IExtensionLocalStorage) {
115+
chrome.storage.local.get([LocalStorage.usersList], function (result: IExtensionLocalStorage) {
124116
let users = result.usersList;
125-
let canImpersonate = result.canImpersonate;
126-
127-
if(canImpersonate == undefined){
128-
chrome.runtime.sendMessage({
129-
category: 'canImpersonate',
130-
type: 'API',
131-
});
132-
}else{
133-
document.getElementById('impersonate-tab').style.display = !canImpersonate ? 'none' : 'block';
134-
}
117+
document.getElementById('impersonate-tab').style.display = 'block';
135118

136119
if (!users) {
137120
chrome.runtime.sendMessage({

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "levelup-for-dynamics-365-power-apps",
33
"private": true,
4-
"version": "3.5.6",
4+
"version": "3.5.7",
55
"description": "Quickly perform advanced/hidden actions in Dynamics 365/Power Apps, without bookmarklets.",
66
"scripts": {
77
"start": "npm run dev:chrome",

0 commit comments

Comments
 (0)