Fixed more bugs related to access control.  Added relevant test cases.