[英]How to use alanning roles in Meteor react js?
I am trying to build simple user authentication system in meteor react js but I am not able to add roles to created user I don't know what is going wrong in my project https://github.com/robertjchow/cv 我试图在流星反应js中构建简单的用户身份验证系统,但是我无法向创建的用户添加角色,我不知道我的项目出了什么问题https://github.com/robertjchow/cv
Thanks in advance. 提前致谢。
Searching your repository for Roles.
在您的存储库中搜索Roles.
calls reveals, that only your client code is adding users to roles. 调用显示,只有您的客户端代码会将用户添加到角色中。
Now let's think a minute about the fact that client code can be manipulated. 现在,让我们考虑一下可以操纵客户端代码的事实。
Do you think that this is still a valid authentication, when clients can add users to roles? 当客户端可以将用户添加到角色时,您是否认为这仍然是有效的身份验证?
Now going a step further and checking the documentation of the package at: https://github.com/alanning/meteor-roles reveals, that the documentation is adding roles only at the server side, while on the client side it only allows reading via isInRole
. 现在,请进一步检查一下该包的文档: https : //github.com/alanning/meteor-roles显示,该文档仅在服务器端添加角色,而在客户端仅允许读取通过isInRole
。
Therefore your next steps should be to create new users only on the server with methods and also add the Roles also only there. 因此,您的下一步应该是仅使用方法在服务器上创建新用户,并仅在其中添加角色。
Update: To create new users on your server, you need to add the accounts-password
package (but keep the accounts-base
package). 更新:要在服务器上创建新用户,您需要添加accounts-password
程序包(但保留accounts-base
程序包)。 Otherwise there would be no Accounts.createUser
function available. 否则,将没有Accounts.createUser
函数可用。
Further reading: https://docs.meteor.com/api/passwords.html 进一步阅读: https : //docs.meteor.com/api/passwords.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.