@Test
public void wsAction_whenRemovingLastOwnBrowsePermissionForPrivateProject_shouldFail() {
- ComponentDto project = db.components().insertPrivateProject().getMainBranchComponent();
+ ProjectDto project = db.components().insertPrivateProject().getProjectDto();
UserDto user = db.users().insertUser();
GroupDto projectAdminGroup = db.users().insertGroup();
- db.users().insertProjectPermissionOnGroup(projectAdminGroup, UserRole.USER, project);
- db.users().insertProjectPermissionOnGroup(projectAdminGroup, UserRole.ADMIN, project);
+ db.users().insertEntityPermissionOnGroup(projectAdminGroup, UserRole.USER, project);
+ db.users().insertEntityPermissionOnGroup(projectAdminGroup, UserRole.ADMIN, project);
userSession.logIn(user).setGroups(projectAdminGroup).addProjectPermission(UserRole.USER, project).addProjectPermission(UserRole.ADMIN, project);
TestRequest testRequest = newRequest()
- .setParam(PARAM_PROJECT_ID, project.uuid())
+ .setParam(PARAM_PROJECT_ID, project.getUuid())
.setParam(PARAM_GROUP_NAME, projectAdminGroup.getName())
.setParam(PARAM_PERMISSION, UserRole.USER);
public void wsAction_whenPrivateProjectAdminRemovesOwnBrowsePermission_shouldFail() {
loginAsAdmin();
UserDto admin = db.users().insertUser(requireNonNull(userSession.getLogin()));
- ComponentDto project = db.components().insertPrivateProject().getMainBranchComponent();
+ ProjectDto project = db.components().insertPrivateProject().getProjectDto();
db.users().insertProjectPermissionOnUser(admin, GlobalPermission.ADMINISTER.getKey(), project);
TestRequest request = newRequest()
.setParam(PARAM_USER_LOGIN, userSession.getLogin())
- .setParam(PARAM_PROJECT_ID, project.uuid())
+ .setParam(PARAM_PROJECT_ID, project.getUuid())
.setParam(PARAM_PERMISSION, UserRole.USER);
assertThatThrownBy(request::execute)