Based on the most common, and most infuriating, similar problems I've had with JS, I'd recommend you check the following:
the 's' at the end of 'permissions' is actually there.
the 'A' in 'Array' is capitalized
The part of the function where you're declaring permissionsArray is actually being called (if in a conditional block)
You're not testing permissionsArray anywhere with a single '=' instead of a double '==' anywhere.
You're actually calling the function (and it has completed) before trying to access permissionsArray - I've had timing problems like this a lot using setTimeout, setInterval and various Ajax-related scripts