this.componentUuid = componentUuid;
this.componentName = name;
this.isPrivate = isPrivate;
- this.qualifier = this.getQualifier(qualifier);
+ this.qualifier = getQualifier(qualifier);
}
public ComponentNewValue(String uuid, String name, String key, boolean enabled, String path, @Nullable String qualifier) {
protected String componentName;
@Nullable
- protected String role;
+ protected String permission;
@Nullable
protected String qualifier;
protected PermissionNewValue(@Nullable String permissionUuid, @Nullable String componentUuid, @Nullable String componentName,
- @Nullable String role, @Nullable String qualifier) {
+ @Nullable String permission, @Nullable String qualifier) {
this.permissionUuid = permissionUuid;
this.componentUuid = componentUuid;
this.componentName = componentName;
this.qualifier = getQualifier(qualifier);
- this.role = role;
+ this.permission = permission;
}
@CheckForNull
}
@CheckForNull
- public String getRole() {
- return this.role;
+ public String getPermission() {
+ return this.permission;
}
@CheckForNull
private String description;
@Nullable
- private String role;
+ private String permission;
@Nullable
private String userUuid;
this.description = permissionTemplateDto.getDescription();
}
- public PermissionTemplateNewValue(@Nullable String templateUuid, @Nullable String name, @Nullable String role,
+ public PermissionTemplateNewValue(@Nullable String templateUuid, @Nullable String name, @Nullable String permission,
@Nullable String userUuid, @Nullable String userLogin, @Nullable String groupUuid, @Nullable String groupName) {
this.templateUuid = templateUuid;
this.name = name;
- this.role = role;
+ this.permission = permission;
this.userUuid = userUuid;
this.userLogin = userLogin;
this.groupUuid = groupUuid;
this.groupName = groupName;
}
- public PermissionTemplateNewValue(String templateUuid, String role, String name, boolean withProjectCreator) {
+ public PermissionTemplateNewValue(String templateUuid, String permission, String name, boolean withProjectCreator) {
this.templateUuid = templateUuid;
this.name = name;
- this.role = role;
+ this.permission = permission;
this.withProjectCreator = withProjectCreator;
}
}
@CheckForNull
- public String getRole() {
- return this.role;
+ public String getPermission() {
+ return this.permission;
}
@CheckForNull
addField(sb, "\"name\": ", this.name, true);
addField(sb, "\"keyPattern\": ", this.keyPattern, true);
addField(sb, "\"description\": ", this.description, true);
- addField(sb, "\"role\": ", this.role, true);
+ addField(sb, "\"permission\": ", this.permission, true);
addField(sb, "\"userUuid\": ", this.userUuid, true);
addField(sb, "\"userLogin\": ", this.userLogin, true);
addField(sb, "\"groupUuid\": ", this.groupUuid, true);
verify(auditPersister).addGroupPermission(eq(dbSession), newValueCaptor.capture());
GroupPermissionNewValue newValue = newValueCaptor.getValue();
assertNewValue(newValue, dto.getUuid(), group.getUuid(), group.getName(), null, dto.getRole(), null, null);
- assertThat(newValue).hasToString("{\"permissionUuid\": \"1\", \"role\": \"admin\", \"groupUuid\": \"guuid\", \"groupName\": \"gname\" }");
+ assertThat(newValue).hasToString("{\"permissionUuid\": \"1\", \"permission\": \"admin\", \"groupUuid\": \"guuid\", \"groupName\": \"gname\" }");
underTest.delete(dbSession, ADMIN, group.getUuid(), group.getName(), null, null);
verify(auditPersister).deleteGroupPermission(eq(dbSession), newValueCaptor.capture());
newValue = newValueCaptor.getValue();
assertNewValue(newValue, null, group.getUuid(), group.getName(), null, ADMIN, null, null);
- assertThat(newValue).hasToString("{\"role\": \"admin\", \"groupUuid\": \"guuid\", \"groupName\": \"gname\" }");
+ assertThat(newValue).hasToString("{\"permission\": \"admin\", \"groupUuid\": \"guuid\", \"groupName\": \"gname\" }");
}
@Test
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\", \"role\": \"admin\", \"groupUuid\": \"guuid\", \"groupName\": \"gname\", \"componentUuid\": \"cuuid\", "
+ 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");
- assertThat(newValue).hasToString("{\"permissionUuid\": \"1\", \"role\": \"admin\", \"componentUuid\": \"cuuid\", \"componentName\": \"cname\", \"qualifier\": \"project\" }");
+ assertThat(newValue).hasToString("{\"permissionUuid\": \"1\", \"permission\": \"admin\", \"componentUuid\": \"cuuid\", "
+ + "\"componentName\": \"cname\", \"qualifier\": \"project\" }");
underTest.deleteByRootComponentUuidForAnyOne(dbSession, project);
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\", \"role\": \"admin\", \"groupUuid\": \"guuid\", \"groupName\": \"gname\", "
+ assertThat(newValue).hasToString("{\"permissionUuid\": \"1\", \"permission\": \"admin\", \"groupUuid\": \"guuid\", \"groupName\": \"gname\", "
+ "\"componentUuid\": \"cuuid\", \"componentName\": \"cname\", \"qualifier\": \"project\" }");
underTest.deleteByRootComponentUuidAndPermission(dbSession, dto.getRole(), project);
verify(auditPersister).deleteGroupPermission(eq(dbSession), newValueCaptor.capture());
newValue = newValueCaptor.getValue();
assertNewValue(newValue, null, null, null, project.uuid(), ADMIN, project.name(), "project");
- assertThat(newValue).hasToString("{\"role\": \"admin\", \"componentUuid\": \"cuuid\", \"componentName\": \"cname\", \"qualifier\": \"project\" }");
+ assertThat(newValue).hasToString("{\"permission\": \"admin\", \"componentUuid\": \"cuuid\", \"componentName\": \"cname\", \"qualifier\": \"project\" }");
}
@Test
UserPermissionNewValue newValue = newValueCaptor.getValue();
assertThat(newValue)
.extracting(UserPermissionNewValue::getPermissionUuid, UserPermissionNewValue::getUserUuid, UserPermissionNewValue::getUserLogin,
- UserPermissionNewValue::getComponentUuid, UserPermissionNewValue::getRole, UserPermissionNewValue::getComponentName, UserPermissionNewValue::getQualifier)
+ UserPermissionNewValue::getComponentUuid, UserPermissionNewValue::getPermission, UserPermissionNewValue::getComponentName, UserPermissionNewValue::getQualifier)
.containsExactly(dto.getUuid(), user.getUuid(), user.getLogin(), null, dto.getPermission(), null, null);
assertThat(newValue.toString()).doesNotContain("projectUuid");
newValue = newValueCaptor.getValue();
assertThat(newValue)
.extracting(UserPermissionNewValue::getPermissionUuid, UserPermissionNewValue::getUserUuid, UserPermissionNewValue::getUserLogin, UserPermissionNewValue::getComponentUuid,
- UserPermissionNewValue::getRole, UserPermissionNewValue::getComponentName)
+ UserPermissionNewValue::getPermission, UserPermissionNewValue::getComponentName)
.containsExactly(null, user.getUuid(), user.getLogin(), null, dto.getPermission(), null);
assertThat(newValue.toString()).doesNotContain("permissionUuid");
}
UserPermissionNewValue newValue = newValueCaptor.getValue();
assertThat(newValue)
.extracting(UserPermissionNewValue::getPermissionUuid, UserPermissionNewValue::getUserUuid, UserPermissionNewValue::getUserLogin, UserPermissionNewValue::getComponentUuid,
- UserPermissionNewValue::getRole, UserPermissionNewValue::getComponentName, UserPermissionNewValue::getQualifier)
+ UserPermissionNewValue::getPermission, UserPermissionNewValue::getComponentName, UserPermissionNewValue::getQualifier)
.containsExactly(dto.getUuid(), user.getUuid(), user.getLogin(), project.uuid(), dto.getPermission(), project.name(), "project");
assertThat(newValue.toString()).contains("componentUuid");
newValue = newValueCaptor.getValue();
assertThat(newValue)
.extracting(UserPermissionNewValue::getPermissionUuid, UserPermissionNewValue::getUserUuid, UserPermissionNewValue::getUserLogin,
- UserPermissionNewValue::getComponentUuid, UserPermissionNewValue::getRole, UserPermissionNewValue::getComponentName)
+ UserPermissionNewValue::getComponentUuid, UserPermissionNewValue::getPermission, UserPermissionNewValue::getComponentName)
.containsExactly(null, user.getUuid(), user.getLogin(), project.uuid(), dto.getPermission(), project.name());
assertThat(newValue.toString())
.doesNotContain("permissionUuid");
UserPermissionNewValue newValue = newValueCaptor.getValue();
assertThat(newValue)
.extracting(UserPermissionNewValue::getPermissionUuid, UserPermissionNewValue::getUserUuid, UserPermissionNewValue::getComponentUuid,
- UserPermissionNewValue::getRole, UserPermissionNewValue::getComponentName, UserPermissionNewValue::getQualifier)
+ UserPermissionNewValue::getPermission, UserPermissionNewValue::getComponentName, UserPermissionNewValue::getQualifier)
.containsExactly(dto.getUuid(), user.getUuid(), portfolio.uuid(), dto.getPermission(), portfolio.name(), "portfolio");
assertThat(newValue.toString())
.contains("componentUuid");
UserPermissionNewValue newValue = newValueCaptor.getValue();
assertThat(newValue)
.extracting(UserPermissionNewValue::getPermissionUuid, UserPermissionNewValue::getUserUuid, UserPermissionNewValue::getComponentUuid,
- UserPermissionNewValue::getRole, UserPermissionNewValue::getComponentName, UserPermissionNewValue::getQualifier)
+ UserPermissionNewValue::getPermission, UserPermissionNewValue::getComponentName, UserPermissionNewValue::getQualifier)
.containsExactly(dto.getUuid(), user.getUuid(), application.uuid(), dto.getPermission(), application.name(), "application");
assertThat(newValue.toString())
.contains("componentUuid");
UserPermissionNewValue newValue = newValueCaptor.getValue();
assertThat(newValue)
.extracting(UserPermissionNewValue::getPermissionUuid, UserPermissionNewValue::getUserUuid, UserPermissionNewValue::getUserLogin, UserPermissionNewValue::getComponentUuid,
- UserPermissionNewValue::getRole, UserPermissionNewValue::getComponentName, UserPermissionNewValue::getQualifier)
+ UserPermissionNewValue::getPermission, UserPermissionNewValue::getComponentName, UserPermissionNewValue::getQualifier)
.containsExactly(null, null, null, project.uuid(), SCAN_EXECUTION, project.name(), "project");
assertThat(newValue.toString()).doesNotContain("userUuid");
}
UserPermissionNewValue newValue = newValueCaptor.getValue();
assertThat(newValue)
.extracting(UserPermissionNewValue::getPermissionUuid, UserPermissionNewValue::getUserUuid, UserPermissionNewValue::getUserLogin, UserPermissionNewValue::getComponentUuid,
- UserPermissionNewValue::getRole, UserPermissionNewValue::getComponentName, UserPermissionNewValue::getQualifier)
+ UserPermissionNewValue::getPermission, UserPermissionNewValue::getComponentName, UserPermissionNewValue::getQualifier)
.containsExactly(null, user.getUuid(), user.getLogin(), null, null, null, null);
assertThat(newValue.toString()).contains("userUuid");
}
PermissionTemplateNewValue newValue = newValueCaptor.getValue();
assertThat(newValue)
.extracting(PermissionTemplateNewValue::getTemplateUuid, PermissionTemplateNewValue::getName,
- PermissionTemplateNewValue::getRole, PermissionTemplateNewValue::isWithProjectCreator)
+ PermissionTemplateNewValue::getPermission, PermissionTemplateNewValue::isWithProjectCreator)
.containsExactly(dto.getTemplateUuid(), "template", dto.getPermission(), dto.getWithProjectCreator());
assertThat(newValue.toString()).contains("withProjectCreator");
}
PermissionTemplateNewValue newValue = newValueCaptor.getValue();
assertThat(newValue)
.extracting(PermissionTemplateNewValue::getTemplateUuid, PermissionTemplateNewValue::getName,
- PermissionTemplateNewValue::getRole, PermissionTemplateNewValue::isWithProjectCreator)
+ PermissionTemplateNewValue::getPermission, PermissionTemplateNewValue::isWithProjectCreator)
.containsExactly(updated.getTemplateUuid(), "template", updated.getPermission(), updated.getWithProjectCreator());
assertThat(newValue.toString()).contains("withProjectCreator");
}
PermissionTemplateNewValue newValue = newValueCaptor.getValue();
assertThat(newValue)
.extracting(PermissionTemplateNewValue::getTemplateUuid, PermissionTemplateNewValue::getName,
- PermissionTemplateNewValue::getRole, PermissionTemplateNewValue::getUserUuid, PermissionTemplateNewValue::getUserLogin)
+ PermissionTemplateNewValue::getPermission, PermissionTemplateNewValue::getUserUuid, PermissionTemplateNewValue::getUserLogin)
.containsExactly(dto.getUuid(), dto.getName(), ADMIN, user.getUuid(), user.getLogin());
assertThat(newValue.toString()).doesNotContain("groupUuid");
newValue = newValueCaptor.getValue();
assertThat(newValue)
.extracting(PermissionTemplateNewValue::getTemplateUuid, PermissionTemplateNewValue::getName,
- PermissionTemplateNewValue::getRole, PermissionTemplateNewValue::getUserUuid, PermissionTemplateNewValue::getUserLogin)
+ PermissionTemplateNewValue::getPermission, PermissionTemplateNewValue::getUserUuid, PermissionTemplateNewValue::getUserLogin)
.containsExactly(dto.getUuid(), dto.getName(), ADMIN, user.getUuid(), user.getLogin());
assertThat(newValue.toString()).doesNotContain("groupUuid");
}
PermissionTemplateNewValue newValue = newValueCaptor.getValue();
assertThat(newValue)
.extracting(PermissionTemplateNewValue::getTemplateUuid, PermissionTemplateNewValue::getName,
- PermissionTemplateNewValue::getRole, PermissionTemplateNewValue::getUserUuid, PermissionTemplateNewValue::getUserLogin)
+ PermissionTemplateNewValue::getPermission, PermissionTemplateNewValue::getUserUuid, PermissionTemplateNewValue::getUserLogin)
.containsExactly(null, null, null, user.getUuid(), user.getLogin());
assertThat(newValue.toString()).doesNotContain("groupUuid");
}
PermissionTemplateNewValue newValue = newValueCaptor.getValue();
assertThat(newValue)
.extracting(PermissionTemplateNewValue::getTemplateUuid, PermissionTemplateNewValue::getName,
- PermissionTemplateNewValue::getRole, PermissionTemplateNewValue::getGroupUuid, PermissionTemplateNewValue::getGroupName)
+ PermissionTemplateNewValue::getPermission, PermissionTemplateNewValue::getGroupUuid, PermissionTemplateNewValue::getGroupName)
.containsExactly(dto.getUuid(), dto.getName(), ADMIN, group.getUuid(), group.getName());
assertThat(newValue.toString()).contains("groupUuid");
newValue = newValueCaptor.getValue();
assertThat(newValue)
.extracting(PermissionTemplateNewValue::getTemplateUuid, PermissionTemplateNewValue::getName,
- PermissionTemplateNewValue::getRole, PermissionTemplateNewValue::getGroupUuid, PermissionTemplateNewValue::getGroupName)
+ PermissionTemplateNewValue::getPermission, PermissionTemplateNewValue::getGroupUuid, PermissionTemplateNewValue::getGroupName)
.containsExactly(dto.getUuid(), dto.getName(), ADMIN, group.getUuid(), group.getName());
assertThat(newValue.toString()).contains("groupUuid");
}
PermissionTemplateNewValue newValue = newValueCaptor.getValue();
assertThat(newValue)
.extracting(PermissionTemplateNewValue::getTemplateUuid, PermissionTemplateNewValue::getName,
- PermissionTemplateNewValue::getRole, PermissionTemplateNewValue::getGroupUuid, PermissionTemplateNewValue::getGroupName)
+ PermissionTemplateNewValue::getPermission, PermissionTemplateNewValue::getGroupUuid, PermissionTemplateNewValue::getGroupName)
.containsExactly(templateDto.getUuid(), templateDto.getName(), ADMIN, templateGroupDto.getGroupUuid(), templateGroupDto.getGroupName());
assertThat(newValue.toString()).doesNotContain("userUuid");
newValue = newValueCaptor.getValue();
assertThat(newValue)
.extracting(PermissionTemplateNewValue::getTemplateUuid, PermissionTemplateNewValue::getName,
- PermissionTemplateNewValue::getRole, PermissionTemplateNewValue::getGroupUuid, PermissionTemplateNewValue::getGroupName)
+ PermissionTemplateNewValue::getPermission, PermissionTemplateNewValue::getGroupUuid, PermissionTemplateNewValue::getGroupName)
.containsExactly(null, null, null, templateGroupDto.getGroupUuid(), templateGroupDto.getGroupName());
assertThat(newValue.toString()).doesNotContain("userUuid");
}