import javax.annotation.Nullable;
import org.sonar.db.permission.GroupPermissionDto;
+import org.sonar.db.permission.template.PermissionTemplateDto;
public class GroupPermissionNewValue extends PermissionNewValue {
private String groupName;
public GroupPermissionNewValue(String uuid, String rootComponentUuid, String componentName, String role, String groupUuid,
- String groupName, String qualifier) {
- super(uuid, rootComponentUuid, componentName, role, qualifier);
+ String groupName, String qualifier, @Nullable PermissionTemplateDto permissionTemplateDto) {
+ super(uuid, rootComponentUuid, componentName, role, qualifier, permissionTemplateDto);
this.groupUuid = groupUuid;
this.groupName = groupName;
}
public GroupPermissionNewValue(String rootComponentUuid, String componentName, String role, String groupUuid,
String groupName, String qualifier) {
- this(null, rootComponentUuid, componentName, role, groupUuid, groupName, qualifier);
+ this(null, rootComponentUuid, componentName, role, groupUuid, groupName, qualifier, null);
}
- public GroupPermissionNewValue(GroupPermissionDto dto, String qualifier) {
+ public GroupPermissionNewValue(GroupPermissionDto dto, String qualifier, @Nullable PermissionTemplateDto permissionTemplateDto) {
this(dto.getUuid(), dto.getComponentUuid(), dto.getComponentName(), dto.getRole(), dto.getGroupUuid(),
- dto.getGroupName(), qualifier);
+ dto.getGroupName(), qualifier, permissionTemplateDto);
}
@Nullable
addField(sb, "\"groupName\": ", this.groupName, true);
addField(sb, "\"componentUuid\": ", this.componentUuid, true);
addField(sb, "\"componentName\": ", this.componentName, true);
+ addField(sb, "\"permissionTemplateUuid\": ", this.permissionTemplateId, true);
+ addField(sb, "\"permissionTemplateName\": ", this.permissionTemplateName, true);
addField(sb, "\"qualifier\": ", this.qualifier, true);
endString(sb);
return sb.toString();
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
+import org.sonar.db.permission.template.PermissionTemplateDto;
public abstract class PermissionNewValue extends NewValue {
@Nullable
@Nullable
protected String qualifier;
+ @Nullable
+ protected String permissionTemplateId;
+
+ @Nullable
+ protected String permissionTemplateName;
+
protected PermissionNewValue(@Nullable String permissionUuid, @Nullable String componentUuid, @Nullable String componentName,
- @Nullable String permission, @Nullable String qualifier) {
+ @Nullable String permission, @Nullable String qualifier, @Nullable PermissionTemplateDto permissionTemplateDto) {
this.permissionUuid = permissionUuid;
this.componentUuid = componentUuid;
this.componentName = componentName;
this.qualifier = getQualifier(qualifier);
this.permission = permission;
+ this.permissionTemplateId = permissionTemplateDto == null ? null : permissionTemplateDto.getUuid();
+ this.permissionTemplateName = permissionTemplateDto == null ? null : permissionTemplateDto.getName();
}
@CheckForNull
public String getQualifier() {
return this.qualifier;
}
+
+ @CheckForNull
+ public String getPermissionTemplateId() {
+ return this.permissionTemplateId;
+ }
+
+ @CheckForNull
+ public String getPermissionTemplateName() {
+ return this.permissionTemplateName;
+ }
+
}
import javax.annotation.Nullable;
import org.sonar.db.permission.UserPermissionDto;
+import org.sonar.db.permission.template.PermissionTemplateDto;
import org.sonar.db.user.UserId;
public class UserPermissionNewValue extends PermissionNewValue {
@Nullable
private final String userUuid;
+
@Nullable
private final String userLogin;
- public UserPermissionNewValue(UserPermissionDto permissionDto, @Nullable String projectName, @Nullable UserId userId, String qualifier) {
- super(permissionDto.getUuid(), permissionDto.getComponentUuid(), projectName, permissionDto.getPermission(), qualifier);
+ public UserPermissionNewValue(UserPermissionDto permissionDto, @Nullable String projectName, @Nullable UserId userId,
+ String qualifier, @Nullable PermissionTemplateDto templateDto) {
+ super(permissionDto.getUuid(), permissionDto.getComponentUuid(), projectName, permissionDto.getPermission(),
+ qualifier, templateDto);
this.userUuid = userId != null ? userId.getUuid() : null;
this.userLogin = userId != null ? userId.getLogin() : null;
}
}
public UserPermissionNewValue(String role, String projectUuid, String projectName, UserId userId, String qualifier) {
- super(null, projectUuid, projectName, role, qualifier);
+ super(null, projectUuid, projectName, role, qualifier, null);
this.userUuid = userId != null ? userId.getUuid() : null;
this.userLogin = userId != null ? userId.getLogin() : null;
}
addField(sb, "\"permission\": ", this.permission, true);
addField(sb, "\"componentUuid\": ", this.componentUuid, true);
addField(sb, "\"componentName\": ", this.componentName, true);
+ addField(sb, "\"permissionTemplateUuid\": ", this.permissionTemplateId, true);
+ addField(sb, "\"permissionTemplateName\": ", this.permissionTemplateName, true);
addField(sb, "\"userUuid\": ", this.userUuid, true);
addField(sb, "\"userLogin\": ", this.userLogin, true);
addField(sb, "\"qualifier\": ", this.qualifier, true);
import org.sonar.db.audit.AuditPersister;
import org.sonar.db.audit.model.GroupPermissionNewValue;
import org.sonar.db.component.ComponentDto;
+import org.sonar.db.permission.template.PermissionTemplateDto;
import static org.sonar.db.DatabaseUtils.executeLargeInputs;
import static org.sonar.db.DatabaseUtils.executeLargeInputsWithoutOutput;
return mapper(session).selectGroupUuidsWithPermissionOnProjectBut(projectUuid, permission);
}
- public void insert(DbSession dbSession, GroupPermissionDto groupPermissionDto, @Nullable ComponentDto componentDto) {
+ public void insert(DbSession dbSession, GroupPermissionDto groupPermissionDto, @Nullable ComponentDto componentDto,
+ @Nullable PermissionTemplateDto permissionTemplateDto) {
mapper(dbSession).insert(groupPermissionDto);
if (auditPersister != null) {
String qualifier = (componentDto != null) ? componentDto.qualifier() : null;
- auditPersister.addGroupPermission(dbSession, new GroupPermissionNewValue(groupPermissionDto, qualifier));
+ auditPersister.addGroupPermission(dbSession, new GroupPermissionNewValue(groupPermissionDto, qualifier, permissionTemplateDto));
}
}
import org.sonar.db.audit.AuditPersister;
import org.sonar.db.audit.model.UserPermissionNewValue;
import org.sonar.db.component.ComponentDto;
+import org.sonar.db.permission.template.PermissionTemplateDto;
import org.sonar.db.user.UserId;
import org.sonar.db.user.UserIdDto;
return mapper(session).selectUserIdsWithPermissionOnProjectBut(projectUuid, permission);
}
- public void insert(DbSession dbSession, UserPermissionDto dto, @Nullable ComponentDto componentDto, @Nullable UserId userId) {
+ public void insert(DbSession dbSession, UserPermissionDto dto, @Nullable ComponentDto componentDto,
+ @Nullable UserId userId, @Nullable PermissionTemplateDto templateDto) {
mapper(dbSession).insert(dto);
if (auditPersister != null) {
String componentName = (componentDto != null) ? componentDto.name() : null;
String qualifier = (componentDto != null) ? componentDto.qualifier() : null;
- auditPersister.addUserPermission(dbSession, new UserPermissionNewValue(dto, componentName, userId, qualifier));
+ auditPersister.addUserPermission(dbSession, new UserPermissionNewValue(dto, componentName, userId, qualifier,
+ templateDto));
}
}
package org.sonar.db.permission;
import javax.annotation.Nullable;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
-import org.mockito.Mockito;
import org.sonar.api.utils.System2;
import org.sonar.core.util.SequenceUuidFactory;
-import org.sonar.core.util.Uuids;
import org.sonar.db.DbSession;
import org.sonar.db.DbTester;
import org.sonar.db.audit.AuditPersister;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoInteractions;
import static org.mockito.Mockito.verifyNoMoreInteractions;
verify(auditPersister).addGroupPermission(eq(dbSession), newValueCaptor.capture());
GroupPermissionNewValue newValue = newValueCaptor.getValue();
assertNewValue(newValue, dto.getUuid(), group.getUuid(), group.getName(), project.uuid(), dto.getRole(), project.name(), "project");
- assertThat(newValue).hasToString("{\"permissionUuid\": \"1\", \"permission\": \"admin\", \"groupUuid\": \"guuid\", \"groupName\": \"gname\", \"componentUuid\": \"cuuid\", "
- + "\"componentName\": \"cname\", \"qualifier\": \"project\" }");
+ assertThat(newValue).hasToString("{\"permissionUuid\": \"1\", \"permission\": \"admin\", \"groupUuid\": \"guuid\", \"groupName\": \"gname\"," +
+ " \"componentUuid\": \"cuuid\", \"componentName\": \"cname\", \"qualifier\": \"project\" }");
underTest.deleteByRootComponentUuid(dbSession, project);
verify(auditPersister).addGroupPermission(eq(dbSession), newValueCaptor.capture());
GroupPermissionNewValue newValue = newValueCaptor.getValue();
- assertNewValue(newValue, dto.getUuid(), null, null, project.uuid(), dto.getRole(), project.name(), "project");
+ assertNewValue(newValue, dto.getUuid(), null, null, project.uuid(), dto.getRole(), project.name(), "project");
assertThat(newValue).hasToString("{\"permissionUuid\": \"1\", \"permission\": \"admin\", \"componentUuid\": \"cuuid\", "
+ "\"componentName\": \"cname\", \"qualifier\": \"project\" }");
group = db.users().insertGroup(g -> g.setUuid("guuid").setName("gname"));
project = db.components().insertPrivateProject(c -> c.setUuid("cuuid").setName("cname"));
dto = getGroupPermission(group, project);
- underTest.insert(dbSession, dto, project);
+ underTest.insert(dbSession, dto, project, null);
}
private void addGroupPermissionWithoutGroup() {
project = db.components().insertPrivateProject(c -> c.setUuid("cuuid").setName("cname"));
dto = getGroupPermission(project);
- underTest.insert(dbSession, dto, project);
+ underTest.insert(dbSession, dto, project, null);
}
private void addGroupPermissionWithoutComponent() {
group = db.users().insertGroup(g -> g.setUuid("guuid").setName("gname"));
dto = getGroupPermission(group);
- underTest.insert(dbSession, dto, null);
+ underTest.insert(dbSession, dto, null, null);
}
private GroupPermissionDto getGroupPermission(@Nullable GroupDto group, @Nullable ComponentDto project) {
private UserPermissionDto addGlobalPermission(String permission, UserDto user) {
UserPermissionDto dto = new UserPermissionDto(Uuids.create(), permission, user.getUuid(), null);
- underTest.insert(dbSession, dto, null, user);
+ underTest.insert(dbSession, dto, null, user, null);
db.commit();
return dto;
}
private UserPermissionDto addProjectPermission(String permission, UserDto user, ComponentDto project) {
UserPermissionDto dto = new UserPermissionDto(Uuids.create(), permission, user.getUuid(), project.uuid());
- underTest.insert(dbSession, dto, project, user);
+ underTest.insert(dbSession, dto, project, user, null);
db.commit();
return dto;
}
import org.sonar.db.audit.AuditPersister;
import org.sonar.db.audit.model.UserPermissionNewValue;
import org.sonar.db.component.ComponentDto;
+import org.sonar.db.permission.template.PermissionTemplateDto;
import org.sonar.db.user.UserDto;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.sonar.core.permission.GlobalPermissions.SCAN_EXECUTION;
import static org.sonar.core.permission.GlobalPermissions.SYSTEM_ADMIN;
+import static org.sonar.db.permission.template.PermissionTemplateTesting.newPermissionTemplateDto;
public class UserPermissionDaoWithPersisterTest {
private final AuditPersister auditPersister = mock(AuditPersister.class);
public void userGlobalPermissionInsertAndDeleteArePersisted() {
UserDto user = insertUser(u -> u.setLogin("login1").setName("Marius").setEmail("email1@email.com"));
UserPermissionDto dto = new UserPermissionDto(Uuids.create(), SYSTEM_ADMIN, user.getUuid(), null);
- underTest.insert(dbSession, dto, null, user);
+ underTest.insert(dbSession, dto, null, user, null);
verify(auditPersister).addUserPermission(eq(dbSession), newValueCaptor.capture());
UserPermissionNewValue newValue = newValueCaptor.getValue();
assertThat(newValue.toString()).doesNotContain("permissionUuid");
}
+ @Test
+ public void userGlobalPermissionInsertWithTemplateIsPersisted() {
+ PermissionTemplateDto templateDto = newPermissionTemplateDto();
+ db.getDbClient().permissionTemplateDao().insert(db.getSession(), templateDto);
+ UserDto user = insertUser(u -> u.setLogin("login1").setName("Marius").setEmail("email1@email.com"));
+ UserPermissionDto dto = new UserPermissionDto(Uuids.create(), SYSTEM_ADMIN, user.getUuid(), null);
+ underTest.insert(dbSession, dto, null, user, templateDto);
+
+ verify(auditPersister).addUserPermission(eq(dbSession), newValueCaptor.capture());
+ UserPermissionNewValue newValue = newValueCaptor.getValue();
+ assertThat(newValue)
+ .extracting(UserPermissionNewValue::getPermissionUuid, UserPermissionNewValue::getUserUuid, UserPermissionNewValue::getUserLogin,
+ UserPermissionNewValue::getComponentUuid, UserPermissionNewValue::getPermission, UserPermissionNewValue::getComponentName,
+ UserPermissionNewValue::getQualifier,
+ UserPermissionNewValue::getPermissionTemplateId, UserPermissionNewValue::getPermissionTemplateName)
+ .containsExactly(dto.getUuid(), user.getUuid(), user.getLogin(), null, dto.getPermission(), null, null,
+ templateDto.getUuid(), templateDto.getName());
+ assertThat(newValue.toString()).doesNotContain("projectUuid");
+ }
+
@Test
public void userGlobalPermissionDeleteWithoutAffectedRowsIsNotPersisted() {
UserDto user = insertUser(u -> u.setLogin("login1").setName("Marius").setEmail("email1@email.com"));
UserDto user = insertUser(u -> u.setLogin("login1").setName("Marius").setEmail("email1@email.com"));
ComponentDto project = db.components().insertPrivateProject();
UserPermissionDto dto = new UserPermissionDto(Uuids.create(), SYSTEM_ADMIN, user.getUuid(), project.uuid());
- underTest.insert(dbSession, dto, project, user);
+ underTest.insert(dbSession, dto, project, user, null);
verify(auditPersister).addUserPermission(eq(dbSession), newValueCaptor.capture());
UserPermissionNewValue newValue = newValueCaptor.getValue();
UserDto user = insertUser(u -> u.setLogin("login1").setName("Marius").setEmail("email1@email.com"));
ComponentDto portfolio = db.components().insertPublicPortfolio();
UserPermissionDto dto = new UserPermissionDto(Uuids.create(), SYSTEM_ADMIN, user.getUuid(), portfolio.uuid());
- underTest.insert(dbSession, dto, portfolio, user);
+ underTest.insert(dbSession, dto, portfolio, user, null);
verify(auditPersister).addUserPermission(eq(dbSession), newValueCaptor.capture());
UserPermissionNewValue newValue = newValueCaptor.getValue();
UserDto user = insertUser(u -> u.setLogin("login1").setName("Marius").setEmail("email1@email.com"));
ComponentDto application = db.components().insertPublicApplication();
UserPermissionDto dto = new UserPermissionDto(Uuids.create(), SYSTEM_ADMIN, user.getUuid(), application.uuid());
- underTest.insert(dbSession, dto, application, user);
+ underTest.insert(dbSession, dto, application, user, null);
verify(auditPersister).addUserPermission(eq(dbSession), newValueCaptor.capture());
UserPermissionNewValue newValue = newValueCaptor.getValue();
UserDto user = insertUser(u -> u.setLogin("login1").setName("Marius").setEmail("email1@email.com"));
ComponentDto project = db.components().insertPrivateProject();
UserPermissionDto dto = new UserPermissionDto(Uuids.create(), SCAN_EXECUTION, user.getUuid(), project.uuid());
- underTest.insert(dbSession, dto, project, user);
+ underTest.insert(dbSession, dto, project, user, null);
underTest.deleteProjectPermissionOfAnyUser(dbSession, SCAN_EXECUTION, project);
verify(auditPersister).deleteUserPermission(eq(dbSession), newValueCaptor.capture());
UserDto user = insertUser(u -> u.setLogin("login1").setName("Marius").setEmail("email1@email.com"));
ComponentDto project = db.components().insertPrivateProject();
UserPermissionDto dto = new UserPermissionDto(Uuids.create(), SYSTEM_ADMIN, user.getUuid(), project.uuid());
- underTest.insert(dbSession, dto, project, user);
+ underTest.insert(dbSession, dto, project, user, null);
underTest.deleteByUserUuid(dbSession, user);
verify(auditPersister).deleteUserPermission(eq(dbSession), newValueCaptor.capture());
.setUuid(Uuids.createFast())
.setGroupUuid(null)
.setRole(permission);
- db.getDbClient().groupPermissionDao().insert(db.getSession(), dto, null);
+ db.getDbClient().groupPermissionDao().insert(db.getSession(), dto, null, null);
db.commit();
return dto;
}
.setUuid(Uuids.createFast())
.setGroupUuid(group.getUuid())
.setRole(permission);
- db.getDbClient().groupPermissionDao().insert(db.getSession(), dto, null);
+ db.getDbClient().groupPermissionDao().insert(db.getSession(), dto, null, null);
db.commit();
return dto;
}
.setRole(permission)
.setComponentUuid(project.uuid())
.setComponentName(project.name());
- db.getDbClient().groupPermissionDao().insert(db.getSession(), dto, project);
+ db.getDbClient().groupPermissionDao().insert(db.getSession(), dto, project, null);
db.commit();
return dto;
}
.setRole(permission)
.setComponentUuid(project.uuid())
.setComponentName(project.name());
- db.getDbClient().groupPermissionDao().insert(db.getSession(), dto, project);
+ db.getDbClient().groupPermissionDao().insert(db.getSession(), dto, project, null);
db.commit();
return dto;
}
@Deprecated
public UserPermissionDto insertPermissionOnUser(UserDto user, String permission) {
UserPermissionDto dto = new UserPermissionDto(Uuids.create(), permission, user.getUuid(), null);
- db.getDbClient().userPermissionDao().insert(db.getSession(), dto, null, user);
+ db.getDbClient().userPermissionDao().insert(db.getSession(), dto, null, user, null);
db.commit();
return dto;
}
"%s can't be granted on a public project", permission);
checkArgument(project.getMainBranchProjectUuid() == null, "Permissions can't be granted on branches");
UserPermissionDto dto = new UserPermissionDto(Uuids.create(), permission, user.getUuid(), project.uuid());
- db.getDbClient().userPermissionDao().insert(db.getSession(), dto, project, user);
+ db.getDbClient().userPermissionDao().insert(db.getSession(), dto, project, user, null);
db.commit();
return dto;
}
.setRole(USER)
.setComponentUuid(project.uuid())
.setComponentName(project.name());
- dbClient.groupPermissionDao().insert(dbSession, dto, project);
+ dbClient.groupPermissionDao().insert(dbSession, dto, project, null);
}
dbSession.commit();
.map(GroupDto::getName)
.ifPresent(addedDto::setGroupName);
- dbClient.groupPermissionDao().insert(dbSession, addedDto, change.getProject());
+ dbClient.groupPermissionDao().insert(dbSession, addedDto, change.getProject(), null);
return true;
}
*/
package org.sonar.server.permission;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+import javax.annotation.CheckForNull;
+import javax.annotation.Nullable;
import org.apache.commons.lang.StringUtils;
import org.sonar.api.resources.Qualifiers;
import org.sonar.api.server.ServerSide;
import static org.sonar.api.security.DefaultGroups.isAnyone;
import static org.sonar.api.web.UserRole.PUBLIC_PERMISSIONS;
import static org.sonar.db.permission.GlobalPermission.SCAN;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.stream.Collectors;
@ServerSide
public class PermissionTemplateService {
.filter(up -> permissionValidForProject(project, up.getPermission()))
.forEach(up -> {
UserPermissionDto dto = new UserPermissionDto(uuidFactory.create(), up.getPermission(), up.getUserUuid(), project.uuid());
- dbClient.userPermissionDao().insert(dbSession, dto, project, userIdByUuid.get(up.getUserUuid()));
+ dbClient.userPermissionDao().insert(dbSession, dto, project, userIdByUuid.get(up.getUserUuid()), template);
});
List<PermissionTemplateGroupDto> groupsPermissions = dbClient.permissionTemplateDao().selectGroupPermissionsByTemplateUuid(dbSession, template.getUuid());
.setRole(gp.getPermission())
.setComponentUuid(project.uuid())
.setComponentName(project.name());
- dbClient.groupPermissionDao().insert(dbSession, dto, null);
+ dbClient.groupPermissionDao().insert(dbSession, dto, null, template);
});
List<PermissionTemplateCharacteristicDto> characteristics = dbClient.permissionTemplateCharacteristicDao().selectByTemplateUuids(dbSession, singletonList(template.getUuid()));
.filter(characteristic -> !permissionsForCurrentUserAlreadyInDb.contains(characteristic.getPermission()))
.forEach(c -> {
UserPermissionDto dto = new UserPermissionDto(uuidFactory.create(), c.getPermission(), userDto.getUuid(), project.uuid());
- dbClient.userPermissionDao().insert(dbSession, dto, project, userDto);
+ dbClient.userPermissionDao().insert(dbSession, dto, project, userDto, template);
});
}
}
}
UserPermissionDto dto = new UserPermissionDto(uuidFactory.create(), change.getPermission(), change.getUserId().getUuid(),
change.getProjectUuid());
- dbClient.userPermissionDao().insert(dbSession, dto, change.getProject(), change.getUserId());
+ dbClient.userPermissionDao().insert(dbSession, dto, change.getProject(), change.getUserId(), null);
return true;
}
private void insertProjectPermissionOnUser(DbSession dbSession, ComponentDto component, String permission, UserId userId) {
- dbClient.userPermissionDao().insert(dbSession, new UserPermissionDto(Uuids.create(), permission, userId.getUuid(), component.uuid()), component, userId);
+ dbClient.userPermissionDao().insert(dbSession, new UserPermissionDto(Uuids.create(), permission, userId.getUuid(), component.uuid()),
+ component, userId, null);
}
private void insertProjectPermissionOnGroup(DbSession dbSession, ComponentDto component, String permission, String groupUuid) {
.setGroupUuid(groupUuid)
.setGroupName(groupName)
.setRole(permission)
- .setComponentName(component.name()), component);
+ .setComponentName(component.name()), component, null);
}
private void updatePermissionsToPublic(DbSession dbSession, ComponentDto component) {
.setGroupUuid(null)
.setComponentUuid(project.uuid())
.setComponentName(project.name())
- .setRole(permission), project);
+ .setRole(permission), project, null);
session.commit();
userSession.logIn().addProjectPermission(permission, project);
}
.setRole(perm)
.setComponentUuid(privateProject.uuid())
.setComponentName(privateProject.name());
- db.getDbClient().groupPermissionDao().insert(db.getSession(), dto, privateProject);
+ db.getDbClient().groupPermissionDao().insert(db.getSession(), dto, privateProject, null);
db.commit();
}
}
.setRole(perm)
.setComponentUuid(project.uuid())
.setComponentName(project.name());
- db.getDbClient().groupPermissionDao().insert(db.getSession(), dto, project);
+ db.getDbClient().groupPermissionDao().insert(db.getSession(), dto, project, null);
db.commit();
}
}
.setRole(permission)
.setComponentUuid(component.uuid())
.setComponentName(component.name());
- dbTester.getDbClient().groupPermissionDao().insert(dbTester.getSession(), dto, component);
+ dbTester.getDbClient().groupPermissionDao().insert(dbTester.getSession(), dto, component, null);
dbTester.commit();
}
.setRole(permission)
.setComponentUuid(component.uuid())
.setComponentName(component.name());
- dbTester.getDbClient().groupPermissionDao().insert(dbTester.getSession(), dto, component);
+ dbTester.getDbClient().groupPermissionDao().insert(dbTester.getSession(), dto, component, null);
dbTester.commit();
}
private void unsafeInsertProjectPermissionOnUser(ComponentDto component, UserDto user, String permission) {
UserPermissionDto dto = new UserPermissionDto(Uuids.create(), permission, user.getUuid(), component.uuid());
- dbTester.getDbClient().userPermissionDao().insert(dbTester.getSession(), dto, component, user);
+ dbTester.getDbClient().userPermissionDao().insert(dbTester.getSession(), dto, component, user, null);
dbTester.commit();
}