Returns true if permission was denied.
@param output Output from the install/uninstall process.
@return true if permission was denied.
170419
protected boolean isPermissionDenied(List<String> output){
        return output.stream().anyMatch(s -> s != null && s.contains(PERMISSION_DENIED_MESSAGE));
    }
796313
public boolean hasPermission(Authentication authentication,
                                 Object privilege) {
        return checkRole(authentication, privilege, true)
            || checkPermission(authentication, null, privilege, false, true);
    }
312901
public static boolean isFuseInstalled() {
    try {
      if (OSUtils.isLinux()) {
        String result = ShellUtils.execCommand("fusermount", "-V");
        return !result.isEmpty();
      } else if (OSUtils.isMacOS()) {
        String result = ShellUtils.execCommand("bash", "-c", "mount | grep FUSE");
        return !result.isEmpty();
      }
    } catch (Exception e) {
      return false;
    }
    return false;
  }
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()));
    }
985940
public static boolean hasPermission(@NonNull final Context context,
                                        @NonNull final String permission) {
        //TODO Update to new (M preview) permission model https://developer.android.com/preview/features/runtime-permissions.html#coding
        if (TextUtils.isEmpty(permission)) {
            throw new IllegalArgumentException("Permission can't be null or empty.");
        }

        try {
            final PackageInfo info = context.getPackageManager()
                    .getPackageInfo(context.getPackageName(), PackageManager.GET_PERMISSIONS);
            final String[] requestedPermissions = info.requestedPermissions;
            if (requestedPermissions != null) {
                for (String requestedPermission : requestedPermissions) {
                    if (TextUtils.equals(permission, requestedPermission)) {
                        return true;
                    }
                }
            }
        } catch (PackageManager.NameNotFoundException ignore) {
            // ignore
        }

        return false;
    }
1189103
private boolean hasTargetUpdatePermission() {
        if (!permChecker.hasUpdateTargetPermission()) {
            uiNotification.displayValidationError(
                    getI18n().getMessage("message.permission.insufficient", SpPermission.UPDATE_TARGET));
            return false;
        }

        return true;
    }
381982
public static boolean checkPermission(Context context, String permission) {
    boolean hasPermission =
        (PackageManager.PERMISSION_GRANTED == context.checkCallingOrSelfPermission(permission));
    if (!hasPermission) {
      printErrorLog("permission " + permission + " is missing!");
    }
    return hasPermission;
  }
350124
@Override
	public boolean isGranted(final Permission permission, final SecurityContext context) {
		return isGranted(permission, context, false);
	}
1264062
public static boolean hasAllPermission(@NonNull Fragment context, @NonNull String... permissions) {
        if (Build.VERSION.SDK_INT < 23) {
            return true;
        } else {
            for (String permission : permissions) {
                if (ContextCompat.checkSelfPermission(context.getContext(), permission) != PackageManager.PERMISSION_GRANTED) {
                    return false;
                }
            }
            return true;
        }
    }
1333543
def has_permission?(*levels)
      if levels.all? { |level| permissions.include? level.to_sym }
        return true
      else
        return false
      end
    end
681234
private boolean synchronizedRequestPermissionToExecute() {
        boolean result = false;
        synchronized (this) {
            switch (state.get()) {
                case CLOSED:
                    result = true;
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "Allowing execution in closed state");
                    }
                    break;
                case HALF_OPEN:
                    // Limit the number of concurrent executions when we're half-open
                    if (halfOpenRunningExecutions < policy.getSuccessThreshold()) {
                        halfOpenRunningExecutions++;
                        halfOpenLastExecutionStarted = System.nanoTime();
                        result = true;
                        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                            Tr.debug(tc, "Allowing execution in half-open state. Now running ({0}/{1})", halfOpenRunningExecutions, policy.getSuccessThreshold());
                        }
                    } else {
                        // If the user runs an operation which never returns (possible using CompletionStage), we might end up stuck in half-open state
                        // denying all executions forever. For this reason, if we stay in half-open state for longer than the open state delay time,
                        // allow another execution
                        if (System.nanoTime() - halfOpenLastExecutionStarted > policyDelayNanos) {
                            halfOpenLastExecutionStarted = System.nanoTime();
                            result = true;
                            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                                Tr.debug(tc, "Allowing execution in half-open state because enough time has passed without a trial executions completing");
                            }
                        } else {
                            result = false;
                            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                                Tr.debug(tc, "Denying execution in half-open state, trial execution limit reached");
                            }
                        }
                    }
                    break;
                case OPEN:
                    if (System.nanoTime() - openStateStartTime > policyDelayNanos) {
                        // We've been in open state for long enough, transition to half-open
                        stateHalfOpen();
                        halfOpenRunningExecutions++;
                        halfOpenLastExecutionStarted = System.nanoTime();
                        result = true;
                        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                            Tr.debug(tc, "Allowing execution because we just changed to half-open state");
                        }
                    } else {
                        result = false;
                        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                            Tr.debug(tc, "Denying execution in open state");
                        }
                    }
                    break;
            }
        }
        return result;
    }
904238
public static void isValidOutputDirectory(File outputDirectory)
			throws InvalidOutputDirectoryException {
		if (!outputDirectory.exists()) {
			outputDirectory.mkdirs();
		}
		if (!outputDirectory.exists()) {
			throw new InvalidOutputDirectoryException("'" + outputDirectory
					+ "' doesn't exist.");
		}
		if (!outputDirectory.isDirectory()) {
			throw new InvalidOutputDirectoryException("'" + outputDirectory
					+ "' is not a directory.");
		}
		if (!outputDirectory.canWrite()) {
			throw new InvalidOutputDirectoryException("Unable to wrote into '"
					+ outputDirectory + "'.");
		}
	}
1268273
public boolean checkPermission(Principal user, int operation) 
  {  
    if (tc.isEntryEnabled()) 
      SibTr.entry(tc, "checkPermission", new Object[]{user, new Integer(operation)});
    boolean allowed = false;
    
    if(operation == 1) // a publish operation
    {
      // check whether permission has been granted to special group Everyone. 
      // We can do this before we check whether the user is authenticated
      if(accumGroupAllowedToPublish.size() > 0
         && accumGroupAllowedToPublish.contains(everyone))
      {
        allowed = true;
      }
      // Now check whether the user is authenticated, ie we have a username
      else if (user.getName() != null 
               && user.getName().length() > 0)
      {
        // User is authenticated
                  
        // Check user list next
        if(accumUsersAllowedToPublish.size() > 0 &&
            accumUsersAllowedToPublish.contains(user))
        {
          allowed = true;
        }
        else // Now check the groups
        {
          if(accumGroupAllowedToPublish.size() > 0)
          {
            // user hasn't been granted access directly, check the groups
            // check for AllAuthenticated first     
            if (accumGroupAllowedToPublish.contains(allAuthenticated))
            {
              allowed = true;
            }
            else
            {              
              Iterator itr = accumGroupAllowedToPublish.iterator();
              while (itr.hasNext())
              {
                Group group = (Group)itr.next();
                if(group.isMember(user))
                {
                  allowed = true;
                  break;
                }
              } // eof while
            }
          }
        } 
      }
    }
    else // a subscribe operation
    {
      // check whether permission has been granted to special group Everyone. 
      // We can do this before we check whether the user is authenticated
      if(accumGroupAllowedToSubscribe.size() > 0
         && accumGroupAllowedToSubscribe.contains(everyone))
      {
        allowed = true;
      }
      // Now check whether the user is authenticated, ie we have a username
      else if (user.getName() != null 
               && user.getName().length() > 0)
      {
        // User is authenticated
                  
        // Check user list next        
        if(accumUsersAllowedToSubscribe.size() > 0 &&
           accumUsersAllowedToSubscribe.contains(user))
        {
          allowed = true;
        }
        else // Now check the groups
        {
          if(accumGroupAllowedToSubscribe.size() > 0)
          {
            // user hasn't been granted access directly, check the groups
            // check for AllAuthenticated first     
            if (accumGroupAllowedToSubscribe.contains(allAuthenticated))
            {
              allowed = true;
            }
            else
            {                       
              Iterator itr = accumGroupAllowedToSubscribe.iterator();
           
              while (itr.hasNext())
              {
                Group group = (Group)itr.next();
                if(group.isMember(user))
                {
                  allowed = true;
                  break;
                }
              }
            }
          } 
        } 
      }       
    }
    if (tc.isEntryEnabled()) SibTr.exit(tc, "checkPermission", new Boolean(allowed));
    return allowed;
  }
1124407
public boolean isOptOut() {
        synchronized (optOutLock) {
            try {
                // Reload the metrics file
                properties.load(new FileInputStream(configurationFile));
            } catch (IOException ex) {
                if (debug) {
                    System.out.println("[Metrics] " + ex.getMessage());
                }
                return true;
            }

            return Boolean.parseBoolean(properties.getProperty("opt-out"));
        }
    }
875041
public static boolean hasPermission(Permission permission) {
        SecurityManager security = System.getSecurityManager();
        if (security != null) {
            try {
                security.checkPermission(permission);
            } catch (java.security.AccessControlException e) {
                return false;
            }
        }
        return true;
    }
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;
  }
1149213
public static boolean hasRequestedPermission(@NotNull Context context, @NotNull final String permission) {
        boolean hasRequestedPermission = false;
        if (TextUtils.isEmpty(permission)) {
            throw new IllegalArgumentException("Permission can't be null or empty.");
        }

        try {
            PackageInfo info = context.getPackageManager()
                    .getPackageInfo(context.getPackageName(), PackageManager.GET_PERMISSIONS);
            if (!CollectionUtils.isEmpty(info.requestedPermissions)) {
                for (String requestedPermission : info.requestedPermissions) {
                    if (permission.equals(requestedPermission)) {
                        hasRequestedPermission = true;
                        break;
                    }
                }
            }
        } catch (PackageManager.NameNotFoundException e) {
            Logger.e(e, "Error during checking permission ", permission);
        }
        Logger.d("hasRequestedPermission() is ", hasRequestedPermission, " for ", permission);
        return hasRequestedPermission;
    }