comparison roundup/rest.py @ 7983:dd229bbdd32d

issue 2551353 - add roundup-classhelper Add test for rest/data/user/roles endpoint. Fix allow header returned from endpoint to allow GET only.
author John Rouillard <rouilj@ieee.org>
date Wed, 22 May 2024 19:36:00 -0400
parents fe0348bbe45b
children 8e310a7b5e09
comparison
equal deleted inserted replaced
7982:5f1e26f93b09 7983:dd229bbdd32d
1038 """ 1038 """
1039 if not self.client.db.user.has_role(self.client.db.getuid(), "Admin"): 1039 if not self.client.db.user.has_role(self.client.db.getuid(), "Admin"):
1040 raise Unauthorised( 1040 raise Unauthorised(
1041 'User does not have permission on "user.roles"') 1041 'User does not have permission on "user.roles"')
1042 1042
1043 self.client.setHeader(
1044 "Allow",
1045 "GET"
1046 )
1047
1043 return 200, {"collection": 1048 return 200, {"collection":
1044 [{"id": rolename,"name": rolename} 1049 [{"id": rolename,"name": rolename}
1045 for rolename in list(self.db.security.role.keys())]} 1050 for rolename in list(self.db.security.role.keys())]}
1046 1051
1047 @Routing.route("/data/<:class_name>/<:item_id>", 'GET') 1052 @Routing.route("/data/<:class_name>/<:item_id>", 'GET')

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