简体   繁体   English

如何在公共用户访问特定页面时对其进行授权,以实现只读目的

[英]How to authorize public users when they access on the specific page, for read-only purposes

Its general type of question. 它的一般问题类型。 We have web application writen in Zend, and we are making reports for our registred users. 我们在Zend中编写了Web应用程序,我们正在为我们的注册用户编写报告。 Now, we want to create some specific report for nonregistred users and send them link so they can see that report. 现在,我们希望为非注册用户创建一些特定报告,并发送链接以便他们可以看到该报告。 But we don't want to let other users to access that page. 但我们不想让其他用户访问该页面。

One idea is to make hashable URN, at least one part, something like 一个想法是制作可清洗的URN,至少一部分,类似于

www.myaddress.com/2309039dskdfskj4/ReportStats/ 

What's best solution for this problem 什么是这个问题的最佳解决方案

I would send out an email to what non-registered users you do want to show the report to (say people from a mailing list you maintain). 我会发送一封电子邮件给你想要向你显示报告的非注册用户(比如你维护的邮件列表中的人)。

In that email, have a link they can go to: example.com/reportsample.php 在该电子邮件中,有一个链接,他们可以去: example.com/reportsample.php

On that page, have them confirm their email address (only send requests to users you have on file) and let them know a one-time report request invite has been sent that will expire in 24 hours. 在该页面上,让他们确认他们的电子邮件地址(仅向您存档的用户发送请求)并让他们知道已发送的一次性报告请求邀请将在24小时后到期。

In a table on your database, write a record that stores a random id value and make a field in that record read "NOTVIEWED" 在数据库的表中,写一个存储随机id值的记录,并使该记录中的字段显示为“NOTVIEWED”

Then, once the user checks their email, they see a link to: example.com/reportsample.php?access=123456 (where 123456 is random ID) 然后,一旦用户检查他们的电子邮件,他们会看到一个链接: example.com/reportsample.php? access=123456(其中123456是随机ID)

Once the user clicks on it, they can view the report and the database record for that ID is updated to be "VIEWED." 一旦用户点击它,他们就可以查看报告,并将该ID的数据库记录更新为“VIEWED”。

If anyone tries to view that link again, they won't be able to - the user will have to request access again. 如果有人再次尝试查看该链接,他们将无法 - 用户将不得不再次请求访问权限。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM