/** * Test inherit and override role allocation and remove all allocations */ function testRoleAllocationInheritance() { $folder = $this->ktapi->get_folder_by_name('test123'); if (!$folder instanceof KTAPI_Folder) { $folder = $this->root->add_folder('test123'); } $folder_id = $folder->get_folderid(); $allocation = $this->ktapi->get_role_allocation_for_folder($folder_id); $this->assertEqual($allocation['status_code'], 0); // Override $result = $this->ktapi->override_role_allocation_on_folder($folder_id); $this->assertEqual($result['status_code'], 0); $role_id = 2; // Publisher $user_id = 1; // Admin $group_id = 1; // System Administrators $members = array('users' => array($user_id), 'groups' => array($group_id)); $result = $this->ktapi->add_members_to_role_on_folder($folder_id, $role_id, $members); $this->assertEqual($result['status_code'], 0); $check = $this->ktapi->is_member_in_role_on_folder($folder_id, $role_id, $user_id, 'user'); $this->assertEqual($check['status_code'], 0); $this->assertEqual($check['results'], 'YES'); // Remove all $result = $this->ktapi->remove_all_role_allocation_from_folder($folder_id, $role_id); $this->assertEqual($result['status_code'], 0); $check = $this->ktapi->is_member_in_role_on_folder($folder_id, $role_id, $group_id, 'group'); $this->assertEqual($check['status_code'], 0); $this->assertEqual($check['results'], 'NO'); // Inherit $result = $this->ktapi->inherit_role_allocation_on_folder($folder_id); $this->assertEqual($result['status_code'], 0); // clean up $folder->delete('Testing API'); }