cannod / moodle-drupalservices

Moodle plugin to connect to Drupal services
36 stars 25 forks source link

Drupal Services Settings Page Broken #55

Open atifrasheed79 opened 9 years ago

atifrasheed79 commented 9 years ago

Hello there,

I am trying to install Drupal Services plugin in Moodle. I followed the documentation and have configured my Drupal instance and now trying to set it up in Moodle but when I deploy the plugin I do not see settings page as it's mentioned in the Manual. I mean I only get one option i.e. configure Drupal Website URL which I have specified but I do not see other options like service auth user/pass, field mappings etc.

Moodle is installed at http://labs14.xyz.com/MoodleSSO Drupal is installed at http://labs14.xyz.com/DrupalSSO

Please see below image for reference. Thank you. image

netw3rker commented 9 years ago

Hi @atifrasheed79 , Have you enabled the Drupal module for this as well? https://www.drupal.org/project/moodle_sso I'm not seeing a response from any of the service endpoints that should be responding with data.

Also, Make sure you adjust your settings.php and config.php files to allow for the session cookies to be shared. I took a quick look, and I can see that at least your Moodle session cookie is being issued to /MoodleSSO which will mean that Drupal won't be able to see it. Drupal doesn't issue a session cookie until you log in, so I can't really verify that that's happening here, but I'm guessing that the settings.php file probably doesn't have that configured.

lastly, If you enable debug mode in Moodle, you'll get some good diagnostics at the top of the page that can help with this.

good luck!

atifrasheed79 commented 9 years ago

Thanks for your help @netw3rker 1) Drupal module moodle_sso is installed and enabled. Please refer to the below screenshot. image

2) Yes, thats true, moodle_sso module is not responding, don't know why! probably not installed in a schema Moodle is expecting it to be. One observation from my side is that in the debug Moodle is trying http://labs14.teletaaleem.com/DrupalSSO/moodlesso/moodlesso where as in Drupal installation, moodle module is installed as moodle_sso. Please refer to Moodle debug (at the end) and Unix screenshots. image

3) I am logged into Drupal with admin user. 4) settings.php is configured as advised in the installation guide, however there are no pointers for moodle config.php. Drupal settings.php screeshot is attached for review. image

5) I am attaching Moodle debug for review but you have already pointed it out, Drupal moodle_sso module is not responding.

::::Moodle Debug:::: Using preconfigured values: stdClass Object ( [cookiedomain] => labs14.teletaaleem.com/DrupalSSO [host_uri] => http://labs14.teletaaleem.com/DrupalSSO [version] => 2014123000 ) line 79 of /auth/drupalservices/settings.php: call to debugging() line 85 of /lib/classes/plugininfo/auth.php: call to include() line 99 of /admin/settings/plugins.php: call to core\plugininfo\auth->load_settings() line 6660 of /lib/adminlib.php: call to require() line 19 of /admin/settings.php: call to admin_get_root() attempting to reach service url: http://labs14.teletaaleem.com/DrupalSSO/moodlesso/moodlesso line 183 of /auth/drupalservices/REST-API.php: call to debugging() line 296 of /auth/drupalservices/REST-API.php: call to RemoteAPI->CurlHttpRequest() line 106 of /auth/drupalservices/settings.php: call to RemoteAPI->Settings() line 85 of /lib/classes/plugininfo/auth.php: call to include() line 99 of /admin/settings/plugins.php: call to core\plugininfo\auth->load_settings() line 6660 of /lib/adminlib.php: call to require() line 19 of /admin/settings.php: call to admin_get_root() The moodlesso service is unreachable. Please verify that you have the Mooodle SSO drupal module installed and enabled: http://drupal.org/project/moodle_sso line 121 of /auth/drupalservices/settings.php: call to debugging() line 85 of /lib/classes/plugininfo/auth.php: call to include() line 99 of /admin/settings/plugins.php: call to core\plugininfo\auth->load_settings() line 6660 of /lib/adminlib.php: call to require() line 19 of /admin/settings.php: call to admin_get_root() attempting to reach service url: http://labs14.teletaaleem.com/DrupalSSO/moodlesso/user/token line 183 of /auth/drupalservices/REST-API.php: call to debugging() line 68 of /auth/drupalservices/REST-API.php: call to RemoteAPI->CurlHttpRequest() line 207 of /auth/drupalservices/REST-API.php: call to RemoteAPI->GetCSRFToken() line 134 of /auth/drupalservices/settings.php: call to RemoteAPI->Connect() line 85 of /lib/classes/plugininfo/auth.php: call to include() line 99 of /admin/settings/plugins.php: call to core\plugininfo\auth->load_settings() line 6660 of /lib/adminlib.php: call to require() line 19 of /admin/settings.php: call to admin_get_root() attempting to reach service url: http://labs14.teletaaleem.com/DrupalSSO/moodlesso/system/connect line 183 of /auth/drupalservices/REST-API.php: call to debugging() line 211 of /auth/drupalservices/REST-API.php: call to RemoteAPI->CurlHttpRequest() line 134 of /auth/drupalservices/settings.php: call to RemoteAPI->Connect() line 85 of /lib/classes/plugininfo/auth.php: call to include() line 99 of /admin/settings/plugins.php: call to core\plugininfo\auth->load_settings() line 6660 of /lib/adminlib.php: call to require() line 19 of /admin/settings.php: call to admin_get_root() could not reach the logged in user line 149 of /auth/drupalservices/settings.php: call to debugging() line 85 of /lib/classes/plugininfo/auth.php: call to include() line 99 of /admin/settings/plugins.php: call to core\plugininfo\auth->load_settings() line 6660 of /lib/adminlib.php: call to require() line 19 of /admin/settings.php: call to admin_get_root() Using preconfigured values: stdClass Object ( [cookiedomain] => labs14.teletaaleem.com/DrupalSSO [host_uri] => http://labs14.teletaaleem.com/DrupalSSO [version] => 2014123000 ) line 79 of /auth/drupalservices/settings.php: call to debugging() line 85 of /lib/classes/plugininfo/auth.php: call to include() line 99 of /admin/settings/plugins.php: call to core\plugininfo\auth->load_settings() line 6660 of /lib/adminlib.php: call to require() line 6762 of /lib/adminlib.php: call to admin_get_root() line 38 of /admin/settings.php: call to admin_write_settings() attempting to reach service url: http://labs14.teletaaleem.com/DrupalSSO/moodlesso/moodlesso line 183 of /auth/drupalservices/REST-API.php: call to debugging() line 296 of /auth/drupalservices/REST-API.php: call to RemoteAPI->CurlHttpRequest() line 106 of /auth/drupalservices/settings.php: call to RemoteAPI->Settings() line 85 of /lib/classes/plugininfo/auth.php: call to include() line 99 of /admin/settings/plugins.php: call to core\plugininfo\auth->load_settings() line 6660 of /lib/adminlib.php: call to require() line 6762 of /lib/adminlib.php: call to admin_get_root() line 38 of /admin/settings.php: call to admin_write_settings() The moodlesso service is unreachable. Please verify that you have the Mooodle SSO drupal module installed and enabled: http://drupal.org/project/moodle_sso line 121 of /auth/drupalservices/settings.php: call to debugging() line 85 of /lib/classes/plugininfo/auth.php: call to include() line 99 of /admin/settings/plugins.php: call to core\plugininfo\auth->load_settings() line 6660 of /lib/adminlib.php: call to require() line 6762 of /lib/adminlib.php: call to admin_get_root() line 38 of /admin/settings.php: call to admin_write_settings() attempting to reach service url: http://labs14.teletaaleem.com/DrupalSSO/moodlesso/user/token line 183 of /auth/drupalservices/REST-API.php: call to debugging() line 68 of /auth/drupalservices/REST-API.php: call to RemoteAPI->CurlHttpRequest() line 207 of /auth/drupalservices/REST-API.php: call to RemoteAPI->GetCSRFToken() line 134 of /auth/drupalservices/settings.php: call to RemoteAPI->Connect() line 85 of /lib/classes/plugininfo/auth.php: call to include() line 99 of /admin/settings/plugins.php: call to core\plugininfo\auth->load_settings() line 6660 of /lib/adminlib.php: call to require() line 6762 of /lib/adminlib.php: call to admin_get_root() line 38 of /admin/settings.php: call to admin_write_settings() attempting to reach service url: http://labs14.teletaaleem.com/DrupalSSO/moodlesso/system/connect line 183 of /auth/drupalservices/REST-API.php: call to debugging() line 211 of /auth/drupalservices/REST-API.php: call to RemoteAPI->CurlHttpRequest() line 134 of /auth/drupalservices/settings.php: call to RemoteAPI->Connect() line 85 of /lib/classes/plugininfo/auth.php: call to include() line 99 of /admin/settings/plugins.php: call to core\plugininfo\auth->load_settings() line 6660 of /lib/adminlib.php: call to require() line 6762 of /lib/adminlib.php: call to admin_get_root() line 38 of /admin/settings.php: call to admin_write_settings() could not reach the logged in user line 149 of /auth/drupalservices/settings.php: call to debugging() line 85 of /lib/classes/plugininfo/auth.php: call to include() line 99 of /admin/settings/plugins.php: call to core\plugininfo\auth->load_settings() line 6660 of /lib/adminlib.php: call to require() line 6762 of /lib/adminlib.php: call to admin_get_root() line 38 of /admin/settings.php: call to admin_write_settings()

netw3rker commented 9 years ago

and one last thing to confirm, are you using the 2.x-2.x branch, from this repo, or the master branch? (you should be using 2.x-2.x)

netw3rker commented 9 years ago

Oh, and one more thing, are you able to reach: http://labs14.teletaaleem.com/DrupalSSO/moodlesso/moodlesso once you log in to your drupal site?

atifrasheed79 commented 9 years ago

huh, what a silly mistake, just figured it out :) I wasn't using clean URLS in Drupal so I was supposed to append index.php?q= at the end of URL in Drupal service configuration for Moodle. However, I just did and now I can see all other configuration items as well :)

I downloaded the tar.gz from https://www.drupal.org/project/moodle_sso. Didn't checkout from the repo. What do you recommend?

Thanks for all your help man.

netw3rker commented 9 years ago

I was about to ask that :)

netw3rker commented 9 years ago

use the 2.x.2.x version It's got a couple of bugfixes in it that aren't in master yet. Also something to mention, I was noticing really slow load times on the Drupal site. I have a hard-coded timeout of about 15 sec i think, so if the responses take longer, things can get confusing :)

also, if for some reason you want keep the non-clean urls, you can always add ?q= to your endpoint url & it'll maintain compatibility.

atifrasheed79 commented 9 years ago

okay I just made sure I am using 2.x-2.x-dev. Now when it comes to userfield mapping I see only '0' in the Drupal value drop downs for firstname, lastname etc.

I gave a try in any case, using another browser. Just to update I changed my configuration to subdomains just to make it simply. Now I am using sso.teletaaleem.com for Drupal and lms28.teletaaleem.com for Moodle.

a) updated Drupal configuration as $cookie_domain = '.teletaaleem.com'; b) I have also updated cookie domain in Moodle site administration

Now when I log into Drupal and tried a Moodle course URL from Drupal page, I got an error which says drupal session not found. Strange thing is that Moodle is still referring to old URL as cookie domain . Here is the SSO attempt DEBUG.

loaded saved session settings config:Array
(
    [host] => http://sso.teletaaleem.com/index.php?q=
    [cookie domain] => labs14.teletaaleem.com/DrupalSSO
)
•line 549 of /auth/drupalservices/auth.php: call to debugging()
•line 73 of /auth/drupalservices/auth.php: call to auth_plugin_drupalservices->get_drupal_session()
•line 89 of /login/index.php: call to auth_plugin_drupalservices->loginpage_hook()
No drupal session detected, sending to drupal for login.
•line 75 of /auth/drupalservices/auth.php: call to debugging()
•line 89 of /login/index.php: call to auth_plugin_drupalservices->loginpage_hook()

How Moodle is getting this cookie domain? as it's not configured either in Drupal or Moodle.

:::::Moodle DEBUG for Drupal Services::::

Using preconfigured values: stdClass Object ( [call_logout_service] => 1 [cohorts] => 0 [cohort_view] => [cookiedomain] => labs14.teletaaleem.com/DrupalSSO [field_map_address] => [field_map_alternatename] => [field_map_city] => [field_map_country] => [field_map_department] => [field_map_description] => [field_map_email] => [field_map_firstname] => [field_map_firstnamephonetic] => [field_map_idnumber] => [field_map_institution] => [field_map_lang] => [field_map_lastname] => [field_map_lastnamephonetic] => [field_map_middlename] => [field_map_phone1] => [field_map_phone2] => [field_map_url] => [host_uri] => http://sso.teletaaleem.com/index.php?q= [remote_pw] => t2ssoadmin [remote_user] => sso [version] => 2014123000 )
line 79 of /auth/drupalservices/settings.php: call to debugging()
line 85 of /lib/classes/plugininfo/auth.php: call to include()
line 99 of /admin/settings/plugins.php: call to core\plugininfo\auth->load_settings()
line 6660 of /lib/adminlib.php: call to require()
line 19 of /admin/settings.php: call to admin_get_root()
attempting to reach service url: http://sso.teletaaleem.com/index.php?q=/moodlesso/moodlesso
line 183 of /auth/drupalservices/REST-API.php: call to debugging()
line 296 of /auth/drupalservices/REST-API.php: call to RemoteAPI->CurlHttpRequest()
line 106 of /auth/drupalservices/settings.php: call to RemoteAPI->Settings()
line 85 of /lib/classes/plugininfo/auth.php: call to include()
line 99 of /admin/settings/plugins.php: call to core\plugininfo\auth->load_settings()
line 6660 of /lib/adminlib.php: call to require()
line 19 of /admin/settings.php: call to admin_get_root()
Received a cookie value from the remote server: stdClass Object ( [cookie_domain] => .teletaaleem.com [role] => Array ( ) )
line 107 of /auth/drupalservices/settings.php: call to debugging()
line 85 of /lib/classes/plugininfo/auth.php: call to include()
line 99 of /admin/settings/plugins.php: call to core\plugininfo\auth->load_settings()
line 6660 of /lib/adminlib.php: call to require()
line 19 of /admin/settings.php: call to admin_get_root()
attempting to reach service url: http://sso.teletaaleem.com/index.php?q=/moodlesso/user/token
line 183 of /auth/drupalservices/REST-API.php: call to debugging()
line 68 of /auth/drupalservices/REST-API.php: call to RemoteAPI->CurlHttpRequest()
line 207 of /auth/drupalservices/REST-API.php: call to RemoteAPI->GetCSRFToken()
line 134 of /auth/drupalservices/settings.php: call to RemoteAPI->Connect()
line 85 of /lib/classes/plugininfo/auth.php: call to include()
line 99 of /admin/settings/plugins.php: call to core\plugininfo\auth->load_settings()
line 6660 of /lib/adminlib.php: call to require()
line 19 of /admin/settings.php: call to admin_get_root()
attempting to reach service url: http://sso.teletaaleem.com/index.php?q=/moodlesso/system/connect
line 183 of /auth/drupalservices/REST-API.php: call to debugging()
line 211 of /auth/drupalservices/REST-API.php: call to RemoteAPI->CurlHttpRequest()
line 134 of /auth/drupalservices/settings.php: call to RemoteAPI->Connect()
line 85 of /lib/classes/plugininfo/auth.php: call to include()
line 99 of /admin/settings/plugins.php: call to core\plugininfo\auth->load_settings()
line 6660 of /lib/adminlib.php: call to require()
line 19 of /admin/settings.php: call to admin_get_root()
Service were reached, here's the logged in user:stdClass Object
(
    [sessid] => x6HygXQ5EpoSt25ZYx3kZkZvx5DLRkd3yGhD6n2_nPo
    [session_name] => SESSfd381f8d83e4f03496b7e05c35db3705
    [user] => stdClass Object
        (
            [uid] => 0
            [hostname] => 54.165.30.118
            [roles] => stdClass Object
                (
                    [1] => anonymous user
                )

            [cache] => 0
            [timestamp] => 1429837469
        )

)
line 136 of /auth/drupalservices/settings.php: call to debugging()
line 85 of /lib/classes/plugininfo/auth.php: call to include()
line 99 of /admin/settings/plugins.php: call to core\plugininfo\auth->load_settings()
line 6660 of /lib/adminlib.php: call to require()
line 19 of /admin/settings.php: call to admin_get_root()
attempting to reach service url: http://sso.teletaaleem.com/index.php?q=/moodlesso/user/0
line 183 of /auth/drupalservices/REST-API.php: call to debugging()
line 318 of /auth/drupalservices/REST-API.php: call to RemoteAPI->CurlHttpRequest()
line 143 of /auth/drupalservices/settings.php: call to RemoteAPI->Index()
line 85 of /lib/classes/plugininfo/auth.php: call to include()
line 99 of /admin/settings/plugins.php: call to core\plugininfo\auth->load_settings()
line 6660 of /lib/adminlib.php: call to require()
line 19 of /admin/settings.php: call to admin_get_root()
here's the complete user:Array
(
    [0] => 
)
line 144 of /auth/drupalservices/settings.php: call to debugging()
line 85 of /lib/classes/plugininfo/auth.php: call to include()
line 99 of /admin/settings/plugins.php: call to core\plugininfo\auth->load_settings()
line 6660 of /lib/adminlib.php: call to require()
line 19 of /admin/settings.php: call to admin_get_root()
atifrasheed79 commented 9 years ago

Hi @netw3rker Any thoughts on this?

netw3rker commented 9 years ago
loaded saved session settings config:Array
(
[host] => http://sso.teletaaleem.com/index.php?q=
[cookie domain] => labs14.teletaaleem.com/DrupalSSO
)

It looks like your Drupal cookie domain is not correct, and that is causing you to not be able to reach the Drupal services that list user fields. Lets see what happens after you fix that.

netw3rker commented 9 years ago

I re-read your post and updated it with code indicators (for readability), and saw you had the same question I just asked :)

The cookie is set in one of two ways: 1) it gets it from the moodlesso/moodlesso service on drupal - which reports back what drupal has specifically configured the cookie_domain to be. If that fails for some reason, then 2) the code does a manual check to find the cookie domain using guesses based on the moodle domain.

In your case, it looks like this auto detected the cookie domain when you had that other configuration in place, and saved it. Now that you've moved things around, you'll need to reset it (thats the hard part here). My suggestions are to either

a) edit cookie domain value in the database and set it to the new value of ".teletaaleem.com" or b) add the following value to your config.php file:

$CFG->forced_plugin_settings['auth_drupalservices']['cookiedomain']='.teletaaleem.com';
atifrasheed79 commented 9 years ago

cookiedomain in database was already set to "teletaaleem.com". I changed it to ".teletaaleem.com" but it didn't make any difference. Please refer to the below screenshot.

image

I thought old cookiedomain is probably still in the apache2 cache so I even tried to clean apache2 cache using htcacheclean. I also tried it manually and cleaned the sys temp (/tmp). Apache temp (or cache dir) was set to /var/lib/php5 but it had no temp or sessions data in it. Eventually cache cleaning didn't work as well.

Then I added the forced plugin setting rule in the config file as you advised and it worked :) session was detected but SSO still partially failed. Please refer to the log below. When I clicked continue I was redirected to Moodle User Profile page where I had to complete user details, firstname, lastname etc. This is probably due to the fact that I was't able to map fields in the plug-in settings. Now the key problem in hand is that I can't login to Moodle using Admin as SSO is trying to insert Drupal admin which it shouldn't as user already exists.

Moodle DEBUG when I try to login as a normal user...........

loaded saved session settings config:Array
(
    [host] => http://sso.teletaaleem.com/index.php?q=
    [cookie domain] => .teletaaleem.com
)

•line 549 of /auth/drupalservices/auth.php: call to debugging()
•line 73 of /auth/drupalservices/auth.php: call to auth_plugin_drupalservices->get_drupal_session()
•line 89 of /login/index.php: call to auth_plugin_drupalservices->loginpage_hook()

attempting to reach service url: http://sso.teletaaleem.com/index.php?q=/moodlesso/user/token•line 183 of /auth/drupalservices/REST-API.php: call to debugging()
•line 68 of /auth/drupalservices/REST-API.php: call to RemoteAPI->CurlHttpRequest()
•line 207 of /auth/drupalservices/REST-API.php: call to RemoteAPI->GetCSRFToken()
•line 99 of /auth/drupalservices/auth.php: call to RemoteAPI->Connect()
•line 89 of /login/index.php: call to auth_plugin_drupalservices->loginpage_hook()

attempting to reach service url: http://sso.teletaaleem.com/index.php?q=/moodlesso/system/connect•line 183 of /auth/drupalservices/REST-API.php: call to debugging()
•line 211 of /auth/drupalservices/REST-API.php: call to RemoteAPI->CurlHttpRequest()
•line 99 of /auth/drupalservices/auth.php: call to RemoteAPI->Connect()
•line 89 of /login/index.php: call to auth_plugin_drupalservices->loginpage_hook()

Live session detected the user returned is
stdClass Object
(
    [sessid] => KZdNXzXRLmo2Z5BIjhg4R369IpNM_HK3oxgFT98o-aA
    [session_name] => SESSfd381f8d83e4f03496b7e05c35db3705
    [user] => stdClass Object
        (
            [uid] => 4
            [name] => tasawar
            [mail] => tasawarhussain@teletaleem.com
            [theme] => 
            [signature] => 
            [signature_format] => filtered_html
            [created] => 1429761509
            [access] => 1430097015
            [login] => 1430097187
            [status] => 1
            [timezone] => Asia/Karachi
            [language] => 
            [picture] => 0
            [data] => 
            [vid] => 4
            [ip] => 
            [sid] => KZdNXzXRLmo2Z5BIjhg4R369IpNM_HK3oxgFT98o-aA
            [ssid] => 
            [hostname] => 110.22.61.69
            [timestamp] => 1430097187
            [cache] => 0
            [session] => 
            [roles] => stdClass Object
                (
                    [2] => authenticated user
                )
        )
)

•line 109 of /auth/drupalservices/auth.php: call to debugging()
•line 89 of /login/index.php: call to auth_plugin_drupalservices->loginpage_hook()

attempting to reach service url: http://sso.teletaaleem.com/index.php?q=/moodlesso/user/4•line 183 of /auth/drupalservices/REST-API.php: call to debugging()
•line 318 of /auth/drupalservices/REST-API.php: call to RemoteAPI->CurlHttpRequest()
•line 119 of /auth/drupalservices/auth.php: call to RemoteAPI->Index()
•line 89 of /login/index.php: call to auth_plugin_drupalservices->loginpage_hook()

The full user data about this user is:
stdClass Object
(
    [vid] => 4
    [log] => 
    [authorid] => 4
    [name] => tasawar
    [mail] => tasawarhussain@teletaleem.com
    [theme] => 
    [signature] => 
    [signature_format] => filtered_html
    [status] => 1
    [timezone] => Asia/Karachi
    [language] => 
    [picture] => 
    [data] => 
    [ip] => 
    [uid] => 4
    [created] => 1429761509
    [access] => 1430097015
    [login] => 1430097187
    [revision_timestamp] => 1429763644
    [revision_uid] => 4
    [roles] => stdClass Object
        (
            [2] => authenticated user
        )
    [field_firstname] => Array
        (
        )
    [field_lastname] => Array
        (
        )
    [field_city] => Array
        (
        )
    [field_country] => Array
        (
        )
    [rdf_mapping] => stdClass Object
        (
            [rdftype] => Array
                (
                    [0] => sioc:UserAccount
                )
            [name] => stdClass Object
                (
                    [predicates] => Array
                        (
                            [0] => foaf:name
                        )
                )
            [homepage] => stdClass Object
                (
                    [predicates] => Array
                        (
                            [0] => foaf:page
                        )
                    [type] => rel
                )
        )
    [revision] => 1
)

•line 120 of /auth/drupalservices/auth.php: call to debugging()
•line 89 of /login/index.php: call to auth_plugin_drupalservices->loginpage_hook()

Notice: Undefined property: object::$id in /var/www/html/MoodleSSO/auth/drupalservices/auth.php on line 207

the user that should have been created or updated is:
stdClass Object
(
    [id] => 5
    [auth] => drupalservices
    [confirmed] => 1
    [policyagreed] => 0
    [deleted] => 0
    [suspended] => 0
    [mnethostid] => 1
    [username] => tasawar
    [password] => 
    [idnumber] => 4
    [firstname] => 
    [lastname] => 
    [email] => 
    [emailstop] => 0
    [icq] => 
    [skype] => 
    [yahoo] => 
    [aim] => 
    [msn] => 
    [phone1] => 
    [phone2] => 
    [institution] => 
    [department] => 
    [address] => 
    [city] => none
    [country] => no
    [lang] => en
    [calendartype] => gregorian
    [theme] => 
    [timezone] => 99
    [firstaccess] => 0
    [lastaccess] => 0
    [lastlogin] => 0
    [currentlogin] => 0
    [lastip] => 
    [secret] => 
    [picture] => 0
    [url] => 
    [description] => 
    [descriptionformat] => 1
    [mailformat] => 1
    [maildigest] => 0
    [maildisplay] => 2
    [autosubscribe] => 1
    [trackforums] => 0
    [timecreated] => 0
    [timemodified] => 0
    [trustbitmask] => 0
    [imagealt] => 
    [lastnamephonetic] => 
    [firstnamephonetic] => 
    [middlename] => 
    [alternatename] => 
    [preference] => Array
        (
            [_lastloaded] => 1430097194
        )
    [lastcourseaccess] => Array
        (
        )
    [currentcourseaccess] => Array
        (
        )
    [groupmember] => Array
        (
        )
    [profile] => Array
        (
        )
)

•line 125 of /auth/drupalservices/auth.php: call to debugging()
•line 89 of /login/index.php: call to auth_plugin_drupalservices->loginpage_hook()

Moodle DEBUG when I try to login using admin ..............................

image

atifrasheed79 commented 9 years ago

I somehow managed to login to Moodle using admin :) and fixed the field mappings. Now SSO is working fine for normal users. Just need to look into admin login as direct login to Moodle is required in any case along with SSO feature.

How can we make it happen? can direct login to Moodle and SSO plugin work side by side?

netw3rker commented 9 years ago

Well, at least you are this close ;)

If you want drupal and moodle to have the same username for their root user, you have to manually edit the moodle database and change the id_number value for the moodle admin user to "1", and the "auth" value to "drupalservices".

This is really risky though because if for some reason SSO breaks down, you won't be able to log in as the Moodle admin. You are much better off having different usernames for your respective systems eg moodle_admin and drupal_admin. that way if things go bad, your root level users can still log in.

From a "side by side" perspective, you can create users in Moodle that can only log in to Moodle. they just won't get the id_number field populated in their user record. Just be careful that name-conflicts with Drupal usernames don't happen.

netw3rker commented 9 years ago

Also for the bad cookie_domain value, you were looking in the wrong table. You should be looking in the mdl_config_plugins table. that is where the auth_drupalservices.cookiedomain value is stored. Fix it in there, and you'll be all set. (Then you can remove the code in config.php)

atifrasheed79 commented 9 years ago

ohhh okay, thanks for all your help :) I will look into it now.