我目前正在創建一個應用程序,用戶可以從網站(將與他們安裝他們的服務器上的插件進行交互)控制的Minecraft服務器。我試圖想出一個合適的設計來允許每個服務器定義他們自己的用戶權限組。最後,會爲每個服務器選擇一個預定義的選項列表(我的插件將知道如何處理的選項),並將其分配給他們創建的組。我的目標有這麼本網站上的1個單用戶將有可能能夠在一臺服務器面板多個組,以及用戶能夠被分配給多臺服務器面板。架構爲用戶角色/權限
這是我目前已經想出了數據庫佈局:
Table: Roles (will hold the predefined roles)
Columns:
serverTypeId (to distinguish between roles allowed for the 2 versions of minecraft)
roleId (the role's unique id, primary key)
roleName (some name to distinguish the role's purpose)
Table: ServerGroup (will hold the custom per server groups)
Columns:
serverId (the server's unique id)
groupId (the server role's unique id, primary key)
groupName (name given to group, like Staff, Admin, etc)
roleList (a csv list of roleId's from the Roles table)
Table: ServerPermissions
Columns:
serverId (the server's unique id)
serverGroupId (the server's groupId that this user belongs to)
userId (the user's id that is unique to the whole website)
有沒有更好的方式來做到這一點?這是我能夠想出的最佳方式。我不是對SQL最熟悉的人,並且正在尋找改進方法。
RoleList中列是我不能肯定的,並沒有真的喜歡,我簡直不知道如何來取代它。你解釋的方式更有意義。謝謝! –