-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathSys Pref Pane - All.sh
More file actions
executable file
·29 lines (23 loc) · 946 Bytes
/
Sys Pref Pane - All.sh
File metadata and controls
executable file
·29 lines (23 loc) · 946 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/zsh
# This checks to see if the authorizationdb right: system.preferences has been set to allow
# Reports:
# "Allow" if set
# "Not Set" if not set
# "Unsupported OS" if OS is lower than 10.9
# Determine OS version
os_ver_major=$(/usr/bin/sw_vers -productVersion | /usr/bin/cut -d . -f 1)
os_ver_minor=$(/usr/bin/sw_vers -productVersion | /usr/bin/cut -d . -f 2)
# Authorization DB right
db_right="system.preferences"
if [[ "$os_ver_major" -eq 10 && "$os_ver_minor" -ge 9 ]] || [[ "$os_ver_major" -ge 11 ]]; then
# Read value from authorizationdb right
tmp_plist=$(/usr/bin/security authorizationdb read "$db_right" 2>/dev/null)
value=$(/usr/libexec/PlistBuddy -c "print :rule:0" /dev/stdin <<<"$tmp_plist" 2>/dev/null)
if [[ "$value" == "allow" ]]; then
/bin/echo "<result>Allow</result>"
else
/bin/echo "<result>Not Set</result>"
fi
else
/bin/echo "<result>Unsupported OS</result>"
fi