Temporarly removes gapps acces to phd and master.
authorStéphane Jacob <sj@m4x.org>
Sat, 2 Apr 2011 12:24:36 +0000 (14:24 +0200)
committerStéphane Jacob <sj@m4x.org>
Sat, 2 Apr 2011 12:24:36 +0000 (14:24 +0200)
Signed-off-by: Stéphane Jacob <sj@m4x.org>
include/emails.inc.php
modules/googleapps.php
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 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 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: