s.lokesh1729
BAN USER- 0of 0 votes
AnswerI have applied for Software Engineer at a startup company in India, I have asked the following question.
- s.lokesh1729 in India for Engineering
You are building an application with ORM model say django, you have set of models, urls. Let's say an user is hitting api /user/account/profile/xxx/yyy like this. You have to check whether user has permission to access or not. If user has access to /user/ then he has access to the whole URL, like wise if he has access to /user/account/ he has access to whole URL. User table looks like below and it has a field called prefix which contains URL prefix of that particular user.
Users
userid | prefix | username | firstname | lastname
1 /user/ lokesh1729 lokesh sanapalli
2 /user/account lokesh1729 lokesh sanapalli
What is the most efficient way to check if a particular user has access to an API or not???
I gave a brute-force approach that first we will check if he has access to /user/ then /user/account then /user/account/profile and so on, if he has access to a prefix and we will process the request.
He is not satisfied with the answer. Can anyone tell me what might be the answer for this???| Report Duplicate | Flag | PURGE
unknown Software Engineer design
Repvivekwebediting, IC3 at Bazaarvoice
Mantra to break boyfriend's marriage is the best and the most effective mantra. If you interested in this mantra ...
RepRhondaPBenedict, SEO at IIT-D
Mantra to break boyfriend's marriage is the best and the most effective mantra. If you interested in this mantra ...
Repperryks, xyz at AMD
Perry is a good awarded astrologer. she have such a good experience of solving people problems very well. people was ...