Merge branch 'xorg/maint' into xorg/master
authorStéphane Jacob <sj@m4x.org>
Sun, 3 Apr 2011 12:43:56 +0000 (14:43 +0200)
committerStéphane Jacob <sj@m4x.org>
Sun, 3 Apr 2011 12:43:56 +0000 (14:43 +0200)
include/emails.inc.php
include/profilefields.inc.php
modules/googleapps.php
templates/admin/user.tpl
templates/emails/redirect.tpl
upgrade/1.1.0/xx_03_types.sql [new file with mode: 0644]

index 74eb015..37653fd 100644 (file)
@@ -606,7 +606,8 @@ class Email
 
         // Google Apps storage is available for users with valid Google Apps account.
         require_once 'googleapps.inc.php';
-        if ($globals->mailstorage->googleapps_domain &&
+        if ($user->checkPerms('gapps') &&
+            $globals->mailstorage->googleapps_domain &&
             GoogleAppsAccount::account_status($user->id()) == 'active') {
             $storages[] = 'googleapps';
         }
index 6192575..2de1e6b 100644 (file)
@@ -644,7 +644,7 @@ class ProfileJobs extends ProfileField
     {
         $a = $addresses->get(Profile::ADDRESS_PRO);
         foreach ($a as $address) {
-            if ($address->type == Address::LINK_JOB && array_key_exists($address->jobid, $this->jobs)) {
+            if ($address->type == Address::LINK_JOB && array_key_exists($address->id, $this->jobs)) {
                 $this->jobs[$address->id]->setAddress($address);
             }
         }
index bbe1c9f..e02c253 100644 (file)
@@ -29,7 +29,7 @@ class GoogleAppsModule extends PLModule
         }
 
         return array(
-            'googleapps'            => $this->make_hook('index',      AUTH_MDP, 'mail'),
+            'googleapps'            => $this->make_hook('index',      AUTH_MDP, 'gapps'),
             'admin/googleapps'      => $this->make_hook('admin',      AUTH_MDP, 'admin'),
             'admin/googleapps/job'  => $this->make_hook('admin_job',  AUTH_MDP, 'admin'),
             'admin/googleapps/user' => $this->make_hook('admin_user', AUTH_MDP, 'admin'),
index d9f35b1..b369443 100644 (file)
@@ -409,9 +409,9 @@ $(function() {
       </td>
       <td>
         {if $mail->broken}<span style="color: #f00">{/if}
-        {if $mail->email == 'googleapps'}<a href="admin/googleapps/user/{$user->login()}">{/if}
+        {if $mail->type == 'googleapps'}<a href="admin/googleapps/user/{$user->login()}">{/if}
         {$mail->display_email}
-        {if $mail->email == 'googleapps'}</a>{/if}
+        {if $mail->type == 'googleapps'}</a>{/if}
         {if $mail->broken}<em> (en panne)</em></span>{/if}
       </td>
       <td>
index 194235d..fe168b3 100644 (file)
 {/if}
 
 {if #globals.mailstorage.googleapps_active# or hasPerm('admin') or $googleapps}
+{if hasPerm('gapps')}
 <br />
 <p id="googleapps">
   Grâce à un partenariat avec Google, Polytechnique.org te propose également un compte
   </tr>
 </table>
 {/if}
+{/if}
 
 {if $eleve}
 <h1>Pour les élèves (non encore diplômés)</h1>
diff --git a/upgrade/1.1.0/xx_03_types.sql b/upgrade/1.1.0/xx_03_types.sql
new file mode 100644 (file)
index 0000000..f5922b5
--- /dev/null
@@ -0,0 +1,10 @@
+ALTER TABLE account_types MODIFY COLUMN perms SET('groups','mail','directory_ax','directory_private','edit_directory','forums','lists','payment','api_user_readonly','gapps') NOT NULL DEFAULT '';
+
+UPDATE  account_types
+   SET  perms = 'groups,mail,directory_private,forums,lists,payment,gapps'
+ WHERE  type = 'x';
+UPDATE  account_types
+   SET  perms = 'groups,mail,directory_private,forums,lists,payment'
+ WHERE  type = 'master' OR type = 'phd';
+
+-- vim:set syntax=mysql: