cannod / moodle-drupalservices

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

Moodle Drupal SSO #64

Open qudsiyya opened 9 years ago

qudsiyya commented 9 years ago

I have gone through all the issues related to this but couldnt find a solution to my issue. I have followed the guide on git to set up drupal and moodle site for SSO. I am doing all work on my local machine. My drupal is installed at http://192.168.1.110 and moodle is installed at http://192.168.1.110/moodle. I have read that cookie_domain cannot be set to a path or a protocol. I give the following url in drupal settings page on moodle http://192.168.1.110/index.php?q= I can see drupal fields mapping on the page but there aint any options in the drop down fields. I am not able to map the fields, which I believe is because I am not able to connect to the drupal site.

Debugging shows that the cookie_domain field is empty. That is the reason why it is not able to connect. Does any one has a solution to this?

csortu commented 9 years ago

Hello,

I am fighting with similar issues. I cannot manage to see any drupal fields in the drop-down fields where the field mapping is set (moodle settings page). I have a setting with Drupal at mydomain.com and Moodle at learning.mydomain.com

So I am not sure how to proceed. Any advice is welcome.

Csaba

2015-10-08 8:04 GMT+03:00 qudsiyya notifications@github.com:

I have gone through all the issues related to this but couldnt find a solution to my issue. I have followed the guide on git to set up drupal and moodle site for SSO. I am doing all work on my local machine. My drupal is installed at http://192.168.1.110 and moodle is installed at http://192.168.1.110/moodle. I have read that cookie_domain cannot be set to a path or a protocol. I give the following url in drupal settings page on moodle http://192.168.1.110/index.php?q= I can see drupal fields mapping on the page but there aint any options in the drop down fields. I am not able to map the fields, which I believe is because I am not able to connect to the drupal site.

— Reply to this email directly or view it on GitHub https://github.com/cannod/moodle-drupalservices/issues/64.

Csaba Ortutay, PhD Chief Executive Officer HiDucator Ltd http://www.hiducator.com/ Finland

qudsiyya commented 9 years ago

Try setting up $cookie_domain= '.mydomain.com' in settings.php on the drupal side.

o0Charly0o commented 8 years ago

qudsiyya I tried what you said and it does not work , any solution? mappings of the fields do not work :( I'm using Drupal 7.3.4 2.8.9 moodle and on the other server moodle 3.0 and drupal commerce kickstart 2. please I am newbie with php , but I need this to work, any solution?

qudsiyya commented 8 years ago

I am traveling right now. Will get back to you once I touch base.

qudsiyya commented 8 years ago

Meanwhile please specify the exact issue that you are facing

o0Charly0o commented 8 years ago

thank you very much , you have a good trip. :)

qudsiyya commented 8 years ago

if you are still struggling try following these steps. Step 1

Requirements

Drupal 7.x

Views 7.x-x

Services 7.x-x

Services Views 7.x-x

Libraries 7.x-x

Address field (optional) 7.x-x

Addressfield Tokens (optional) 7.x-x

Step 2 Procedure

Enable Views module and dependencies.

Enable Services module

Enable Libraries module

Enable REST server module

Enable Services Views module

Enable Address field (optional)

Step 3 Create remote user

Create a role called service-authenticate and give this role permission to View user profiles.

Create a Drupal user account that will be used by moodle to connect to Drupal and assign this account to the remote-service role. In this example I have created a user with name remote.

Step 4 Create user fields

Moodle uses the fields firstname, lastname,city, country etc. In Drupal, these are not available out of the box so we need to create these fields. The method I used was to use the module Address field and this will be described below.

Add Postal address field at admin/config/people/accounts/fields. When configuring field ensure Name (First name, Last name) is checked in Format handlers.

Step 5

Then make view for users

Step 6

Go to admin/structure/services and add new service.

Machine-readable name of the endpoint: moodlesso

Server: REST

Path to endpoint: moodlesso

Check Session authentication

Click on Edit resources for the newly created service - moodlesso

Enable index for View: Moodle users (muser)

Enable system -> connect

Enable user -> login

Enable user -> logout

Under the server tab, only enable the following.

Response formatters: json

Request parsing: application/json and application/x-www-form-urlencoded

Step 7

Set below lines on your moodle config.php file

$CFG->forced_plugin_settings['auth_drupalservices']['cookiedomain']='.domainname';