In my web app I create the RBAC hierarchy and save it in the DB using a CLI command.
Auth assignments are handled in a separate way in another part of my app.
Each time my CLI command is run, it needs to clear all the DB data pertaining to auth items (items themselves and parent-child relationships) but not auth assignments. There are two methods that do mass deletion:
clearAll()
clearAuthAssignments()
none of which does what I need. There are also several methods working on individual basis. Hence to achieve a goal of mine I should either write a bulky foreach() or copy and paste a piece of code from CDbAuthManager.php (clearAll() method):
$this->db->createCommand("DELETE FROM {$this->itemChildTable}")->execute();
$this->db->createCommand("DELETE FROM {$this->itemTable}")->execute();
I think it’s worth adding a separate clearAuthItems() method to save people from hassle in situations like mine.