{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from gs_quant.entities.entitlements import User\n", "from gs_quant.markets.baskets import Basket\n", "from gs_quant.session import Environment, GsSession" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "client = 'CLIENT ID'\n", "secret = 'CLIENT SECRET'\n", "\n", "GsSession.use(Environment.PROD, client_id=client, client_secret=secret, scopes=('read_user_profile modify_product_data',))" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "basket = Basket.get('GSMBXXXX') # substitute input with any identifier for a basket" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "First, retrieve the user object by inputting the user id that you'd like to unpermission (you may alternatively retrieve a user by email, or can retrieve a group instead. Refer to the other examples in this folder for examples of this). Then, you may update the entitlements block corresponding to the level of permissioning you'd like to modify (e.g., *'entitlements.view'*, *'entitlements.rebalance'*, etc.)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "user = User.get(user_id='user_id')\n", "\n", "basket.entitlements.admin.users.remove(user) # update the entitlements block 'groups' property\n", "\n", "basket.update()" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.4" } }, "nbformat": 4, "nbformat_minor": 4 }