简体   繁体   English

mean.js 中没有添加文章按钮?

[英]No add article button in mean.js?

I downloaded the latest version of mean.js on github: https://github.com/meanjs/mean我在github上下载了最新版本的mean.js: https : //github.com/meanjs/mean

But to my great surprise, they seeem to have removed the add article option in the menu dropdown...但令我惊讶的是,他们似乎已经删除了菜单下拉菜单中的添加文章选项......

Is this normal ?这正常吗? Should I download another version ?我应该下载另一个版本吗?

I believe that option is still available.我相信这个选项仍然可用。 In MEAN.js only accounts with admin rights can create a new article.在 MEAN.js 中,只有具有管理员权限的帐户才能创建新文章。 The account that you used to login in MEAN.js app probably doesn't have admin rights.您用于登录 MEAN.js 应用程序的帐户可能没有管理员权限。

You have 2 options, depending on what you want to achieve:您有 2 个选择,具体取决于您要实现的目标:

1) Add 'admin' to your account roles property (which right now is roles: ['user'] and should be roles: ['user', 'admin'] ). 1)将“admin”添加到您的帐户roles属性(现在是roles: ['user'] ,应该是roles: ['user', 'admin'] )。

or或者

2) Change the articles policy file located in /modules/articles/server/policies/articles.server.policy.js to allow normal users to create a new article: 2)修改/modules/articles/server/policies/articles.server.policy.js的文章策略文件,允许普通用户新建文章:

...
, {
    roles: ['user'],
    allows: [{
      resources: '/api/articles',
      permissions: '*' // instead of ['get']
    }, {
      resources: '/api/articles/:articleId',
      permissions: '*' // instead of ['get']
    }]
  },
...

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

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