The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/packages/rocketchat-authorization/server/methods/saveRole.coffee

17 lines
810 B

Meteor.methods
'authorization:saveRole': (roleData) ->
if not Meteor.userId() or not RocketChat.authz.hasPermission Meteor.userId(), 'access-permissions'
throw new Meteor.Error "error-action-not-allowed", 'Accessing permissions is not allowed', { method: 'authorization:saveRole', action: 'Accessing_permissions' }
if not roleData.name?
throw new Meteor.Error 'error-role-name-required', 'Role name is required', { method: 'authorization:saveRole' }
if roleData.scope not in ['Users', 'Subscriptions']
roleData.scope = 'Users'
update = RocketChat.models.Roles.createOrUpdate roleData.name, roleData.scope, roleData.description
if RocketChat.settings.get('UI_DisplayRoles')
RocketChat.Notifications.notifyAll('roles-change', { type: 'changed', _id: roleData.name });
return update