Look up a user or group, given an ID, and return an object implementing the SecurityPrincipal interface.

Unlike O.user() and O.group(), this function does not perform a type check on the returned object, so can be used where an ID may refer to a group or a user. This can be useful when working with WorkUnit objects which can be actioned by a user or a group.

function O.securityPrincipal(principalId)

Look up the security principal with this ID. An exception will be thrown if the principal does not exist.

function O.securityPrincipal(ref)

Look up the security principal with the ref property set to this Ref.

null will be returned if no such principal exists.

If more than one principal has this ref, your code should not rely on which one is returned.