Skip to content

Commit

Permalink
Fix broken client tab link from listing
Browse files Browse the repository at this point in the history
  • Loading branch information
tuxudo committed Oct 2, 2024
1 parent 523b832 commit f8e639c
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 20 deletions.
4 changes: 3 additions & 1 deletion icloud_controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ public function get_tab_data($serial_number = '')

$sql = "SELECT display_name, account_id, logged_in, account_description, prefpath, account_dsid, account_alternate_dsid, account_uuid, beta, family_show_manage_family, is_managed_apple_id, primary_email_verified, should_configure, clouddesktop_drive_enabled, clouddesktop_desktop_enabled, clouddesktop_documents_enabled, clouddesktop_first_sync_down_complete, clouddesktop_declined_upgrade, mobile_documents_enabled, cloud_photo_enabled, shared_streams_enabled, cloud_photo_only_keep_thumbnail, mail_and_notes_enabled, mail_and_notes_email_address, mail_and_notes_full_user_name, mail_and_notes_username, mail_and_notes_dot_mac_mail_supported, contacts_enabled, calendar_enabled, reminders_enabled, bookmarks_enabled, notes_enabled, keychain_sync_enabled, siri_enabled, home_enabled, news_enabled, stocks_enabled, imessage_syncing_enabled, imessage_currently_syncing, find_my_mac_enabled
FROM icloud
WHERE serial_number = '$serial_number'";
LEFT JOIN reportdata USING (serial_number)
".get_machine_group_filter()."
AND serial_number = '$serial_number'";

$queryobj = new Icloud_model();
$icloud_tab = $queryobj->query($sql);
Expand Down
2 changes: 1 addition & 1 deletion migrations/2018_03_06_000001_icloud.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function up()
$table->index('imessage_currently_syncing');
});
}

public function down()
{
$capsule = new Capsule();
Expand Down
2 changes: 1 addition & 1 deletion migrations/2019_03_07_000001_icloud_add_mojave_columns.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class IcloudAddMojaveColumns extends Migration
public function up()
{
$capsule = new Capsule();

$capsule::schema()->table($this->tableName, function (Blueprint $table) {
$table->boolean('home_enabled')->nullable();
$table->boolean('news_enabled')->nullable();
Expand Down
2 changes: 1 addition & 1 deletion migrations/2023_11_13_000001_icloud_remove_old_columns.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class IcloudRemoveOldColumns extends Migration
public function up()
{
$capsule = new Capsule();

// These have to be split out because of SQLite limtations
$capsule::schema()->table($this->tableName, function (Blueprint $table) {
// These services are no longer supported by Apple
Expand Down
28 changes: 14 additions & 14 deletions scripts/icloud
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,29 @@ sys.path.insert(0, '/usr/local/munkireport')
from munkilib import FoundationPlist

def get_prefs():

prefs = ""

# Get all users' home folders
cmd = ['dscl', '.', '-readall', '/Users', 'NFSHomeDirectory']
cmd = ['/usr/bin/dscl', '.', '-readall', '/Users', 'NFSHomeDirectory']
proc = subprocess.Popen(cmd, shell=False, bufsize=-1,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(output, unused_error) = proc.communicate()

for user in output.decode().split('\n'):
if 'NFSHomeDirectory' in user and '/var/empty' not in user:
userpath = user.replace("NFSHomeDirectory: ", "")+'/Library/Preferences/MobileMeAccounts.plist'
if os.path.isfile(userpath):
prefs = prefs + userpath + "\n"
prefs = prefs + userpath + "\n"

return prefs[:-1]

def process_prefs(prefs):

if prefs == "":
return []

out = []
for pref in prefs.split('\n'):
pl = FoundationPlist.readPlist(pref)
Expand All @@ -45,7 +45,7 @@ def process_prefs(prefs):
for item in account:
preffile['prefpath'] = pref.replace("/Library/Preferences/MobileMeAccounts.plist", "").replace("/Users/", "")
if item == 'AccountAlternateDSID':
preffile['account_alternate_dsid'] = account[item]
preffile['account_alternate_dsid'] = account[item]
elif item == 'AccountDSID':
preffile['account_dsid'] = account[item]
elif item == 'AccountDescription':
Expand Down Expand Up @@ -103,7 +103,7 @@ def process_prefs(prefs):
preffile[service['Name'].lower()+'_dot_mac_mail_supported'] = to_bool(service[serviceitem])
# elif serviceitem == 'protocol':
# preffile[service['Name'].lower()+'_protocol'] = service[serviceitem]

out.append(preffile)
return out

Expand Down Expand Up @@ -154,7 +154,7 @@ def get_extra_prefs(pref):
preffile['cloud_photo_only_keep_thumbnail'] = to_bool(pl[item][prefitem])
except:
pass

# Get iMessages in iCloud settings, if OS version is greater than 10.13.4 (Darwin 1750)
# Messages in the Cloud was introduced with 10.13.5 (Darwin 17.6.0)
if getOsVersionLonger() > 1750:
Expand All @@ -167,7 +167,7 @@ def get_extra_prefs(pref):
preffile['imessage_syncing_enabled'] = pl[item]
elif item == 'CloudKitIsSyncing':
preffile['imessage_currently_syncing'] = pl[item]

# Get Siri settings, if OS version is greater than 10.12 (Darwin 16)
if getOsVersion() > 16:
siripath = pref.replace("MobileMeAccounts.plist", "com.apple.assistant.backedup.plist")
Expand All @@ -176,7 +176,7 @@ def get_extra_prefs(pref):
preffile['siri_enabled'] = 0
if item == 'Cloud Sync Enabled':
preffile['siri_enabled'] = pl[item]

return preffile

def to_bool(s):
Expand Down
2 changes: 1 addition & 1 deletion views/icloud_listing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ table:
- column: machine.computer_name
i18n_header: listing.computername
formatter: clientDetail
tab_link: icloud-tab
tab_link: icloud
- column: reportdata.serial_number
i18n_header: serial
- {i18n_header: icloud.account_id, column: icloud.account_id}
Expand Down
2 changes: 1 addition & 1 deletion views/icloud_tab.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
// Skip skipThese
if(skipThese.indexOf(prop) == -1){
// Do nothing for empty values to blank them
if (d[prop] == '' || d[prop] == null){
if ((d[prop] == '' || d[prop] == null || d[prop] == "none" || prop == '') && d[prop] !== 0){
rows = rows
// Format enabled/disabled
Expand Down

0 comments on commit f8e639c

Please sign in to comment.