简体   繁体   English

用户管理:以用户定义的“组”,数据库架构和物流管理用户

[英]User Management: Managing users in user-defined “groups”, database schema and logistics

I'm a noob, development wise and logistically-wise. 我是一个菜鸟,明智的发展和后勤。

I'm developing a site that lets people take a test... 我正在开发一个允许人们进行测试的网站...

My client wants the ability for a user with the roll/privledge "admin" (a step below a super-admin) to be allowed to create users and only see/edit the users that they create... 我的客户希望允许具有特权/特权“ admin”(超级管理员之后的步骤)的用户创建用户,并且仅查看/编辑他们创建的用户...

The users created in that "category" or group need some information that their superior provides. 在该“类别”或组中创建的用户需要上级提供的一些信息。

For example, I log in as a "manager", I have the ability to invite people to take the test, and manage those people. 例如,我以“经理”身份登录,可以邀请其他人参加考试并管理这些人。 Before adding those people, I will have filled out a short survey about myself... 在添加这些人之前,我将对自己做一个简短的调查...

Right now, the users that are invited will be asked some of the same questions as the manager. 现在,将向被邀请的用户询问与管理员相同的问题。 I'd like to cut down the redundancy by using the information put into the database by the manager and apply it to the invited users. 我想通过使用管理器放入数据库中的信息来减少冗余并将其应用于受邀用户。

How do I set up my database to work with this criterion? 如何设置数据库以符合此条件? I'm a little confused about how to do this! 我对如何执行此操作有些困惑! Let me know if I can add more details... 让我知道是否可以添加更多详细信息...

(This is a mysql and php app) (这是一个mysql和php应用程序)

I am sure there are several ways to do this but here is one that comes to mind. 我敢肯定有几种方法可以做到这一点,但这是我想到的一种方法。

In the "users" database, I am sure you have a column to specify which manager is assigned to the user by some kind of user key. 我确信在“用户”数据库中,您有一列可以指定通过某种用户键将哪个经理分配给用户。 Well If this field has a value, then pull the info from that users (manager user) record. 好吧,如果此字段具有值,则从该用户(管理员用户)记录中提取信息。

Example: 例:

table 'users' 表“用户”
key----name------managerid-----questionone------questiontwo---- 密钥-名称------ managerid ------ questionone ------ questiontwo ----
1-------randy-----0------------------california----------c++-------------- 1 ------- randy ----- 0 ------------------加利福尼亚州---------- c ++ ----- ---------
2-------bob--------1------------------nevada------------------------------ 2 -------鲍勃-------- 1 ------------------内华达州---------------- -----------------

Since record(key)1 has managerid == 0 then use questiontwo record to answer "Question 2". 由于record(key)1的managerid == 0,因此请使用questiontwo记录来回答“问题2”。 Since record(key)2 has managerid == 1 then pull questiontwo from record(key)1 and use that for answer to question two. 由于record(key)2的managerid == 1,因此从record(key)1中拉出问题2,并将其用于回答问题2。

You could either insert this information into the record or use it from the manager record dynamically as needed, which thought the space is still being used in the database, would be helpful since manager data might be updated and you might not want to have to update all records with that share the managerid wheh info is changed. 您可以根据需要将这些信息插入记录中,也可以根据需要从经理记录中动态使用它,这认为该空间仍在数据库中使用,这将有所帮助,因为可能会更新经理数据并且您可能不想更新具有该共享的managerid信息的所有记录均已更改。

Make sense? 说得通?

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

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