public function testmakeAccessibleToGroup()
 {
     $this->testDb->createPlainTables(array('perm_upload', 'group_user_member'));
     $userId = 501;
     $groupId = 601;
     $groupIdAlternative = 602;
     $this->dbManager->insertTableRow('group_user_member', array('group_fk' => $groupId, 'user_fk' => $userId, 'group_perm' => Auth::PERM_READ));
     $this->dbManager->insertTableRow('group_user_member', array('group_fk' => $groupIdAlternative, 'user_fk' => $userId, 'group_perm' => Auth::PERM_READ));
     $unaccessibleIsAccessible = $this->uploadPermissionDao->isAccessible($uploadId = 1, $groupId);
     assertThat($unaccessibleIsAccessible, equalTo(false));
     $this->uploadPermissionDao->makeAccessibleToGroup($uploadId, $groupId, Auth::PERM_WRITE);
     $accessibleIsAccessible = $this->uploadPermissionDao->isAccessible($uploadId, $groupId);
     assertThat($accessibleIsAccessible, equalTo(true));
     $stillUnaccessibleIsAccessible = $this->uploadPermissionDao->isAccessible($uploadId, $groupIdAlternative);
     assertThat($stillUnaccessibleIsAccessible, equalTo(false));
     $this->uploadPermissionDao->makeAccessibleToAllGroupsOf($uploadId, $userId);
     $nowAccessibleIsAccessible = $this->uploadPermissionDao->isAccessible($uploadId, $groupIdAlternative);
     assertThat($nowAccessibleIsAccessible, equalTo(true));
 }
예제 #2
0
 public function makeAccessibleToAllGroupsOf($uploadId, $userId, $perm = null)
 {
     $this->permissionDao->makeAccessibleToAllGroupsOf($uploadId, $userId, $perm);
 }