简体   繁体   English

更新Meteor.users的阵列角色

[英]Update array roles of Meteor.users

I am using Meteor roles of alanning, https://github.com/alanning/meteor-roles 我正在使用alanning的流星角色, https://github.com/alanning/meteor-roles

I am doing the part where the user will be added to a team and have an access. 我正在做将用户添加到团队并具有访问权限的部分。 The problem is in this code, 问题出在这段代码中,

Meteor.users.update('profile.team':team.name,{$pull:{'roles["default-group"]':access}});

 Meteor.users.update('profile.team':team.name,{$push:{"roles['default-group']":access}});

In the default-group role of a user, I need to add/remove the access. 在用户的默认组角色中,我需要添加/删除访问权限。

These lines are not working. 这些行不起作用。 how to fix it? 如何解决?

Are you not supposed to use below given code to perform add or remove operation? 您不应该使用下面给出的代码执行添加或删除操作吗?

Roles.addUsersToRoles(joesUserId, ['manage-team','schedule-game'], 'manchester-united.com')

For deleting: 删除:

Roles.setUserRoles(targetUserId, [], group)

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

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