'Will cleanup all unused permissions from the database
:param baseviews: A list of BaseViews class
:param menus: Menu class'

def security_cleanup(self, baseviews, menus):

    viewsmenus = self.get_all_view_menu()
    roles = self.get_all_roles()
    for viewmenu in viewsmenus:
        found = False
        for baseview in baseviews:
            if (viewmenu.name == baseview.__class__.__name__):
                found = True
                break
        if menus.find(viewmenu.name):
            found = True
        if (not found):
            permissions = self.find_permissions_view_menu(viewmenu)
            for permission in permissions:
                for role in roles:
                    self.del_permission_role(role, permission)
                self.del_permission_view_menu(permission.permission.name, viewmenu.name)
            self.del_view_menu(viewmenu.name)
