Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal to support Automation permissions #65

Open
ArtemAvramenko opened this issue Sep 22, 2023 · 2 comments
Open

Proposal to support Automation permissions #65

ArtemAvramenko opened this issue Sep 22, 2023 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@ArtemAvramenko
Copy link

ArtemAvramenko commented Sep 22, 2023

The library does a great job with almost all Privacy settings.

But it lacks support for Automation. It would be great to be able to check permission like this:

permissions.getAuthStatus('automation', 'com.apple.SystemEvents')

And ask for automation permission like this:

permissions.askForAutomation('com.apple.SystemEvents')

To check this, some simple automation command from Standard Suite can be tried to run, such as count:

tell app id 'some.your.application' to get count

And if the command returns an error, request permission via a call like this:

open x-apple.systempreferences:com.apple.preference.security?Privacy_Automation
@codebytere
Copy link
Owner

@ArtemAvramenko i'm not sure what the underlying API capabilities are here but i'm happy to look into it!

@codebytere codebytere added the enhancement New feature or request label Sep 27, 2023
@codebytere codebytere self-assigned this Sep 27, 2023
@ArtemAvramenko
Copy link
Author

@codebytere I think that Automation is only accessible by executing AppleScript via a system command, for example:

osascript -e 'tell app id "com.apple.Safari" to get count'

If permissions are given, the exit code will be zero. A non-zero value means that there are no permissions.

If this approach will be used, you should probably also escape the AppId to avoid script injection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants