Revision deletion does not work currently because the Bean entity type do not implement the EntityAPIRevisionableInterface interface. The deletion method provided by Bean is incorrectly named and some other code is wrong too. Also, the 'delete' link is offered for the default revision which should not be the case either (deleting default revision should be forbidden). Here is a patch that fixes the bugs and forbids deletion on controller level. The menu item for deleting the active revision is still accessible though. The access check should actually happen on menu level. I was too lazy to do that :P

CommentFileSizeAuthor
revision-delete.patch3.45 KBfubhy
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

indytechcook’s picture

Issue tags: +Needs tests

Thanks fubhy, while I review this, can you please add some tests?

indytechcook’s picture

Status: Needs review » Needs work

So this follow the class hierarchy

BeanEntityAPIController extends EntityAPIControllerExportable
EntityAPIControllerExportable extends EntityAPIController
EntityAPIController implements EntityAPIControllerRevisionableInterface

therefor BeanEntityAPIController implements EntityAPIControllerRevisionableInterface

I know php relfection is a bit dumb when it comes to finding the implementing interface in inheritance but the method deleteRevision() is on EntityAPIController so that part of the patch isn't needed.

+++ b/bean.moduleundefined
@@ -564,7 +564,7 @@ function bean_load_multiple($bids = array(), $conditions = array(), $reset = FAL
 function bean_delete_revision($vid) {
-  return entity_get_controller('bean')->revisionDelete($vid);
+  return entity_get_controller('bean')->deleteRevision($vid);

This is probably the key piece.

indytechcook’s picture

So i pushed up some of this but it still needs tests.

We might want to look into adding revision level stuff to bean_access.

http://drupal.org/commitlog/commit/22232/9342623c4932e1b35b41137bbd716aa...