Tim, just look into the other files to see how context bar is working - take calendar because it is a very simple package.
As to permissions: I don't remember anymore how we implemented that. You may go to community administration and then there should be a "Manage permissions" link. Try that.