-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add "elevated privileges" to extensions and make managing extensions …
…one (#1012) Adds the notion of "elevated privileges" for extensions to give them abilities if requested in their manifest. The first of these privileges gives extensions the right to manage new extensions via installing, enabling, and disabling them.
- Loading branch information
Showing
10 changed files
with
524 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 18 additions & 1 deletion
19
src/extension-host/extension-types/extension-activation-context.model.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,29 @@ | ||
import { ExecutionToken } from '@node/models/execution-token.model'; | ||
import { UnsubscriberAsyncList } from 'platform-bible-utils'; | ||
import { | ||
ElevatedPrivileges, | ||
// Needed for documentation links to work | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
ElevatedPrivilegeNames, | ||
} from '@shared/models/elevated-privileges.model'; | ||
|
||
/** An object of this type is passed into `activate()` for each extension during initialization */ | ||
export type ExecutionActivationContext = { | ||
/** Canonical name of the extension */ | ||
name: string; | ||
/** Used to save and load data from the storage service. */ | ||
/** Used to save and load data by the storage service. */ | ||
executionToken: ExecutionToken; | ||
/** | ||
* Objects that provide special capabilities required by an extension based on the | ||
* `elevatedPrivileges` values listed in its manifest. For example, if an extension needs to be | ||
* able to manage other extensions, then it should include `manageExtensions` in the | ||
* `elevatedPrivileges` array in `manifest.json`. Then when the extension is activated this | ||
* {@link ElevatedPrivileges} object will have the `manageExtensions` property set to an object | ||
* with functions used to manage extensions. | ||
* | ||
* See {@link ElevatedPrivilegeNames} for the full list of elevated privileges available. | ||
*/ | ||
elevatedPrivileges: ElevatedPrivileges; | ||
/** Tracks all registrations made by an extension so they can be cleaned up when it is unloaded */ | ||
registrations: UnsubscriberAsyncList; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.