0

I'm using Yii framework for one of the internal application. I have different levels of users like admin, super admin.

In my application, superadmin need to keep track of all admin user DB activity (insert, update and delete) and also they can able to rollback a particular activity(For ex: updating firstname of a customer. While rollback , old firstname sould be retained).

I did some research but i couldn't find a solution.

Thanks in advance.

Shankar
  • 41
  • 1
  • 1
  • 3

1 Answers1

0

I created an extension letting you keep track of all the versions created for an active record model. Here is a little example:

book = new Book;
$book->title = 'The correctio';
$book->author = 'Jonathan Franzen';
$book->save();
echo $book->version; //1
$book->title = 'The corrections';
$book->save();
echo $book->version; //2

$book->toVersion(1);
echo $book->title; //'The correctio'
// saving a previous version creates a new one
$book->save();
echo $book->version; // 3

And to know who saved the model:

echo $book->versionCreatedBy; //"John Doe";
echo $book->versionComment; //"Creation of the book in the db";
echo $book->createdTime; // 11/10/2009
darkheir
  • 8,844
  • 6
  • 45
  • 66