UserSession.get().checkGlobalPermission(GlobalPermissions.SCAN_EXECUTION);
<BUG>if (settings.getString("sonar.issues.use_es_backend") != null) {
DbSession session = dbClient.openSession(false);</BUG>
try {
<BUG>String projectKey = request.mandatoryParam(PARAM_PROJECT);
AuthorizedComponentDto project = dbClient.componentDao().getAuthorizedComponentByKey(projectKey, session);
computationService.create(projectKey);
if (index.get(IssueAuthorizationIndex.class).getNullableByKey(project.key()) == null) {

permissionService.synchronizePermissions(session, project.key());
</BUG>
session.commit();

UserSession.get().checkGlobalPermission(GlobalPermissions.SCAN_EXECUTION);
if (settings.getString("sonar.issues.use_es_backend") != null) {
String projectKey = request.mandatoryParam(PARAM_PROJECT);
DbSession session = dbClient.openSession(false);
try {
dbClient.componentDao().getAuthorizedComponentByKey(projectKey, session);
computationService.create(projectKey);
} finally {
MyBatis.closeQuietly(session);
