Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

haakym's avatar

Prevent/alert admin users from working on the same application

Hey everyone.

Apologies if the title wasn't clear, I struggled to sum up the issue in a few words.

I'm going to begin working on an application that will show the admin user a list of paginated applications that the admin will need to approve. As there will be more than one admin user I am anticipating the issue that two admin users may work on the same application at the same time. Of course they could communicate with one another to split the work up so they do not conflict on what they are working on, however I think it would be great if I could provide a technical solution within in the app.

My initial thoughts are that I would need to provide some real time notification (perhaps using socket.io/redis) to show admin users if an application was currently being viewed by another admin user. However, I'm not sure I will have access to redis as I think the solution may need to be implemented on shared hosting that doesn't provide that technology, unless there's some way of installing it? Other thoughts I had were using ajax or record locking from the DB side but they don't seem to be a complete solution.

A further issue is that after showing a notification to admin users that an application is currently being worked on, how do I know when to stop it, let's say the user closed the page and went for lunch - would there be a way to detect this and stop the notification?

TL;DR: I want to stop admin users from working on the same applications by providing notifications/alerts.

Any ideas or guidance would be most appreciated! Thank you.

0 likes
5 replies
RachidLaasri's avatar

Hi,

  • The basic idea : Add a column to the application table, let's say "locked" for example, when an admin is working on an application the value will changed to 1.

  • Real time notification : It would be perfect if you could use socket.io/redis but if that's not available using ajax will do the trick.

  • Updating application status if a user left : Maybe you can set a cron job each 5 min, this job will make all the application "locked" column value equal to 0, so if the admin is still working on the application it will be updated again to 1, if not it will stay 0.

handy_man's avatar

You could assign each application to a different admin at the time of it entering your system? so an admin should only look at his own assigned applications and deal with them.

This could be automated or just done at the time of an admin opening an application thus assigning the application to them, which if assigned could then give our notifications to other admins or generally not show it to them.

cleanse's avatar

On Page load:

    window.onload = function() {
        //ajax telling database that admin is viewing this app#id
    };

On page exit:

    window.onbeforeunload = function() {
            //ajax telling database that admin is no longer viewing this app#id
    };
jekinney's avatar

I set those situations as a admin accepts some task it is assigned to that user. They can put it back as in assigned if for some reason they can't perform the task at hand.

Imo the issue with notifications is they can be ignored and you still need a fail safe just in case.

haakym's avatar

Thanks to all for the great comments! This is giving me a good footing to get started with.

As much as I would love to implement the real time notifications I think it may be more effort than it's worth!

@handy_man Yep think this is what I'm going to do, when the user enters the application any others that enter after will be notified and it would essentially be locked to the user that initially opened it. I will decide on some way of freeing the application up if they don't finish it after a time period, perhaps a cron as @RachidLaasri suggested or some reset thing that happens every day.

@jekinney Agreed, I will have to give some attention to stopping applications having two actions performed on it that go beyond the notifications.

@cleanse thanks for that, very useful!

I will try to post back here after I have a solution working for those interested. Once again, thanks for all the useful comments!

Please or to participate in this conversation.