Add cancan authorization gem and some code refactor.