通过外部站点登录Moodle [英] Logging into Moodle via external site

查看:541
本文介绍了通过外部站点登录Moodle的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在设置一个Moodle环境,我需要用户能够使用他们来自那个站点的凭据通过外部站点登录.理想情况下,他们会去网站上登录,然后单击一个按钮,将其连同他们的帐户信息一起发送到Moodle.

I'm setting up a Moodle environment and I need users to be able to login via an external site using their credentials from that site. Ideally they would go to the website, login in, and then click a button that will send them to Moodle along with their account information.

一旦他们到达Moodle,Moodle将检查帐户信息是否已经存在.如果是这样,它将登录,否则它将创建帐户并登录.

Once they get to Moodle, Moodle will check to see if the account information already exists. If so it will login, otherwise it will create the account and login.

我已经设置了Moodle环境以及登录站点. Moodle网站不允许访问登录网站上的数据库,并且用户在任何时候都不必再次输入其信息.

I already have the Moodle environment set up, as well as the login site. The Moodle site is not allowed to access the database on the login site, and the users shouldn't have to enter their information again at any point.

我已经花了几个小时尝试通过一个插件完成向后工作,该插件在Moodle和社交网站(facebook,twitter,google +等)之间完成了类似的工作,但是没有取得任何进展,以及从一个链接了Moodle的插件在Joomla上,我已经在这里和其他论坛中搜索了我所能找到的与我无济于事的内容类似的内容.任何帮助将不胜感激.

I've already spent several hours attempting to work backwards from a plugin that accomplishes something similar between Moodle and social networking sites (facebook, twitter, google+, etc) but made no progress, as well as from a plugin that linked Moodle with Joomla, and I've searched through here and other forums for anything I could find similar to what I need to accomplish to no avail. Any help would be very appreciated.

我忘了提到Moodle版本是2.5.4

I forgot to mention that the Moodle version is 2.5.4

以下操作将创建一个新用户,并将数据发布到"login/index.php"页面.当前这是非常不完整的,可能在生产服务器上实现很危险.当我继续使用它时,将发布更新的版本,非常欢迎提出建议.

The following will create a new user with data posted to the "login/index.php" page. This is currently very incomplete and probably dangerous to implement on a production server. Updated versions will be posted as I continue to work on it, suggestions are more than welcome.

    global $CFG, $DB;
    require_once($CFG->dirroot.'/user/profile/lib.php');
    require_once($CFG->libdir.'/authlib.php');

    $newuser = $DB->get_record('user', array('id'=>'1'));
    $newuser->auth = 'manual';
    $newuser->username = $frm->username;
    $newuser->password = hash_internal_user_password($frm->password);

    $newuser->username = $DB->insert_record('user', $newuser);

    /// Save any custom profile field information
    profile_save_data($newuser);

    $newuser = $DB->get_record('user', array('id'=>$newuser->username));
    events_trigger('user_created', $newuser);

推荐答案

使用外部数据库身份验证可能最容易设置,尤其是当两个系统都在同一服务器上时.

Using external database authentication is probably the easiest to set up, especially if both systems are on the same server.

转到站点管理员">插件">身份验证">管理插件"->单击外部数据库"旁边的取消隐藏按钮

go to Site Admin > Plugins > Authentication > Manage Plugins -> Click the unhide button next to External Database

然后单击设置,并添加数据库的连接详细信息,外部表的名称(如果数据来自多个表,则创建一个视图)并添加字段映射.

Then click on the settings and add the connection details for your database, name of the external table (or create a view if the data is from several tables) and add the field mappings.

http://docs.moodle.org/26/en/External_database_authentication

或者,我将SimpleSAML插件与LDAP一起使用-假设您有LDAP服务器-大约需要一天的时间进行设置并弄乱设置.

Alternatively, I would use the SimpleSAML plugin with LDAP - assuming you have an LDAP server - takes about a day to set up and mess about with the settings.

https://moodle.org/plugins/view.php?plugin=auth_saml

这篇关于通过外部站点登录Moodle的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆