-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CORE-368] Validate entitytype rename #3212
Conversation
@@ -243,6 +245,7 @@ class EntityService(protected val ctx: RawlsRequestContext, | |||
def renameEntityType(workspaceName: WorkspaceName, oldName: String, renameInfo: EntityTypeRename): Future[Int] = { | |||
import org.broadinstitute.dsde.rawls.dataaccess.slick.{DataAccess, ReadAction} | |||
|
|||
validateEntityName(renameInfo.newName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
validateEntityName
checks syntax for an entity name, not an entity type. See
rawls/core/src/main/scala/org/broadinstitute/dsde/rawls/dataaccess/slick/EntityComponent.scala
Lines 1408 to 1423 in 4143698
private def validateEntity(entity: Entity): Unit = { | |
if (entity.entityType.equalsIgnoreCase(Attributable.workspaceEntityType)) { | |
throw new RawlsFatalExceptionWithErrorReport( | |
errorReport = ErrorReport( | |
message = s"Entity type ${Attributable.workspaceEntityType} is reserved and cannot be overwritten", | |
statusCode = StatusCodes.BadRequest | |
) | |
) | |
} | |
validateUserDefinedString(entity.entityType) | |
validateEntityName(entity.name) | |
entity.attributes.keys.foreach { attrName => | |
validateUserDefinedString(attrName.name) | |
validateAttributeName(attrName, entity.entityType) | |
} | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah dang I looked very carefully at the different methods and still picked the wrong one 😵
Ticket: https://broadworkbench.atlassian.net/browse/CORE-368
Adds in name validation when renaming an entity. DataBiosphere/terra-ui#5272 also does this from the front end.
PR checklist
model/
, then you should publish a new officialrawls-model
and perform the corresponding dependency updates as specified in the README: