def enable_hook(self, id): if cherrypy.session.get("usertype", "user") == "admin": return API.enable_hook(id) else: return json.dumps({"error": "User not authorized for this request"})