def security_cleanup(self, baseviews, menus):
viewsmenus = self.get_all_view_menu()<EOL>roles = self.get_all_roles()<EOL>for viewmenu in viewsmenus:<EOL><INDENT>found = False<EOL>for baseview in baseviews:<EOL><INDENT>if viewmenu.name == baseview.__class__.__name__:<EOL><INDENT>found = True<EOL>break<EOL><DEDENT><DEDENT>if menus.find(viewmenu.name):<EOL><INDENT>found = True<EOL><DEDENT>if not found:<EOL><INDENT>permissions = self.find_permissions_view_menu(viewmenu)<EOL>for permission in permissions:<EOL><INDENT>for role in roles:<EOL><INDENT>self.del_permission_role(role, permission)<EOL><DEDENT>self.del_permission_view_menu(<EOL>permission.permission.name, viewmenu.name<EOL>)<EOL><DEDENT>self.del_view_menu(viewmenu.name)<EOL><DEDENT><DEDENT>
Will cleanup all unused permissions from the database

:param baseviews: A list of BaseViews class
:param menus: Menu class