Source:
<code>public void checkName(String name) throws Failure { boolean matches = false; ArrayList<String> badList = null; final AuthorizationStrategy auth = Jenkins.getInstance().getAuthorizationStrategy(); if (auth instanceof RoleBasedAuthorizationStrategy) { final RoleBasedAuthorizationStrategy rbas = (RoleBasedAuthorizationStrategy) auth; boolean globalRolePermitted = false; final SortedMap<Role, Set<String>> gRole = rbas.getGrantedRoles(RoleBasedAuthorizationStrategy.GLOBAL); for (final SortedMap.Entry<Role, Set<String>> entry : gRole.entrySet()) { if (entry.getKey().hasPermission(Item.CREATE)) { globalRolePermitted = true; break; } } if (!globalRolePermitted) { <START> throw new Failure(Messages.RoleBasedProjectNamingStrategy_NoPermissions()); <END> } final SortedMap<Role, Set<String>> roles = rbas.getGrantedRoles(RoleBasedAuthorizationStrategy.PROJECT); badList = new ArrayList<>(roles.size()); for (final SortedMap.Entry<Role, Set<String>> entry : roles.entrySet()) { final Role key = entry.getKey(); if (key.hasPermission(Item.CREATE) && key.hasPermission(Item.READ) && key.hasPermission(Item.CONFIGURE) && isUserIncluded(entry.getValue())) { final String namePattern = key.getPattern().toString(); if (StringUtils.isNotBlank(namePattern) && StringUtils.isNotBlank(name)) { if (Pattern.matches(namePattern, name)) { matches = true; } else { badList.add(namePattern); } } } } } if (!matches) { String error; if (badList != null && !badList.isEmpty()) error = Messages.RoleBasedProjectNamingStrategy_JobNameConventionNotApplyed(name, badList.toString()); else error = Messages.RoleBasedProjectNamingStrategy_NoPermissions(); throw new Failure(error); } }</code><technical_language>I here, searching for global role permission, search for project role</technical_language>

Target:
public void checkName(String name) throws Failure { boolean matches = false; ArrayList<String> badList = null; final AuthorizationStrategy auth = Jenkins.get().getAuthorizationStrategy(); if (auth instanceof RoleBasedAuthorizationStrategy) { final RoleBasedAuthorizationStrategy rbas = (RoleBasedAuthorizationStrategy) auth; boolean globalRolePermitted = false; final SortedMap<Role, Set<String>> gRole = rbas.getGrantedRoles(RoleType.Global); for (final SortedMap.Entry<Role, Set<String>> entry : gRole.entrySet()) { if (entry.getKey().hasPermission(Item.CREATE)) { globalRolePermitted = true; break; } } if (!globalRolePermitted) { throw new Failure(Messages.RoleBasedProjectNamingStrategy_NoPermissions()); } final SortedMap<Role, Set<String>> roles = rbas.getGrantedRoles(RoleType.Project); badList = new ArrayList<>(roles.size()); if (StringUtils.isNotBlank(name)) { for (SortedMap.Entry<Role, Set<String>> entry: roles.entrySet()) { Role key = entry.getKey(); if (key.hasPermission(Item.CREATE)) { String namePattern = key.getPattern().toString(); if (StringUtils.isNotBlank(namePattern)) { if (Pattern.matches(namePattern, name)){ matches = true; } else { badList.add(namePattern); } } } } } } if (!matches) { String error; if (badList != null && !badList.isEmpty()) error = Messages.RoleBasedProjectNamingStrategy_JobNameConventionNotApplyed(name, badList.toString()); else error = Messages.RoleBasedProjectNamingStrategy_NoPermissions(); throw new Failure(error); } }