[Vtigercrm-commits] [vtiger-commits] r5137 - /vtigercrm/trunk/include/utils/UserInfoUtil.php
vtigercrm-commits at vtiger.fosslabs.com
vtigercrm-commits at vtiger.fosslabs.com
Sat Apr 15 09:36:50 EDT 2006
Author: don
Date: Sat Apr 15 07:36:46 2006
New Revision: 5137
Log:
added function RecalculateSharingRules()
Modified:
vtigercrm/trunk/include/utils/UserInfoUtil.php
Modified: vtigercrm/trunk/include/utils/UserInfoUtil.php
==============================================================================
--- vtigercrm/trunk/include/utils/UserInfoUtil.php (original)
+++ vtigercrm/trunk/include/utils/UserInfoUtil.php Sat Apr 15 07:36:46 2006
@@ -346,18 +346,20 @@
function getAllDefaultSharingAction()
{
global $adb;
+ $copy=Array();
//retreiving the standard permissions
$sql= "select * from def_org_share";
$result = $adb->query($sql);
- $permissionRow=$adb->fetch_array($result);
- do
- {
- for($j=0;$j<count($permissionRow);$j++)
- {
- $copy[$permissionRow[1]]=$permissionRow[2];
- }
-
- }while($permissionRow=$adb->fetch_array($result));
+ $num_rows=$adb->num_rows($result);
+
+ for($i=0;$i<$num_rows;$i++)
+ {
+ $tabid=$adb->query_result($result,$i,'tabid');
+ $permission=$adb->query_result($result,$i,'permission');
+ $copy[$tabid]=$permission;
+
+ }
+
return $copy;
}
@@ -4072,4 +4074,26 @@
return $permittedModules;
}
+
+
+/** Function to recalculate the Sharing Rules for all the users
+ * This function will recalculate all the sharing rules for all the users in the Organization and will write them in flat files
+ *
+ */
+function RecalculateSharingRules()
+{
+ global $adb;
+ require_once('modules/Users/CreateUserPrivilegeFile.php');
+ $query="select id from users where deleted=0";
+ $result=$adb->query($query);
+ $num_rows=$adb->num_rows($result);
+ for($i=0;$i<$num_rows;$i++)
+ {
+ $id=$adb->query_result($result,$i,'id');
+ createUserPrivilegesfile($id);
+ createUserSharingPrivilegesfile($id);
+ }
+
+}
+
?>
More information about the vtigercrm-commits
mailing list