comparison roundup/rest.py @ 7971:fe0348bbe45b

issue2551353 - Add roundup-classhelper for 2.4.0 release Changes to the classic template are not done yet. Still testing. This commit has document updates and changes to rest.py. rest.py: add /rest/data/user/role endpoint to core so the user doesn't have to add the /rest/roles endpoint via interfaces.py. It will only send roles for a user with Admin role and there is no way to override this currently. acknowledgements.txt: Added members of team3 to other contributors. Specified for all other contributes what they worked on. upgrading.txt: added classhelper section and basic template change directions. Linked to admin_guide for full directions. admin_guide.txt: documented install, translation, troubleshooting, config etc. user_guide.txt: added section on using the classhelper. Added reference to section earlier in the doc. Added image for section.
author John Rouillard <rouilj@ieee.org>
date Tue, 21 May 2024 01:17:28 -0400
parents 171ff2e487df
children dd229bbdd32d
comparison
equal deleted inserted replaced
7970:b63fcfc2c984 7971:fe0348bbe45b
1027 result['@total_size'] = total_len 1027 result['@total_size'] = total_len
1028 self.client.setHeader("X-Count-Total", str(total_len)) 1028 self.client.setHeader("X-Count-Total", str(total_len))
1029 self.client.setHeader("Allow", "OPTIONS, GET, POST") 1029 self.client.setHeader("Allow", "OPTIONS, GET, POST")
1030 return 200, result 1030 return 200, result
1031 1031
1032 @Routing.route("/data/user/roles", 'GET')
1033 @_data_decorator
1034 def get_roles(self, input):
1035 """Return all defined roles for users with Admin role.
1036 The User class property roles is a string but simulate
1037 it as a MultiLink to an actual Roles class.
1038 """
1039 if not self.client.db.user.has_role(self.client.db.getuid(), "Admin"):
1040 raise Unauthorised(
1041 'User does not have permission on "user.roles"')
1042
1043 return 200, {"collection":
1044 [{"id": rolename,"name": rolename}
1045 for rolename in list(self.db.security.role.keys())]}
1046
1032 @Routing.route("/data/<:class_name>/<:item_id>", 'GET') 1047 @Routing.route("/data/<:class_name>/<:item_id>", 'GET')
1033 @_data_decorator 1048 @_data_decorator
1034 def get_element(self, class_name, item_id, input): 1049 def get_element(self, class_name, item_id, input):
1035 """GET resource from object URI. 1050 """GET resource from object URI.
1036 1051

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