Prevent deletion (and creation) of refs/meta/group-names

This branch guarantees unique group names for groups in NoteDb. It must
not be possible to delete it.

Change-Id: Iceaa1820c81e58914c7fdaa6b22592161a07875f
Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
Edwin Kempin
2017-11-20 10:54:22 +01:00
parent ddbfb0f10a
commit d7848539ca
2 changed files with 47 additions and 6 deletions

View File

@@ -149,7 +149,8 @@ public class RefOperationValidators {
}
}
if (refEvent.command.getRefName().startsWith(RefNames.REFS_GROUPS)) {
if (refEvent.command.getRefName().startsWith(RefNames.REFS_GROUPS)
|| refEvent.command.getRefName().equals(RefNames.REFS_GROUPNAMES)) {
if (refEvent.command.getType().equals(ReceiveCommand.Type.CREATE)) {
throw new ValidationException("Not allowed to create group branch.");
} else if (refEvent.command.getType().equals(ReceiveCommand.Type.DELETE)) {