diff options
author | Michal Duda <michal.duda@sonarsource.com> | 2020-10-14 12:42:09 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2020-10-16 20:07:41 +0000 |
commit | 36546f92b77efb3d8597c2f63fd24ac480c2bdcc (patch) | |
tree | 0872d2a666b91ea0e84ef27ea167522f20c86a77 /server/sonar-webserver-auth/src | |
parent | b493fce1f2d13e81aa76b3ae2f450801cc079b84 (diff) | |
download | sonarqube-36546f92b77efb3d8597c2f63fd24ac480c2bdcc.tar.gz sonarqube-36546f92b77efb3d8597c2f63fd24ac480c2bdcc.zip |
SONAR-13936 cleanup
Diffstat (limited to 'server/sonar-webserver-auth/src')
3 files changed, 6 insertions, 57 deletions
diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/organization/MemberUpdater.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/organization/MemberUpdater.java index 0a8350a72a2..f24d55a9cc0 100644 --- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/organization/MemberUpdater.java +++ b/server/sonar-webserver-auth/src/main/java/org/sonar/server/organization/MemberUpdater.java @@ -135,8 +135,6 @@ public class MemberUpdater { private void removeMemberInDb(DbSession dbSession, OrganizationDto organization, UserDto user) { String userUuid = user.getUuid(); String organizationUuid = organization.getUuid(); - // dbClient.userPermissionDao().deleteOrganizationMemberPermissions(dbSession, userUuid); - //dbClient.permissionTemplateDao().deleteUserPermissionsByOrganization(dbSession, organizationUuid, userUuid); dbClient.propertiesDao().deleteByOrganizationAndUser(dbSession, organizationUuid, userUuid); dbClient.propertiesDao().deleteByOrganizationAndMatchingLogin(dbSession, organizationUuid, user.getLogin(), singletonList(DEFAULT_ISSUE_ASSIGNEE)); diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/permission/ProjectUuid.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/permission/ProjectUuid.java deleted file mode 100644 index 16b4a0d2d34..00000000000 --- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/permission/ProjectUuid.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2020 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.server.permission; - -import javax.annotation.concurrent.Immutable; -import org.sonar.db.component.ComponentDto; - -import static java.util.Objects.requireNonNull; - -/** - * Reference to a project by its db uuid. - * - */ -@Immutable -public class ProjectUuid { - - private final String uuid; - private final boolean isPrivate; - - public ProjectUuid(ComponentDto project) { - this.uuid = requireNonNull(project.uuid()); - this.isPrivate = project.isPrivate(); - } - - public String getUuid() { - return uuid; - } - - public boolean isPrivate() { - return isPrivate; - } -} diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/user/ServerUserSession.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/user/ServerUserSession.java index 4f4dabb1fd0..af7a154a72e 100644 --- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/user/ServerUserSession.java +++ b/server/sonar-webserver-auth/src/main/java/org/sonar/server/user/ServerUserSession.java @@ -147,8 +147,8 @@ public class ServerUserSession extends AbstractUserSession { if (permissionsByProjectUuid == null) { permissionsByProjectUuid = new HashMap<>(); } - Set<String> permissions = permissionsByProjectUuid.computeIfAbsent(projectUuid, this::loadProjectPermissions); - return permissions.contains(permission); + Set<String> projectPermissions = permissionsByProjectUuid.computeIfAbsent(projectUuid, this::loadProjectPermissions); + return projectPermissions.contains(permission); } /** @@ -163,10 +163,10 @@ public class ServerUserSession extends AbstractUserSession { if (component.get().isPrivate()) { return loadDbPermissions(dbSession, projectUuid); } - Set<String> permissions = new HashSet<>(); - permissions.addAll(PUBLIC_PERMISSIONS); - permissions.addAll(loadDbPermissions(dbSession, projectUuid)); - return Collections.unmodifiableSet(permissions); + Set<String> projectPermissions = new HashSet<>(); + projectPermissions.addAll(PUBLIC_PERMISSIONS); + projectPermissions.addAll(loadDbPermissions(dbSession, projectUuid)); + return Collections.unmodifiableSet(projectPermissions); } } |