jeudi 12 novembre 2015

designing system to direct content based on user permissions

I am developing a system where we have entities like User, Resource and Ticket. There will be one or more power/admin Users and thousands of Resources in the system. As every resource will get tickets raised by resource utilizing person, where in our system users will reply to those tickets.

With the above functionality every user will be assigned to one or more Resources to address tickets of those assigned Resources. When user logs-in system have to list top 20 tickets based on his assigned Resources. For that I cannot use in-clause as a user can be assigned to hundreds of resources, and will be performance hit.

My Approach: I am planning to design in such a way that on each ticket comes into system I process that and insert into User_Ticket(will have user_id, ticket_id, ticket as columns) materialized view based on Resource permission. So, now I have to query only tickets by logged in user ID, which will be quick. On each ticket update I will update all records of user_ticket matching updating ticket ID to have updated info in all places.

Problem with my approach:

1) If I assign user to a resource which is already having 100(can be million tickets) tickets won't get listed in his queue as they are not inserted into User_Ticket materialized view.

2) If I remove the user permission on a resource, for which User_Ticket view has records, still user will be able to access those records though he has no more permission on that resource.

3) To address above two cases with jobs is will take time and cannot see the impact immediately

I hope some one from SO community already gone thorough such scenario. And how did you solve it? Any better approach you can suggest?

Aucun commentaire:

Enregistrer un commentaire