You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/en/docs/apidocs-mxsdk/apidocs/studio-pro-11/extensibility-api/web/web-extensions-howtos/permissions.md
+43Lines changed: 43 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,6 +52,49 @@ When a user installs an extension that requests permissions, they can manage tho
52
52
3. Find the extension in the list.
53
53
4. In the **Permissions** section under the extension details, select or clear the checkbox next to each permission to grant or revoke access.
54
54
55
+
## Reacting to Permission Changes
56
+
57
+
Extensions can subscribe to the `permissionsChanged` event on `IExtensionPermissionsApi` to be notified whenever the user grants or revokes permissions for any of the extensions. This allows you to reactively update your extension's behaviour without requiring a restart.
58
+
59
+
The event carries no arguments. When it fires, call `getPermissions()` to retrieve the current state.
60
+
Update you main/index.ts to the following to check when someone unchecked the permissions.
if (currentPermissions.find(p=>p.name===permission.name)?.granted!==permission.granted) {
78
+
if (permission.name==="runtime-configuration-private"&&permission.granted===false) {
79
+
studioPro.ui.notifications.show({
80
+
title: "This extension requires a permission",
81
+
message: "We need the 'runtime-configuration-private' permission to be granted",
82
+
displayDurationInSeconds: 3
83
+
});
84
+
}
85
+
}
86
+
}
87
+
88
+
currentPermissions=permissionsAfterChange;
89
+
});
90
+
}
91
+
};
92
+
```
93
+
The `permissionsChanged` event fires for all extensions whenever any permission is granted or revoked anywhere in the system, not just for your extension. This means multiple extensions may be responding to the same event simultaneously.
94
+
95
+
To check if the change happened for your extension you must compare the old granted state against the new one for the permission name you want to be granted.
96
+
Without this check, your extension would fire a notification every time any extension's permission changes, even ones completely unrelated to you.
97
+
55
98
## Available Permissions
56
99
57
100
The following permissions are available for web extensions:
Copy file name to clipboardExpand all lines: content/en/docs/apidocs-mxsdk/apidocs/studio-pro-11/extensibility-api/web/web-extensions-howtos/preference-api.md
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,7 @@ Before starting this how-to, complete the following prerequisites:
23
23
24
24
Create a menu that displays a dialog with text in the `loaded` method in the main entry point (`src/main/index.ts`). This can be done by following the steps in [Create a Menu Using Web API](/apidocs-mxsdk/apidocs/web-extensibility-api-11/menu-api/).
25
25
26
-
In the example below, you create one menu item that shows a message box with the user's preferences, such as `Light` or `Dark` mode, and current language.
26
+
In the example below, you create one menu item that shows a message box with the user's preferences, such as `Light` or `Dark` mode, current language and the version of Studio Pro the user is using.
27
27
28
28
Replace your `src/main/index.ts` file with the following:
Copy file name to clipboardExpand all lines: content/en/docs/releasenotes/studio-pro/web-extensibility-api.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,12 @@ numberless_headings: true
8
8
9
9
These release notes cover changes to the [Extensibility API for Web Developers](/apidocs-mxsdk/apidocs/extensibility-api/).
10
10
11
+
## Version 11.12.0
12
+
13
+
* We added a `permissionsChanged` event that can help you know if the user changed the permissions of your extensions in the [Permissions API] (/apidocs-mxsdk/apidocs/web-extensibility-api-11/extension-permissions/)
14
+
* We added the `documentsChanged` event for when one of your dependencies gets modified in Studio Pro and is a dependency you can get notified.
15
+
* The version of the studio pro is available though the [Preferences API](/apidocs-mxsdk/apidocs/web-extensibility-api-11/preference-api/).
16
+
11
17
## Version 11.11.0
12
18
13
19
* We added a **New** button to the [Element Selector API](/apidocs-mxsdk/apidocs/web-extensibility-api-11/element-selector-api/), which allows users to add new documents and entities from the element selector.
0 commit comments