Ejemplo n.º 1
0
    def add(name, type_id, app_id):
        ResourceGroup.get_by(
            name=name, resource_type_id=type_id, app_id=app_id) and abort(
                400, "ResourceGroup <{0}> is already existed".format(name))

        return ResourceGroup.create(name=name,
                                    resource_type_id=type_id,
                                    app_id=app_id)
Ejemplo n.º 2
0
    def delete(rg_id):
        rg = ResourceGroup.get_by_id(rg_id) or abort(404, "ResourceGroup <{0}> is not found".format(rg_id))

        rg.soft_delete()

        items = ResourceGroupItems.get_by(group_id=rg_id, to_dict=False)
        for item in items:
            item.soft_delete()
Ejemplo n.º 3
0
    def delete(rg_id):
        rg = ResourceGroup.get_by_id(rg_id) or abort(404, "ResourceGroup <{0}> is not found".format(rg_id))

        rg.soft_delete()

        items = ResourceGroupItems.get_by(group_id=rg_id, to_dict=False)
        for item in items:
            item.soft_delete()

        for i in RolePermission.get_by(group_id=rg_id, to_dict=False):
            i.soft_delete()
            role_rebuild.apply_async(args=(i.rid,), queue=ACL_QUEUE)
Ejemplo n.º 4
0
Archivo: acl.py Proyecto: 13052020/cmdb
 def _get_resource_group(self, name):
     return ResourceGroup.get_by(app_id=self.app_id,
                                 name=name,
                                 first=True,
                                 to_dict=False)