Auth module and branchs


#1

Enonic version: 7.0.2
OS: Ubuntu

One quick question, if I run an auth function inside a context in draft or master, do I get a different result? For example in the follow, does getPrincipal return me different values for draft and for master?

return context.run({
  repository: 'com.enonic.cms.default',
  user: {
    login: 'su',
    idProvider: 'system'
  },
  principals: ['role:system.admin'],
  attributes: {
    'ignorePublishTimes': true
} `}, onStart)`

function onStart () {
  var resultArray = []
  ids = forceArray(ids)
  for (var key in ids) {
    var id = ids[key]
    var result = authLib.getPrincipal(id)
    if (!isNullOrUndefined(result) && result.displayName) {
      resultArray.push(result.displayName)
    }
  }
  return resultArray
}

#2

Principal doesn’t depend on a branch. It’s only content that can be different in draft and master.