Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x
This commit is contained in:
commit
6a19bcc0e2
@ -350,8 +350,11 @@ function common_current_user()
|
|||||||
common_ensure_session();
|
common_ensure_session();
|
||||||
$id = isset($_SESSION['userid']) ? $_SESSION['userid'] : false;
|
$id = isset($_SESSION['userid']) ? $_SESSION['userid'] : false;
|
||||||
if ($id) {
|
if ($id) {
|
||||||
$_cur = User::staticGet($id);
|
$user = User::staticGet($id);
|
||||||
return $_cur;
|
if ($user) {
|
||||||
|
$_cur = $user;
|
||||||
|
return $_cur;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,10 +40,10 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
|||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
abstract class AuthPlugin extends Plugin
|
abstract class AuthenticationPlugin extends Plugin
|
||||||
{
|
{
|
||||||
//is this plugin authoritative for authentication?
|
//is this plugin authoritative for authentication?
|
||||||
public $authn_authoritative = false;
|
public $authoritative = false;
|
||||||
|
|
||||||
//should accounts be automatically created after a successful login attempt?
|
//should accounts be automatically created after a successful login attempt?
|
||||||
public $autoregistration = false;
|
public $autoregistration = false;
|
||||||
@ -119,13 +119,13 @@ abstract class AuthPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}else{
|
}else{
|
||||||
if($this->authn_authoritative){
|
if($this->authoritative){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//we're not authoritative, so let other handlers try
|
//we're not authoritative, so let other handlers try
|
||||||
}else{
|
}else{
|
||||||
if($this->authn_authoritative){
|
if($this->authoritative){
|
||||||
//since we're authoritative, no other plugin could do this
|
//since we're authoritative, no other plugin could do this
|
||||||
throw new Exception(_('Password changing is not allowed'));
|
throw new Exception(_('Password changing is not allowed'));
|
||||||
}
|
}
|
||||||
@ -145,7 +145,7 @@ abstract class AuthPlugin extends Plugin
|
|||||||
throw new Exception(_('Password changing failed'));
|
throw new Exception(_('Password changing failed'));
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
if($this->authn_authoritative){
|
if($this->authoritative){
|
||||||
//since we're authoritative, no other plugin could do this
|
//since we're authoritative, no other plugin could do this
|
||||||
throw new Exception(_('Password changing failed'));
|
throw new Exception(_('Password changing failed'));
|
||||||
}else{
|
}else{
|
||||||
@ -154,7 +154,7 @@ abstract class AuthPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
if($this->authn_authoritative){
|
if($this->authoritative){
|
||||||
//since we're authoritative, no other plugin could do this
|
//since we're authoritative, no other plugin could do this
|
||||||
throw new Exception(_('Password changing is not allowed'));
|
throw new Exception(_('Password changing is not allowed'));
|
||||||
}
|
}
|
||||||
@ -163,7 +163,7 @@ abstract class AuthPlugin extends Plugin
|
|||||||
|
|
||||||
function onStartAccountSettingsPasswordMenuItem($widget)
|
function onStartAccountSettingsPasswordMenuItem($widget)
|
||||||
{
|
{
|
||||||
if($this->authn_authoritative && !$this->password_changeable){
|
if($this->authoritative && !$this->password_changeable){
|
||||||
//since we're authoritative, no other plugin could change passwords, so do render the menu item
|
//since we're authoritative, no other plugin could change passwords, so do render the menu item
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
@ -31,10 +31,10 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once INSTALLDIR.'/plugins/Auth/AuthPlugin.php';
|
require_once INSTALLDIR.'/plugins/Authentication/AuthenticationPlugin.php';
|
||||||
require_once 'Net/LDAP2.php';
|
require_once 'Net/LDAP2.php';
|
||||||
|
|
||||||
class LdapPlugin extends AuthPlugin
|
class LdapAuthenticatonPlugin extends AuthenticationPlugin
|
||||||
{
|
{
|
||||||
public $host=null;
|
public $host=null;
|
||||||
public $port=null;
|
public $port=null;
|
@ -1,12 +1,12 @@
|
|||||||
The LDAP plugin allows for StatusNet to handle authentication, authorization, and user information through LDAP.
|
The LDAP Authentication plugin allows for StatusNet to handle authentication through LDAP.
|
||||||
|
|
||||||
Installation
|
Installation
|
||||||
============
|
============
|
||||||
add "addPlugin('ldap', array('setting'=>'value', 'setting2'=>'value2', ...);" to the bottom of your config.php
|
add "addPlugin('ldapAuthentication', array('setting'=>'value', 'setting2'=>'value2', ...);" to the bottom of your config.php
|
||||||
|
|
||||||
Settings
|
Settings
|
||||||
========
|
========
|
||||||
authn_authoritative (false): Set to true if LDAP's responses are authoritative (meaning if LDAP fails, do check the any other plugins or the internal password database).
|
authoritative (false): Set to true if LDAP's responses are authoritative (meaning if LDAP fails, do check the any other plugins or the internal password database).
|
||||||
autoregistration (false): Set to true if users should be automatically created when they attempt to login.
|
autoregistration (false): Set to true if users should be automatically created when they attempt to login.
|
||||||
email_changeable (true): Are users allowed to change their email address? (true or false)
|
email_changeable (true): Are users allowed to change their email address? (true or false)
|
||||||
password_changeable (true): Are users allowed to change their passwords? (true or false)
|
password_changeable (true): Are users allowed to change their passwords? (true or false)
|
||||||
@ -36,8 +36,8 @@ Example
|
|||||||
=======
|
=======
|
||||||
Here's an example of an LDAP plugin configuration that connects to Microsoft Active Directory.
|
Here's an example of an LDAP plugin configuration that connects to Microsoft Active Directory.
|
||||||
|
|
||||||
addPlugin('ldap', array(
|
addPlugin('ldapAuthentication', array(
|
||||||
'authn_authoritative'=>true,
|
'authoritative'=>true,
|
||||||
'autoregistration'=>true,
|
'autoregistration'=>true,
|
||||||
'binddn'=>'username',
|
'binddn'=>'username',
|
||||||
'bindpw'=>'password',
|
'bindpw'=>'password',
|
Loading…
Reference in New Issue
Block a user