nl_tokens: Assigns role access to users and / or channel access to users / roles according to the given access assignment definitions
pl_tokens: function assignUserAccess ( <mask> , oldDoc , documentDefinition ) { var effectiveOldDoc = utils . resolveOldDoc ( ) ; var accessAssignmentDefinitions = resolveAccessAssignmentsDefinition ( doc , effectiveOldDoc , documentDefinition . accessAssignments ) ; var effectiveAssignments = [ ] ; for ( var assignmentIndex = 0 ; assignmentIndex < accessAssignmentDefinitions . length ; assignmentIndex ++ ) { var definition = accessAssignmentDefinitions [ assignmentIndex ] ; if ( definition . type === 'role' ) { effectiveAssignments . push ( assignRolesToUsers ( doc , effectiveOldDoc , definition ) ) ; } else if ( definition . type === 'channel' || utils . isValueNullOrUndefined ( definition . type ) ) { effectiveAssignments . push ( assignChannelsToUsersAndRoles ( doc , effectiveOldDoc , definition ) ) ; } } return effectiveAssignments ; }