Checks if the current user can Discover the item.
If yes, it may be displayed as a text in Fingerprint UIs.
@param fullName Full name of the job
@return {@code true} if the user can discover the item
506766
private static boolean canDiscoverItem(@Nonnull final String fullName) {
        final Jenkins jenkins = Jenkins.getInstance();

        // Fast check to avoid security context switches
        Item item = null;
        try {
            item = jenkins.getItemByFullName(fullName);
        } catch (AccessDeniedException ex) {
            // ignore, we will fall-back later
        }
        if (item != null) {
            return true;
        }
          
        // Probably it failed due to the missing Item.DISCOVER
        // We try to retrieve the job using SYSTEM user and to check permissions manually.
        final Authentication userAuth = Jenkins.getAuthentication();
        try (ACLContext acl = ACL.as(ACL.SYSTEM)) {
            final Item itemBySystemUser = jenkins.getItemByFullName(fullName);
            if (itemBySystemUser == null) {
                return false;
            }

            // To get the item existence fact, a user needs Item.DISCOVER for the item
            // and Item.READ for all container folders.
            boolean canDiscoverTheItem = itemBySystemUser.hasPermission(userAuth, Item.DISCOVER);
            if (canDiscoverTheItem) {
                ItemGroup<?> current = itemBySystemUser.getParent();
                do {
                    if (current instanceof Item) {
                        final Item i = (Item) current;
                        current = i.getParent();
                        if (!i.hasPermission(userAuth, Item.READ)) {
                            canDiscoverTheItem = false;
                        }
                    } else {
                        current = null;
                    }
                } while (canDiscoverTheItem && current != null);
            }
            return canDiscoverTheItem;
        }
    }
1345373
public static FullTypeSignature getTypeSignature(String typeSignatureString,
			boolean useInternalFormFullyQualifiedName) {
		String key;
		if (!useInternalFormFullyQualifiedName) {
			key = typeSignatureString.replace('.', '/')
					.replace('$', '.');
		} else {
			key = typeSignatureString;
		}

		// we always use the internal form as a key for cache
		FullTypeSignature typeSignature = typeSignatureCache
				.get(key);
		if (typeSignature == null) {
			ClassFileTypeSignatureParser typeSignatureParser = new ClassFileTypeSignatureParser(
					typeSignatureString);
			typeSignatureParser.setUseInternalFormFullyQualifiedName(useInternalFormFullyQualifiedName);
			typeSignature = typeSignatureParser.parseTypeSignature();
			typeSignatureCache.put(typeSignatureString, typeSignature);
		}
		return typeSignature;
	}
1336334
public boolean checkUser(String globusID, String userID) {
        if (globusID == null) {
            throw new IllegalArgumentException(i18n.getMessage("glousIdNull"));
        }
        if (userID == null) {
            throw new IllegalArgumentException(i18n.getMessage("userIdNull"));
        }

        if (this.map == null) {
            return false;
        }

        GridMapEntry entry = (GridMapEntry)this.map.get(normalizeDN(globusID));
        return (entry == null) ? false : entry.containsUserID(userID);
    }
956460
protected boolean userAlreadyExists(String username) {

        if (m_user != null) {
            return false;
        }
        CmsUser user = null;
        try {
            user = m_cms.readUser(m_ou.getValue() + username);
        } catch (CmsException e) {
            return false;
        }

        return user != null;

    }
1054273
public boolean hasUser(String userId) {
        String normalized = normalizerUserName(userId);
        return loginToUser.containsKey(normalized) || emailToUser.containsKey(normalized);
    }
709933
public Boolean get(String name) throws IOException {
        if (name.equalsIgnoreCase(DIGITAL_SIGNATURE)) {
            return Boolean.valueOf(isSet(0));
        } else if (name.equalsIgnoreCase(NON_REPUDIATION)) {
            return Boolean.valueOf(isSet(1));
        } else if (name.equalsIgnoreCase(KEY_ENCIPHERMENT)) {
            return Boolean.valueOf(isSet(2));
        } else if (name.equalsIgnoreCase(DATA_ENCIPHERMENT)) {
            return Boolean.valueOf(isSet(3));
        } else if (name.equalsIgnoreCase(KEY_AGREEMENT)) {
            return Boolean.valueOf(isSet(4));
        } else if (name.equalsIgnoreCase(KEY_CERTSIGN)) {
            return Boolean.valueOf(isSet(5));
        } else if (name.equalsIgnoreCase(CRL_SIGN)) {
            return Boolean.valueOf(isSet(6));
        } else if (name.equalsIgnoreCase(ENCIPHER_ONLY)) {
            return Boolean.valueOf(isSet(7));
        } else if (name.equalsIgnoreCase(DECIPHER_ONLY)) {
            return Boolean.valueOf(isSet(8));
        } else {
          throw new IOException("Attribute name not recognized by"
                                + " CertAttrSet:KeyUsage.");
        }
    }
5319
private static @Nullable
    User getOrCreateById(@Nonnull String id, @Nonnull String fullName, boolean create) {
        User u = AllUsers.get(id);
        if (u == null && (create || UserIdMapper.getInstance().isMapped(id))) {
            u = new User(id, fullName);
            AllUsers.put(id, u);
            if (!id.equals(fullName) && !UserIdMapper.getInstance().isMapped(id)) {
                try {
                    u.save();
                } catch (IOException x) {
                    LOGGER.log(Level.WARNING, "Failed to save user configuration for " + id, x);
                }
            }
        }
        return u;
    }
556209
public boolean isUserAdmin(String userName) {

        if (CmsStringUtil.isEmptyOrWhitespaceOnly(userName)) {
            return false;
        }
        return m_userAdmin.equals(userName);
    }
1228369
public boolean isExistingID() {
        try {
            String userId= getPost().getString(Defines.Jsonkey.Identity.getKey());
            return (userId != null && userId.equals(prefHelper_.getIdentity()));
        } catch (JSONException e) {
            e.printStackTrace();
            return false;
        }

    }
715216
public boolean contains( String name )
    {
        for ( Header header : headers ) {
            if ( header.getName().equals( name ) ) {
                return true;
            }
        }
        return false;
    }
10104
public static boolean isValidJavaIdentifier(String name) {
        if (isBlank(name)) {
            return false;
        }

        final char[] chars = name.toCharArray();
        if (!Character.isJavaIdentifierStart(chars[0])) {
            return false;
        }

        for (char c : chars) {
            if (!Character.isJavaIdentifierPart(c)) {
                return false;
            }
        }

        return true;
    }
583128
@Override
	public Value check(ILexNameToken name)
	{
		// A RootContext stops the name search from continuing down the
		// context chain. It first checks any local context, then it
		// checks the "class" context, then it goes down to the global level.

		Value v = get(name); // Local variables

		if (v != null)
		{
			return v;
		}

		if (freeVariables != null)
		{
			v = freeVariables.get(name);

			if (v != null)
			{
				return v;
			}
		}

		v = assistantFactory.createSClassDefinitionAssistant().getStatic(classdef, name);

		if (v != null)
		{
			return v;
		}

		Context g = getGlobal();

		if (g != this)
		{
			return g.check(name);
		}

		return v;
	}
277027
public static boolean isSuperuser(String username)
    {
        UntypedResultSet result = selectUser(username);
        return !result.isEmpty() && result.one().getBoolean("super");
    }
1033695
public boolean hasRoleForUser(String name, String role) {
        List<String> roles = getRolesForUser(name);

        boolean hasRole = false;
        for (String r : roles) {
            if (r.equals(role)) {
                hasRole = true;
                break;
            }
        }

        return hasRole;
    }
952599
public static Optional<CommonProfile> isAuthenticationProfileAvailable(final J2EContext context) {
        val manager = new ProfileManager<>(context, context.getSessionStore());
        return manager.get(true);
    }
613936
public static boolean isStarQualifiedName(String name) {
    return name != null
        && name.endsWith(".*")
        && isQualifiedName(name.substring(0, name.length() - 2));
  }
245769
public boolean canAcl(String name) {
        if (getParent().ignoreACL()) {
            return false;
        }
        String newName = name.toLowerCase();
        boolean result = false;
        if (aclList.containsKey(newName)) {
            result = aclList.get(newName).canAcl();
        }
        return result;
    }