vakt
vakt copied to clipboard
Using Vakt with Pandas
Hi, I would like to implement access control to a panda dataframe. I set up the whole policies...
I have a data frame called df, to which I have attached some attributes...
I would like to restrict query functions. I would like to restrict a user from using the following command for example:
df.info or df.loc[1:10] (those are basic examples).
I do not see how I can apply vakt for this use case.
Thank you so much for your answer.
Hi, I'm not sure it's possible to do it on the object's method invocation level. Vakt works on a higher level (like, in fact, any other access-control library). You'll need to use wrappers where you:
- call vakt to check the access rights
- call the underlying method of pandas objects (like df.info. etc.)
Thank you so much for you answer. Please pardon me if I am asking some obvious questions. For the object's methods you say it is not feasible but what if I have a csv file somewhere on my PC, a set of user attributes stored somewhere. The user is working, let's say on Jupyter and I would like to restrict his access to this csv file. Would this be possible?
In case you definitely need some other library methods calls to be restricted without any wrapper code from your side, you need an escape hatch in the form of monkey patching. Just google, how it's done in python.
Ok thank you so much. I will check that.