Sorry to nitpick, but indexOf is a bad idea. Using it is up to 1700x slower (worst case) than using object indices[1]. It's probably an O(n) operation, where indexing an Object is nearly always O(1).
Perhaps getting the first value in an array is faster than indexing an Object in your browser.
The point is, if the thing doesn't exist, this part of the program will be thousands of times slower, and will get slower as the list of roles grows. Meanwhile, the hash map will not.
[1] http://stackoverflow.com/questions/17295056/array-vs-object-...