phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] [19035] Code refactoring, bug saving ...


From: Caeies
Subject: [Phpgroupware-cvs] [19035] Code refactoring, bug saving ...
Date: Wed, 21 Jan 2009 18:34:06 +0000

Revision: 19035
          
http://svn.sv.gnu.org/viewvc/?view=rev&root=phpgroupware&revision=19035
Author:   Caeies
Date:     2009-01-21 18:34:05 +0000 (Wed, 21 Jan 2009)

Log Message:
-----------
Code refactoring, bug saving ...

Modified Paths:
--------------
    core/trunk/phpgwapi/inc/accounts/class.accounts_.inc.php

Modified: core/trunk/phpgwapi/inc/accounts/class.accounts_.inc.php
===================================================================
--- core/trunk/phpgwapi/inc/accounts/class.accounts_.inc.php    2009-01-21 
18:18:14 UTC (rev 19034)
+++ core/trunk/phpgwapi/inc/accounts/class.accounts_.inc.php    2009-01-21 
18:34:05 UTC (rev 19035)
@@ -341,13 +341,9 @@
                                {
                                        $aclobj->add($acl['appname'], 
$acl['location'], $acl['rights']);
                                }
-
-                               foreach ( $modules as $module )
-                               {
-                                       $aclobj->add($module, 'run', 
phpgwapi_acl::READ);
-                               }
                                $aclobj->save_repository();
-
+                               // application permissions
+                               $this->grant_account_applications($modules, 
($account->id));
                        }
                        catch (Exception $e)
                        {
@@ -623,12 +619,7 @@
                        }
 
                        // module permissions
-                       if ( is_array($modules) )
-                       {
-                               $apps = createObject('phpgwapi.applications', 
$group->id);
-                               $apps->update_data(array_keys($modules));
-                               $apps->save_repository();
-                       }
+                       $this->grant_account_applications($modules, $group->id);
 
                        // FIXME This is broken and only supports localFS VFS
                        if ( $group->old_loginid != $group->lid )
@@ -680,12 +671,7 @@
                        //FIXME need permissions here
 
                        // application permissions
-                       if ( is_array($modules) )
-                       {
-                               $apps = createObject('phpgwapi.applications', 
$user->id);
-                               $apps->update_data(array_keys($modules));
-                               $apps->save_repository();
-                       }
+                       $this->grant_account_applications($modules, $user->id);
 
                        return true;
                }
@@ -925,4 +911,24 @@
                        $user->person_id = $contacts->add_contact($type, 
$primary, $comms);
                        return !!$user->person_id;
                }
+
+               /**
+               * Grant / remove the applications for current user
+               *
+               * @param array $modules list of applications to grant to the 
user
+               * @param int $id the user id to grant the use of applications
+               * 
+               * @return void
+               */
+               private function grant_account_applications($modules, $id)
+               {
+                       $data_app = array();
+                       if ( is_array($modules) )
+                       {
+                               $data_app = $modules;
+                       }
+                       $apps = createObject('phpgwapi.applications', $id);
+                       $apps->update_data($data_app);
+                       $apps->save_repository();
+               }
        }






reply via email to

[Prev in Thread] Current Thread [Next in Thread]