Skip to content

Commit

Permalink
Update privileges to work with v2 (raycast#15599)
Browse files Browse the repository at this point in the history
* Update privileges to work with v2

* Update package.json

* Update CHANGELOG.md and optimise images

---------

Co-authored-by: Per Nielsen Tikær <[email protected]>
Co-authored-by: raycastbot <[email protected]>
  • Loading branch information
3 people authored and GeniusNirmit committed Dec 18, 2024
1 parent b40d531 commit 0b341e1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
5 changes: 5 additions & 0 deletions extensions/privileges/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Privileges Changelog

## [Works with Privileges v2] - 2024-12-09

- This updates the extension to work with v2 of the Privileges.app


## [Initial Version] - 2023-04-12
5 changes: 4 additions & 1 deletion extensions/privileges/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
"description": "Grant and revoke admin permission with SAP Privileges (https://github.com/SAP/macOS-enterprise-privileges). Not affiliated with SAP.",
"icon": "privileges.png",
"author": "ph00lt0",
"contributors": [
"riesinger"
],
"categories": [
"Security"
],
Expand All @@ -24,7 +27,7 @@
},
{
"name": "temp",
"title": "Grant Admin Privileges For 1 Minute",
"title": "Grant Admin Privileges for 1 Minute",
"description": "Grant admin permission with SAP Privileges for 1 minute",
"mode": "no-view"
}
Expand Down
12 changes: 8 additions & 4 deletions extensions/privileges/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@ export async function getPrivilegesClient() {
if (!privilegesApp) {
return null;
}
const cliPath = join(privilegesApp.path, "Contents", "Resources", "PrivilegesCLI");
if (!existsSync(cliPath)) {
return null;
const v2CliPath = join(privilegesApp.path, "Contents", "MacOS", "PrivilegesCLI");
if (!existsSync(v2CliPath)) {
const v1CliPath = join(privilegesApp.path, "Contents", "Resources", "PrivilegesCLI");
if (!existsSync(v1CliPath)) {
return null;
}
return new PrivilegesClient(v1CliPath);
}
return new PrivilegesClient(cliPath);
return new PrivilegesClient(v2CliPath);
}

class PrivilegesClient {
Expand Down

0 comments on commit 0b341e1

Please sign in to comment.