JSON结构-授权用户菜单

JSON结构-授权用户菜单,json,database,authentication,authorization,Json,Database,Authentication,Authorization,我想通过用户登录显示菜单。等等:如果我用user1登录,只需显示menu1、menu2、menu3。如果我使用user2登录,只需显示menu2和menu3 我已经为每个模块创建了JSON结构 tiles : { module1 : [ { "header":"Data Peserta", "subheader":

我想通过用户登录显示菜单。等等:如果我用user1登录,只需显示menu1、menu2、menu3。如果我使用user2登录,只需显示menu2和menu3

我已经为每个模块创建了JSON结构

tiles :
        {
                module1 : [
                    {
                        "header":"Data Peserta",
                        "subheader":"Kepesertaan",
                        "icon":"sap-icon://log",
                        "route":"datapeserta"
                    },
                    {
                        "header":"Header1",
                        "subheader":"Kepesertaan",
                        "icon":"sap-icon://delete",
                        "route":"first"
                    },
                    {
                        "header":"Header1",
                        "subheader":"Kepesertaan",
                        "icon":"sap-icon://line-charts",
                        "route":"first"
                    }                       
                ],

                module2 : [
                    {
                        "header":"Header2",
                        "subheader":"Layanan dan Manfaat",
                        "icon":"sap-icon://add-filter",
                        "route":"first"
                    },
                    {
                        "header":"Header2",
                        "subheader":"Layanan dan Manfaat",
                        "icon":"sap-icon://add-filter",
                        "route":"first"
                    },
                    {
                        "header":"Header2",
                        "subheader":"Layanan dan Manfaat",
                        "icon":"sap-icon://action",
                        "route":"first"
                    }                       
                ],                      

                module3 : [
                    {
                        "header":"Header3",
                        "subheader":"Investasi",
                        "icon":"sap-icon://activate",
                        "route":"first"
                    },
                    {
                        "header":"Header3",
                        "subheader":"Investasi",
                        "icon":"sap-icon://display-more",
                        "route":"first"
                    },
                    {
                        "header":"Header3",
                        "subheader":"Investasi",
                        "icon":"sap-icon://customize",
                        "route":"first"
                    }                       
                ]
        }
因此,每个模块都有一个菜单,并且都有3个模块。如何为用户授权编辑此json结构?我把用户对象放在这个JSON模型的什么地方


谢谢大家。

我并不清楚这个问题,但是如果您想将它合并到同一个JSON中,那么您可以将“userlist”作为数组属性。类似这样的事情(我以模块1为例):

{
“标题”:“数据佩塞塔”,
“副标题”:“Kepesertaan”,
“图标”:“sap-icon://log",
“路线”:“datapeserta”,
“用户列表”:[“用户1”、“用户2”、“用户3”]
},
{
“header”:“Header1”,
“副标题”:“Kepesertaan”,
“图标”:“sap-icon://delete",
“路线”:“第一”,
“用户列表”:[“用户2”、“用户3”]
}

这将为您提供更细粒度的访问控制。在这种情况下,在模块内,哪个用户要显示哪个标题/子标题等