Checks the current Windows PS1 execution policy. The upgrader requires an unrestricted policy.

@return {Promise.<boolean>} - True if unrestricted, false if it isn't
347875
function checkExecutionPolicy () {
  return new Promise((resolve, reject) => {
    let output = []
    let child

    try {
      debug('Powershell: Attempting to spawn PowerShell child')
      child = spawn('powershell.exe', ['-NoProfile', '-NoLogo', 'Get-ExecutionPolicy'])
    } catch (error) {
      debug('Powershell: Could not spawn PowerShell child')
      reject(error)
    }

    child.stdout.on('data', (data) => {
      debug('PowerShell: Stdout received: ' + data.toString())
      output.push(data.toString())
    })

    child.stderr.on('data', (data) => {
      debug('PowerShell: Stderr received: ' + data.toString())
      output.push(data.toString())
    })

    child.on('exit', () => {
      const linesHit = output.filter((line) => line.includes('Unrestricted') || line.includes('RemoteSigned') || line.includes('Bypass'))
      const unrestricted = (linesHit.length > 0)

      if (!unrestricted) {
        debug('PowerShell: Resolving restricted (false)')
        resolve(false)
      } else {
        debug('PowerShell: Resolving unrestricted (true)')
        resolve(true)
      }
    })

    child.stdin.end()
  })
}
285086
private static boolean canBeContinued(final String fileName, final List<Policy> policies) {
		boolean result = true;
		for (Policy policy : policies) {
			result &= policy.continueExistingFile(fileName);
		}
		return result;
	}
1173896
boolean containsInstallOrOpen() {
        synchronized (reqQueueLockObject) {
            for (ServerRequest req : queue) {
                if (req != null &&
                        ((req instanceof ServerRequestRegisterInstall) || req instanceof ServerRequestRegisterOpen)) {
                    return true;
                }
            }
        }
        return false;
    }
620833
private boolean isPermissionCheckingEnabled(INode[] pathNodes) {
    if (this.isPermissionEnabled) {
      if (permissionEnabled == null) {
        return false;
      }
      for (INode enableDir : this.permissionEnabled) {
        for (INode pathNode : pathNodes) {
          if (pathNode == enableDir) {
            return true;
          }
        }
      }
      return false;
    }
    return false;
  }
949350
def isLocked(self):
        '''
        
        '''

        self.__checkTransport()
        lockScreenRE = re.compile('mShowingLockscreen=(true|false)')
        dwp = self.shell('dumpsys window policy')
        m = lockScreenRE.search(dwp)
        if m:
            return m.group(1) == 'true'
        dreamingLockscreenRE = re.compile('mDreamingLockscreen=(true|false)')
        m = dreamingLockscreenRE.search(dwp)
        if m:
            return m.group(1) == 'true'
        raise RuntimeError("Couldn't determine screen lock state")
721053
function _getWindowsVersion () {
  return new Promise((resolve, reject) => {
    const command = 'systeminfo | findstr /B /C:"OS Name" /C:"OS Version"'
    exec(command, (error, stdout) => {
      if (error) {
        reject(error)
      } else {
        resolve(stdout)
      }
    })
  })
}
603875
function isInstallationAlreadyPerformed(ctx) {
  var pathToInstallFlag = path.join(ctx.opts.projectRoot, 'plugins', ctx.opts.plugin.id, INSTALLATION_FLAG_FILE_NAME);
  try {
    fs.accessSync(pathToInstallFlag, fs.F_OK);
    return true;
  } catch (err) {
    return false;
  }
}
700640
def policy_exists(vhost, name, runas=None):
    '''
    
    '''
    if runas is None and not salt.utils.platform.is_windows():
        runas = salt.utils.user.get_user()
    policies = list_policies(runas=runas)
    return bool(vhost in policies and name in policies[vhost])
492589
@Exported(name="currentExecutable")
    @Restricted(DoNotUse.class) // for exporting only
    public Queue.Executable getCurrentExecutableForApi() {
        Executable candidate = getCurrentExecutable();
        return candidate instanceof AccessControlled && ((AccessControlled) candidate).hasPermission(Item.READ) ? candidate : null;
    }
114437
private boolean isPartitionAssignmentAllowed() {
        if (!node.getNodeExtension().isStartCompleted()) {
            logger.warning("Partitions can't be assigned since startup is not completed yet.");
            return false;
        }

        ClusterState clusterState = node.getClusterService().getClusterState();
        if (!clusterState.isMigrationAllowed()) {
            logger.warning("Partitions can't be assigned since cluster-state= " + clusterState);
            return false;
        }
        if (partitionService.isFetchMostRecentPartitionTableTaskRequired()) {
            logger.warning("Partitions can't be assigned since most recent partition table is not decided yet.");
            return false;
        }
        return true;
    }
1101001
public boolean checkAndSwitchProcessingState(int ps0, int ps) {
    long rt = refreshTimeAndState;
    long _expect = withState(rt, ps0);
    long _update = withState(rt, ps);
    return STATE_UPDATER.compareAndSet(this, _expect, _update);
  }
1228757
public static function isWindows() : bool
    {
        // Return the cached result if it's already available.
        if (null !== static::$type) {
            return static::$type === self::TYPE_WINDOWS;
        }

        return static::getType() === self::TYPE_WINDOWS;
    }
299838
function() {
    var isWindowsRegex = /win(dows|[\s]?(nt|me|ce|xp|vista|[\d]+))/i;
    return !!_navigator && (isWindowsRegex.test(_navigator.appVersion || "") || isWindowsRegex.test(_navigator.platform || "") || (_navigator.userAgent || "").indexOf("Windows") !== -1);
  }
931238
@JsonIgnore
    public boolean isPullSuccessIndicated() {
        if (isErrorIndicated() || getStatus() == null) {
            return false;
        }

        return (getStatus().contains(DOWNLOAD_COMPLETE) ||
                getStatus().contains(IMAGE_UP_TO_DATE) ||
                getStatus().contains(DOWNLOADED_NEWER_IMAGE) ||
                getStatus().contains(LEGACY_REGISTRY) ||
                getStatus().contains(DOWNLOADED_SWARM)
        );
    }
719148
public boolean isUpToDate() throws ManagedSdkVerificationException {
    if (!Files.isRegularFile(getGcloudPath())) {
      return false;
    }

    if (version != Version.LATEST) {
      return true;
    }

    List<String> updateAvailableCommand =
        Arrays.asList(
            getGcloudPath().toString(),
            "components",
            "list",
            "--format=json",
            "--filter=state.name:Update Available");

    try {
      String result = CommandCaller.newCaller().call(updateAvailableCommand, null, null);
      for (CloudSdkComponent component : CloudSdkComponent.fromJsonList(result)) {
        State state = component.getState();
        if (state != null) {
          if ("Update Available".equals(state.getName())) {
            return false;
          }
        }
      }
      return true;
    } catch (CommandExecutionException | InterruptedException | CommandExitException ex) {
      throw new ManagedSdkVerificationException(ex);
    }
  }
880728
@Exported
    public boolean isIdle() {
        lock.readLock().lock();
        try {
            return workUnit == null && executable == null;
        } finally {
            lock.readLock().unlock();
        }
    }
1248980
@Override
    public boolean isApprovalNeeded(final Rollout rollout) {
        final UserDetails userDetails = this.getActor(rollout);
        final boolean approvalEnabled = this.tenantConfigurationManagement
                .getConfigurationValue(TenantConfigurationKey.ROLLOUT_APPROVAL_ENABLED, Boolean.class).getValue();
        return approvalEnabled && userDetails.getAuthorities().stream()
                .noneMatch(authority -> SpPermission.APPROVE_ROLLOUT.equals(authority.getAuthority()));
    }