samedi 31 décembre 2016

Avoiding simultaneous acces to a shared resource in a web application

I have a web application consisting of users having projects , projects belong to to a single user and are access by the URI:root/project/[pid] .

Now I have a middleware to restrict users from accessing each others projects. Although I also have a feature in my web application by which an user may share their projects with other users, so multiple users can access a single shared project.

The problem is I don't want them to access the same project simultaneously , say if project1 is shared by user1 and user2 . URI root/project/project1_id could be accessed by both but not at the same time .

I am currently thinking how I could do this , I have some ideas but wanted to know if there is best or easier way to do this.

I am thinking of altering the project table in the database to have an active flag which would be set to true every time any user accesses the project web page and unset when he/she leaves the webpage or the session ends.

But I have not sure if this would be the best way to go .

I am using laravel as a framework for my web application . So a solution within that framework would be great



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2hDpweJ
via IFTTT

Aucun commentaire:

Enregistrer un commentaire