开发者

ERD Multi-user level access under a single account

Currently I have the following database design

A user is either a person or a business entity. How do I extend this database design so that under a single business account, a business can allow for multi user access?

Example a business might want to give access their control panel access to an accountant, a developer, etc... A developer should only be able to view and manage applications while an accountant can view / download transactions etc...

USER
Id
Name
Username
Password
...




PERSONAL_INFO
UserId (PK-FK)
FirstName
MiddleName
LastName
....


BUSINESS_INFO
UserId (PK-FK)
BusinessName
....

Would this do it?

USER_ACCESS?
Id
BusinessUserId 
GrantedUserId

USER开发者_如何学JAVA_PERMISSION
Id
UserAccessId
PermissionId

PERMISSION
Id
Name


i think, it's better to add the entity BUSINESS_INFO and the attribute BusinessInfoId (foreign key to BUSINESS_INFO table) to USER table. The BUSINESS_GROUP table will have the primary key BusinessInfoId (of int type, e.g.)

USER
UserId
BusinessInfoId (FK)
Name
Username
Password
FirstName
MiddleName
LastName
...

BUSINESS_INFO
BusinessInfoId (PK)
BusinessName
....

notice, PERSONAL_INFO table is redundant. its fields must be normalized in USER table

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜