Changed permission setting to use a loop

Using a loop increases readability, brevity and code clarity.