

def enable(app_id, enabled=True):
    "\n    Enable or disable an existing assistive access application.\n\n    app_id\n        The bundle ID or command to set assistive access status.\n\n    enabled\n        Sets enabled or disabled status. Default is ``True``.\n\n    CLI Example:\n\n    .. code-block:: bash\n\n        salt '*' assistive.enable /usr/bin/osascript\n        salt '*' assistive.enable com.smileonmymac.textexpander enabled=False\n    "
    enable_str = ('1' if enabled else '0')
    for a in _get_assistive_access():
        if (app_id == a[0]):
            cmd = 'sqlite3 "/Library/Application Support/com.apple.TCC/TCC.db" "UPDATE access SET allowed=\'{0}\' WHERE client=\'{1}\'"'.format(enable_str, app_id)
            call = __salt__['cmd.run_all'](cmd, output_loglevel='debug', python_shell=False)
            if (call['retcode'] != 0):
                comment = ''
                if ('stderr' in call):
                    comment += call['stderr']
                if ('stdout' in call):
                    comment += call['stdout']
                raise CommandExecutionError('Error enabling app: {0}'.format(comment))
            return True
    return False

dataset/ETHPy150Open saltstack/salt/salt/modules/mac_assistive.py enable/original