要在导入时手动添加到现有用户的 CAS 用户名字段值?

CAS username field value to be manually added to the existing user on import?

我在 Drupal 8 站点上安装了 CAS 模块,它工作正常。对于新用户,它会使用 cas_username 自动注册用户,但我想为现有的 Drupal 8 用户手动导入 cas_username。

我也试过以 CSV 格式导入用户(https://github.com/steveoliver/user_import);我已经能够添加$account(row[0],row[1]),但是对于CAS用户名导入,我不知道如何导入它,以及存储在哪个字段中。

  'uid' => NULL,
  'name' => $username,
  'field_first_name' => row[0],
  'field_last_name' => $row[1],
  'pass' => $username,
  'mail' => $row[2],
  'status' => 1,
  'created' => REQUEST_TIME,
  'roles' => array_values($config['roles']), 

我试过管理 CAS 用户名;给出的建议适用于 Drupal 7,但同样的方法不适用于 Drupal 8。

请建议我在 CSV 中导入 cas 用户名的解决方案。

我找到了 CAS_username 导入 CSV 方法的解决方案。 db_insert in (authmap) table 的方法,它在相应字段中动态插入 CAS_username。

authmap table 存在于外部身份验证模块中。

db_insert('authmap')
->fields(array(
 'uid' => $uid,
 'provider' => 'cas',
 'authname' => $row[0],
 'data' => 'N;',
 ))
->execute();

这就是方法,我使用 CSV 动态更新 CAS_username。如果有任何建议或更新。请开处方。