Fix bug 34604 and also make some modifications to the Permission service so it returns proper objects instead of void, and some changes made to comments, created createFromJSON function for RepositoryPermission object.