Exemplo n.º 1
0
    def delete(cls, users_group_id):
        try:

            # check if this group is not assigned to repo
            assigned_groups = (
                UsersGroupRepoToPerm.query().filter(UsersGroupRepoToPerm.users_group_id == users_group_id).all()
            )

            if assigned_groups:
                raise UsersGroupsAssignedException("RepoGroup assigned to %s" % assigned_groups)

            users_group = cls.get(users_group_id, cache=False)
            Session.delete(users_group)
            Session.commit()
        except:
            log.error(traceback.format_exc())
            Session.rollback()
            raise
Exemplo n.º 2
0
    def delete(cls, user_group_id):
        try:

            # check if this group is not assigned to repo
            assigned_groups = UserGroupRepoToPerm.query()\
                .filter(UserGroupRepoToPerm.users_group_id ==
                        user_group_id).all()

            if assigned_groups:
                raise UserGroupAssignedException(
                    'UserGroup assigned to %s' % assigned_groups)

            users_group = cls.get(user_group_id, cache=False)
            Session.delete(users_group)
            Session.commit()
        except:
            log.error(traceback.format_exc())
            Session.rollback()
            raise
Exemplo n.º 3
0
    def _clean_notifications(self):
        for n in Notification.query().all():
            Session.delete(n)

        Session.commit()
        self.assertEqual(Notification.query().all(), [])
Exemplo n.º 4
0
 def delete(cls, id_):
     obj = cls.query().get(id_)
     Session.delete(obj)
Exemplo n.º 5
0
 def delete_user_permission(self, repository, user):
     current = self.get_user_permission(repository, user)
     if current:
         Session.delete(current)
         Session.commit()
Exemplo n.º 6
0
 def delete(cls, id_):
     obj = cls.query().get(id_)
     Session.delete(obj)
     Session.commit()
Exemplo n.º 7
0
    def tearDown(self):
        for n in Notification.query().all():
            Session.delete(n)

        Session.commit()
        self.assertEqual(Notification.query().all(), [])
Exemplo n.º 8
0
    def _clean_notifications(self):
        for n in Notification.query().all():
            Session.delete(n)

        Session.commit()
        self.assertEqual(Notification.query().all(), [])
Exemplo n.º 9
0
 def delete(cls, id_):
     obj = Session.query(cls).get(id_)
     Session.delete(obj)
     Session.commit()
Exemplo n.º 10
0
 def tearDown(self):
     for n in Notification.query().all():
         inst = Notification.get(n.notification_id)
         Session.delete(inst)
     Session.commit()
Exemplo n.º 11
0
    def tearDown(self):
        for n in Notification.query().all():
            Session.delete(n)

        Session.commit()
        self.assertEqual(Notification.query().all(), [])