Esempio n. 1
0
    def edit(self, objid):
        """View method for edit. Enforce permissions, load the record, and call `add_edit`."""
        def action():
            obj = self.init_object(objid, 'edit')
            return self.add_edit(flask.request.method, obj)

        return requires_permissions(self.permissions['edit'])(action)()
Esempio n. 2
0
    def delete(self, objid):
        def action():
            self.init_object(objid, 'delete')

            try:
                self.orm_cls.delete(objid)
            except sa.exc.IntegrityError:
                return self.on_delete_failure()

            return self.on_delete_success()

        return requires_permissions(self.permissions['delete'])(action)()
Esempio n. 3
0
    def delete(self, objid):
        """View method for delete. Enforce permissions, load the record, run ORM delete.

        If delete succeeds, return result of `on_delete_success`.
        If delete fails, return result of `on_delete_failure`.
        """
        def action():
            self.init_object(objid, 'delete')

            try:
                self.orm_cls.delete(objid)
            except sa.exc.IntegrityError:
                return self.on_delete_failure()

            return self.on_delete_success()

        return requires_permissions(self.permissions['delete'])(action)()
Esempio n. 4
0
 def list(self):
     return requires_permissions(self.permissions['list'])(self.render_grid)()
Esempio n. 5
0
    def edit(self, objid):
        def action():
            obj = self.init_object(objid, 'edit')
            return self.add_edit(flask.request.method, obj)

        return requires_permissions(self.permissions['edit'])(action)()
Esempio n. 6
0
 def add(self):
     return requires_permissions(self.permissions['add'])(self.add_edit)(flask.request.method)
Esempio n. 7
0
 def list(self):
     """View method for list. Enforce permissions, then render grid via `render_grid`."""
     return requires_permissions(self.permissions['list'])(self.render_grid)()
Esempio n. 8
0
 def add(self):
     """View method for add. Enforce permissions and call `add_edit`."""
     return requires_permissions(self.permissions['add'])(self.add_edit)(flask.request.method)