Skip to content

Commit 8d8b961

Browse files
committed
Fix hardcoded /data
Now we return one entry for each class the user may view.
1 parent 5afa9e7 commit 8d8b961

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

roundup/rest.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,19 +1221,15 @@ def describe(self, input):
12211221
@Routing.route("/data")
12221222
@_data_decorator
12231223
def data(self, input):
1224-
"""Describe the sublements of data
1224+
"""Describe the subelements of data
12251225
1226-
FIXME: should have a key for every element under data in
1227-
the schema the user can access.
1228-
This is just an example.
1226+
One entry for each class the user may view
12291227
"""
1230-
result = {
1231-
"issue": { "link": self.base_path + "/data/" + "issue" },
1232-
"status": { "link": self.base_path + "/data/" + "status" },
1233-
"keyword": { "link": self.base_path + "/data/" + "keyword" },
1234-
"user": { "link": self.base_path + "/data/" + "user" }
1235-
}
1236-
1228+
result = {}
1229+
uid = self.db.getuid ()
1230+
for cls in sorted (self.db.classes) :
1231+
if self.db.security.hasPermission('View', uid, cls) :
1232+
result [cls] = dict(link = self.base_path + '/data/' + cls)
12371233
return 200, result
12381234

12391235
@Routing.route("/summary")

0 commit comments

Comments
 (0)