Move permissions to API, and move a hook into install file.
Merge pull request #141 from amitaibu/fix-permissions

Move permissions to API, and move a hook into install file.