fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [6460] API : add credentials to admins at intall


From: Sigurd Nes
Subject: [Fmsystem-commits] [6460] API : add credentials to admins at intall
Date: Sun, 10 Oct 2010 12:00:45 +0000

Revision: 6460
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=6460
Author:   sigurdne
Date:     2010-10-10 12:00:44 +0000 (Sun, 10 Oct 2010)
Log Message:
-----------
API : add credentials to admins at intall

Modified Paths:
--------------
    trunk/phpgwapi/inc/class.setup_process.inc.php
    trunk/setup/applications.php

Modified: trunk/phpgwapi/inc/class.setup_process.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.setup_process.inc.php      2010-10-10 11:59:35 UTC 
(rev 6459)
+++ trunk/phpgwapi/inc/class.setup_process.inc.php      2010-10-10 12:00:44 UTC 
(rev 6460)
@@ -445,6 +445,51 @@
                }
 
                /**
+                * process application add credential to admins at install
+                *
+                * @param $setup_info   array of application info from 
setup.inc.php files, etc.
+                */
+               function add_credential($appname)
+               {
+                       $GLOBALS['phpgw']->accounts     = 
createObject('phpgwapi.accounts');
+                       $GLOBALS['phpgw']->acl          = 
CreateObject('phpgwapi.acl');
+                       $GLOBALS['phpgw']->acl->enable_inheritance = true;
+
+                       $admins = array();
+                       $accounts       = 
$GLOBALS['phpgw']->acl->get_ids_for_location('run', phpgwapi_acl::READ, 
'admin');
+                       foreach($accounts as $account_id)
+                       {
+                               $account = 
$GLOBALS['phpgw']->accounts->get($account_id);
+                               if($account->type == 
phpgwapi_account::TYPE_GROUP)
+                               {
+                                       $admins[] = $account_id;
+                               }
+                       }
+
+                       $members = array();
+                       foreach ($admins as $admin)
+                       {
+                               if(!$GLOBALS['phpgw']->acl->check('run', 
phpgwapi_acl::READ, $appname))
+                               {
+                                       $aclobj =& $GLOBALS['phpgw']->acl;
+                                       $aclobj->set_account_id($admin, true);
+                                       // application permissions
+                                       $aclobj->add($appname, 'run', 
phpgwapi_acl::READ);
+                                       $aclobj->save_repository();
+                                       $members = array_merge($members, 
$GLOBALS['phpgw']->accounts->get_members($admin));
+                               }
+                       }
+
+                       $members = array_unique($members);
+                       //Clear the user's menu so it can be regenerated cleanly
+                       //FIXME - the cache is not cleared
+                       foreach ($members as $account_id)
+                       {
+                               phpgwapi_cache::user_clear('phpgwapi', 'menu', 
$account_id);
+                       }
+               }
+
+               /**
                 * process test_data.inc.php in each application/setup dir for 
developer tests
                *
                 * This data should work with the baseline tables

Modified: trunk/setup/applications.php
===================================================================
--- trunk/setup/applications.php        2010-10-10 11:59:35 UTC (rev 6459)
+++ trunk/setup/applications.php        2010-10-10 12:00:44 UTC (rev 6460)
@@ -142,6 +142,7 @@
                        $GLOBALS['phpgw_setup']->process->init_process();
                }
 
+//$GLOBALS['phpgw_setup']->process->add_credential('property');
                if(!empty($remove) && is_array($remove))
                {
                        
$GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
@@ -219,6 +220,8 @@
                                }
                                $terror = 
$GLOBALS['phpgw_setup']->process->add_langs($terror,$DEBUG,$force_en);
                                echo '<li>' . lang('%1 translations added', 
lang($appname)) . ".</li>\n</ul>\n";
+                               // Add credentials to admins
+                               
$GLOBALS['phpgw_setup']->process->add_credential($appname);
                        }
                        
$GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit();
                }




reply via email to

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