Source:
<code>private boolean hasPermission(String sid, Permission p, RoleType roleType, AccessControlled controlledItem) { if (PermissionHelper.isDangerous(p)) { p = Jenkins.ADMINISTER; } final Set<Permission> permissions = new HashSet<>(); final Permission per = p; <START> final boolean[] temp = {false}; <END> for (; p!=null; p=p.impliedBy) { permissions.add(p); } new RoleWalker() { public void perform(Role current) { if (current.hasAnyPermission(permissions)) { if(grantedRoles.get(current).contains(sid)) { if (Macro.isMacro(current)) { Macro macro = RoleMacroExtension.getMacro(current.getName()); if (macro != null) { RoleMacroExtension macroExtension = RoleMacroExtension.getMacroExtension(macro.getName()); if (macroExtension.IsApplicable(roleType) && macroExtension.hasPermission(sid, per, roleType, controlledItem, macro)) { temp[0] =true; return ; } } } else { temp[0] =true; return ; } } else if (Settings.TREAT_USER_AUTHORITIES_AS_ROLES) { try { UserDetails userDetails = cache.getIfPresent(sid); if (userDetails == null) { userDetails = Jenkins.getActiveInstance().getSecurityRealm().loadUserByUsername(sid); cache.put(sid, userDetails); } for (GrantedAuthority grantedAuthority : userDetails.getAuthorities()) { if (grantedAuthority.getAuthority().equals(current.getName())) { temp[0] =true; return ; } } } catch (BadCredentialsException e) { LOGGER.log(Level.FINE, "Bad credentials", e); } catch (DataAccessException e) { LOGGER.log(Level.FINE, "failed to access the data", e); } catch (RuntimeException ex) { LOGGER.log(Level.WARNING, "Unhandled exception during user authorities processing", ex); } } } } }; return temp[0]; }</code><technical_language>Optional recommended, ok</technical_language>

Target:
private boolean hasPermission(String sid, Permission p, RoleType roleType, AccessControlled controlledItem) { if (PermissionHelper.isDangerous(p)) { p = Jenkins.ADMINISTER; } final Set<Permission> permissions = new HashSet<>(); final Permission per = p; final boolean[] temp = {false}; for (; p!=null; p=p.impliedBy) { permissions.add(p); } new RoleWalker() { public void perform(Role current) { if (current.hasAnyPermission(permissions)) { if (grantedRoles.get(current).contains(sid)) { if (Macro.isMacro(current)) { Macro macro = RoleMacroExtension.getMacro(current.getName()); if (macro != null) { RoleMacroExtension macroExtension = RoleMacroExtension.getMacroExtension(macro.getName()); if (macroExtension.IsApplicable(roleType) && macroExtension.hasPermission(sid, per, roleType, controlledItem, macro)) { temp[0] =true; abort(); return ; } } } else { temp[0] =true; abort(); return ; } } else if (Settings.TREAT_USER_AUTHORITIES_AS_ROLES) { try { UserDetails userDetails = cache.getIfPresent(sid); if (userDetails == null) { userDetails = Jenkins.getActiveInstance().getSecurityRealm().loadUserByUsername(sid); cache.put(sid, userDetails); } for (GrantedAuthority grantedAuthority : userDetails.getAuthorities()) { if (grantedAuthority.getAuthority().equals(current.getName())) { temp[0] =true; abort(); return ; } } } catch (BadCredentialsException e) { LOGGER.log(Level.FINE, "Bad credentials", e); } catch (DataAccessException e) { LOGGER.log(Level.FINE, "failed to access the data", e); } catch (RuntimeException ex) { LOGGER.log(Level.WARNING, "Unhandled exception during user authorities processing", ex); } } } } }; return temp[0]; }