Support https in blog URLs
[dotclear.git] / class.xorg.auth.php
index acdb277..e2290b8 100644 (file)
@@ -10,12 +10,12 @@ class xorgAuth extends dcAuth {
                              'nom' => null,
                              'grpauth' => null,
                              'perms' => null);
-  static public function behavior_coreBlogConstruct(&$blog) {
+  static public function behavior_coreBlogConstruct($blog) {
     global $core;
     $core->auth->sudo(array($core->auth, 'updateUserPerms'), $blog);
   }
 
-  public function __construct(&$core) {
+  public function __construct($core) {
     parent::__construct($core);
     $core->addBehavior('coreBlogConstruct', array('xorgAuth', 'behavior_coreBlogConstruct'));
   }
@@ -74,7 +74,7 @@ class xorgAuth extends dcAuth {
     }
   }
 
-  public function updateUserPerms(&$blog) {
+  public function updateUserPerms($blog) {
     global $core;
     $this->buildFromSession();
     if (!isset($_SESSION['auth-xorg'])) {
@@ -95,12 +95,14 @@ class xorgAuth extends dcAuth {
       $this->killSession();
       return;
     }
-    if (($type == 'group-admin' || $type == 'group-member') && $level == 'admin') {
+    if (($type == 'group-admin' || $type == 'group-member' || $type == 'connected') && $level == 'admin') {
       $perms = array('usage' => true,
                      'contentadmin' => true,
                      'admin' => true);
     } else if ($type == 'group-member' && $level == 'membre') {
       $perms = array('usage' => true);
+    } else if ($type == 'connected' && $this->xorg_infos['forlife'] != '') {
+      $perms = array('usage' => true);
     } else if ($type == 'user' && $owner == $this->xorg_infos['forlife']) {
       $perms = array('usage' => true,
                      'contentadmin' => true,
@@ -137,7 +139,7 @@ class xorgAuth extends dcAuth {
     $url .= "&challenge=" . $_SESSION["auth-x-challenge"];
     $url .= "&pass=" . md5($_SESSION["auth-x-challenge"] . XORG_AUTH_KEY);
     $type = $core->blog->settings->xorgauth->get('xorg_blog_type');
-    if ($type == 'group-member' || $type == 'group-admin') {
+    if ($type == 'group-member' || $type == 'group-admin' || $type == 'connected') {
       $url .= '&group=' . $core->blog->settings->xorgauth->get('xorg_blog_owner');
     }
     $url .= "&url=" . urlencode($core->blog->url . "auth/XorgReturn?path=" . $path);