1

I installed the CAS module on a Drupal 8 site, and it is working fine. For new users, it auto-registers the user with cas_username, but I would like to import the cas_username manually for the existing Drupal 8 user.

I also tried importing users in CSV format; I have been able to add the $account(row[0],row1), but for the CAS username import, i don't know how to import it, and in which field is stored.

'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']), 

I tried Managing CAS username; the suggestion given is for Drupal 7, but the same method doesn't work for Drupal 8.

How do I import the CAS username in CSV?

1 Answer 1

0

I find out the solution for the CAS_username import in CSV method. The method of db_insert in (authmap) table, which dynamically insert the CAS_username in respective field.

The authmap table is present in external authentication module.

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

So this is the method, i dynamically update the CAS_username using CSV. If any suggestions or update in that. Kindly Prescribe it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.