Revision 8b365874

b/snf-pithos-backend/pithos/backends/lib/sqlalchemy/node.py
1166 1166
        r.close()
1167 1167
        return l
1168 1168

  
1169
    def domain_object_list(self, domain, cluster=None):
1169
    def domain_object_list(self, domain, paths, cluster=None):
1170 1170
        """Return a list of (path, property list, attribute dictionary)
1171 1171
           for the objects in the specific domain and cluster.
1172 1172
        """
......
1184 1184
            s = s.where(v.c.cluster == cluster)
1185 1185
        s = s.where(v.c.serial == a.c.serial)
1186 1186
        s = s.where(a.c.domain == domain)
1187
        if paths:
1188
            s = s.where(n.c.path.in_(paths))
1187 1189

  
1188 1190
        r = self.conn.execute(s)
1189 1191
        rows = r.fetchall()
b/snf-pithos-backend/pithos/backends/lib/sqlite/node.py
1039 1039
        self.execute(q, args)
1040 1040
        return self.fetchone()
1041 1041

  
1042
    def domain_object_list(self, domain, cluster=None):
1042
    def domain_object_list(self, domain, paths, cluster=None):
1043 1043
        """Return a list of (path, property list, attribute dictionary)
1044 1044
           for the objects in the specific domain and cluster.
1045 1045
        """
......
1051 1051
             "where n.node = v.node and "
1052 1052
             "n.latest_version = v.serial and "
1053 1053
             "v.serial = a.serial and "
1054
             "a.domain = ? ")
1054
             "a.domain = ? and "
1055
             "n.path in (%s)" % ','.join(['?' for _ in range(len(paths))))
1055 1056
        args = [domain]
1057
        map(args.append, paths)
1056 1058
        if cluster != None:
1057 1059
            q += "and v.cluster = ?"
1058 1060
            args += [cluster]
b/snf-pithos-backend/pithos/backends/modular.py
1592 1592

  
1593 1593
    @backend_method
1594 1594
    def get_domain_objects(self, domain, user=None):
1595
        obj_list = self.node.domain_object_list(domain, CLUSTER_NORMAL)
1596
        if user != None:
1597
            obj_list = [t for t in obj_list \
1598
                if self._has_read_access(user, t[0])]
1595
        allowed_paths = self.permissions.access_list_paths(user)
1596
        if not allowed_paths:
1597
            return []
1598
        obj_list = self.node.domain_object_list(
1599
            domain, allowed_paths, CLUSTER_NORMAL)
1599 1600
        return [(path,
1600 1601
                 self._build_metadata(props, user_defined_meta),
1601
                 self.permissions.access_get(path)) \
1602
            for path, props, user_defined_meta in obj_list]
1602
                 self.permissions.access_get(path)) for
1603
                path, props, user_defined_meta in obj_list]
1603 1604

  
1604 1605
    # util functions
1605 1606

  

Also available in: Unified diff