comparison roundup/rest.py @ 5658:3401daf8613b

Fix hardcoded /data Now we return one entry for each class the user may view.
author Ralf Schlatterbeck <rsc@runtux.com>
date Thu, 21 Mar 2019 11:23:09 +0100
parents 207e0f5d551c
children 1e51a709431c
comparison
equal deleted inserted replaced
5657:7e1b2a723253 5658:3401daf8613b
1219 return 200, result 1219 return 200, result
1220 1220
1221 @Routing.route("/data") 1221 @Routing.route("/data")
1222 @_data_decorator 1222 @_data_decorator
1223 def data(self, input): 1223 def data(self, input):
1224 """Describe the sublements of data 1224 """Describe the subelements of data
1225 1225
1226 FIXME: should have a key for every element under data in 1226 One entry for each class the user may view
1227 the schema the user can access. 1227 """
1228 This is just an example. 1228 result = {}
1229 """ 1229 uid = self.db.getuid ()
1230 result = { 1230 for cls in sorted (self.db.classes) :
1231 "issue": { "link": self.base_path + "/data/" + "issue" }, 1231 if self.db.security.hasPermission('View', uid, cls) :
1232 "status": { "link": self.base_path + "/data/" + "status" }, 1232 result [cls] = dict(link = self.base_path + '/data/' + cls)
1233 "keyword": { "link": self.base_path + "/data/" + "keyword" },
1234 "user": { "link": self.base_path + "/data/" + "user" }
1235 }
1236
1237 return 200, result 1233 return 200, result
1238 1234
1239 @Routing.route("/summary") 1235 @Routing.route("/summary")
1240 @_data_decorator 1236 @_data_decorator
1241 def summary(self, input): 1237 def summary(self, input):

Roundup Issue Tracker: http://roundup-tracker.org/