如何授权特定用户? [英] How do I authorize a particular user?

查看:73
本文介绍了如何授权特定用户?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在那里,我有一个应用程序来显示数据库中的内容。一次只能有一个访问此数据库。如果一个用户正在访问或查看该页面,则另一个用户将无法访问该页面。如何实现这样的任务?

hi there, I have an application to show something from a database. Only one can access this database at a time. if one user is accessing or viewing the page, the other user will not be able to access the same. How to achieve such task ?

推荐答案

您可以在新表中记录用户活动详细信息。例如,当用户启动此活动时,您可以使用表数据检查是否有其他用户处于活动状态。如果没有活动用户,您可以插入新记录,其中包含用户ID,活动开始时间等详细信息。

如果用户已经处于活动状态,您可以向已经有另一个用户活动的新用户显示消息此活动。

当用户完成活动时,您可以使用其他列更新记录。当用户在正在进行的活动中断开连接时会出现问题。您可能需要有活动超时来处理它。
You can log the user activity details in new table. for example when user start this activity you can go and check whether any other user active or not by using table data. if there is no active user, you can insert new record with details like, user id, activity start time etc..
if user already active you can show message to new users that already another user active on this activity.
When user finish the activity you can go and updated the record by using another column. There will be a issue when the user disconnected while activity in progress. You may need to have activity timeout to handle that.


这篇关于如何授权特定用户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆