Revision 7736e11a

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

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

  
1189 1191
        r = self.conn.execute(s)
1190 1192
        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