[Vtigercrm-commits] [vtiger-commits] r5115 - /vtigercrm/trunk/modules/Users/CreateUserPrivilegeFile.php
vtigercrm-commits at vtiger.fosslabs.com
vtigercrm-commits at vtiger.fosslabs.com
Fri Apr 14 02:45:27 EDT 2006
Author: don
Date: Fri Apr 14 00:45:22 2006
New Revision: 5115
Log:
Fixed the issue in sub groups sharing when a group is shared
Modified:
vtigercrm/trunk/modules/Users/CreateUserPrivilegeFile.php
Modified: vtigercrm/trunk/modules/Users/CreateUserPrivilegeFile.php
==============================================================================
--- vtigercrm/trunk/modules/Users/CreateUserPrivilegeFile.php (original)
+++ vtigercrm/trunk/modules/Users/CreateUserPrivilegeFile.php Fri Apr 14 00:45:22 2006
@@ -721,8 +721,98 @@
$share_id_grp_members=Array();
$share_id_grps=Array();
$share_id_grps[]=$share_grpid;
+
+
+ if($share_permission == 1)
+ {
+ if($def_org_share[$mod_tabid] == 3)
+ {
+ if(! array_key_exists($share_grpid,$grp_read_per))
+ {
+ $focusGrpUsers = new GetGroupUsers();
+ $focusGrpUsers->getAllUsersInGroup($share_grpid);
+ $share_grp_users=$focusGrpUsers->group_users;
+ $share_grp_subgroups=$focusGrpUsers->group_subgroups;
+ $grp_read_per[$share_grpid]=$share_grp_users;
+ foreach($focusGrpUsers->group_subgroups as $subgrpid=>$subgrpusers)
+ {
+ if(! array_key_exists($subgrpid,$grp_read_per))
+ {
+ $grp_read_per[$subgrpid]=$subgrpusers;
+ }
+ if(! in_array($subgrpid,$share_id_grps))
+ {
+ $share_id_grps[]=$subgrpid;
+ }
+
+ }
+ }
+ }
+ if(! array_key_exists($share_grpid,$grp_write_per))
+ {
+ $focusGrpUsers = new GetGroupUsers();
+ $focusGrpUsers->getAllUsersInGroup($share_grpid);
+ $share_grp_users=$focusGrpUsers->group_users;
+ $grp_write_per[$share_grpid]=$share_grp_users;
+ foreach($focusGrpUsers->group_subgroups as $subgrpid=>$subgrpusers)
+ {
+ if(! array_key_exists($subgrpid,$grp_write_per))
+ {
+ $grp_write_per[$subgrpid]=$subgrpusers;
+ }
+ if(! in_array($subgrpid,$share_id_grps))
+ {
+ $share_id_grps[]=$subgrpid;
+ }
+
+ }
+
+ }
+ }
+ elseif($share_permission == 0 && $def_org_share[$mod_tabid] == 3)
+ {
+ if(! array_key_exists($share_grpid,$grp_read_per))
+ {
+ $focusGrpUsers = new GetGroupUsers();
+ $focusGrpUsers->getAllUsersInGroup($share_grpid);
+ $share_grp_users=$focusGrpUsers->group_users;
+ $grp_read_per[$share_grpid]=$share_grp_users;
+ foreach($focusGrpUsers->group_subgroups as $subgrpid=>$subgrpusers)
+ {
+ if(! array_key_exists($subgrpid,$grp_read_per))
+ {
+ $grp_read_per[$subgrpid]=$subgrpusers;
+ }
+ if(! in_array($subgrpid,$share_id_grps))
+ {
+ $share_id_grps[]=$subgrpid;
+ }
+
+ }
+ }
+
+ }
$share_id_grp_members['GROUP']=$share_id_grps;
$share_id_members[$shareid]=$share_id_grp_members;
+
+ }
+
+ //Retreiving from the grp2rs sharing
+
+
+ $query="select datashare_grp2rs.* from datashare_grp2rs inner join datashare_module_rel on datashare_module_rel.shareid=datashare_grp2rs.shareid where datashare_module_rel.tabid=".$mod_tabid." and datashare_grp2rs.to_roleandsubid in ".$parRoleList;
+ $result=$adb->query($query);
+ $num_rows=$adb->num_rows($result);
+ for($i=0;$i<$num_rows;$i++)
+ {
+ $share_grpid=$adb->query_result($result,$i,'share_groupid');
+ $share_permission=$adb->query_result($result,$i,'permission');
+
+ $shareid=$adb->query_result($result,$i,'shareid');
+ $share_id_grp_members=Array();
+ $share_id_grps=Array();
+ $share_id_grps[]=$share_grpid;
+
if($share_permission == 1)
{
@@ -734,6 +824,19 @@
$focusGrpUsers->getAllUsersInGroup($share_grpid);
$share_grp_users=$focusGrpUsers->group_users;
$grp_read_per[$share_grpid]=$share_grp_users;
+
+ foreach($focusGrpUsers->group_subgroups as $subgrpid=>$subgrpusers)
+ {
+ if(! array_key_exists($subgrpid,$grp_read_per))
+ {
+ $grp_read_per[$subgrpid]=$subgrpusers;
+ }
+ if(! in_array($subgrpid,$share_id_grps))
+ {
+ $share_id_grps[]=$subgrpid;
+ }
+
+ }
}
}
if(! array_key_exists($share_grpid,$grp_write_per))
@@ -742,6 +845,18 @@
$focusGrpUsers->getAllUsersInGroup($share_grpid);
$share_grp_users=$focusGrpUsers->group_users;
$grp_write_per[$share_grpid]=$share_grp_users;
+ foreach($focusGrpUsers->group_subgroups as $subgrpid=>$subgrpusers)
+ {
+ if(! array_key_exists($subgrpid,$grp_write_per))
+ {
+ $grp_write_per[$subgrpid]=$subgrpusers;
+ }
+ if(! in_array($subgrpid,$share_id_grps))
+ {
+ $share_id_grps[]=$subgrpid;
+ }
+
+ }
}
}
@@ -753,62 +868,23 @@
$focusGrpUsers->getAllUsersInGroup($share_grpid);
$share_grp_users=$focusGrpUsers->group_users;
$grp_read_per[$share_grpid]=$share_grp_users;
- }
-
- }
-
- }
-
- //Retreiving from the grp2rs sharing
-
-
- $query="select datashare_grp2rs.* from datashare_grp2rs inner join datashare_module_rel on datashare_module_rel.shareid=datashare_grp2rs.shareid where datashare_module_rel.tabid=".$mod_tabid." and datashare_grp2rs.to_roleandsubid in ".$parRoleList;
- $result=$adb->query($query);
- $num_rows=$adb->num_rows($result);
- for($i=0;$i<$num_rows;$i++)
- {
- $share_grpid=$adb->query_result($result,$i,'share_groupid');
- $share_permission=$adb->query_result($result,$i,'permission');
-
- $shareid=$adb->query_result($result,$i,'shareid');
- $share_id_grp_members=Array();
- $share_id_grps=Array();
- $share_id_grps[]=$share_grpid;
+ foreach($focusGrpUsers->group_subgroups as $subgrpid=>$subgrpusers)
+ {
+ if(! array_key_exists($subgrpid,$grp_read_per))
+ {
+ $grp_read_per[$subgrpid]=$subgrpusers;
+ }
+ if(! in_array($subgrpid,$share_id_grps))
+ {
+ $share_id_grps[]=$subgrpid;
+ }
+
+ }
+ }
+
+ }
$share_id_grp_members['GROUP']=$share_id_grps;
$share_id_members[$shareid]=$share_id_grp_members;
-
- if($share_permission == 1)
- {
- if($def_org_share[$mod_tabid] == 3)
- {
- if(! array_key_exists($share_grpid,$grp_read_per))
- {
- $focusGrpUsers = new GetGroupUsers();
- $focusGrpUsers->getAllUsersInGroup($share_grpid);
- $share_grp_users=$focusGrpUsers->group_users;
- $grp_read_per[$share_grpid]=$share_grp_users;
- }
- }
- if(! array_key_exists($share_grpid,$grp_write_per))
- {
- $focusGrpUsers = new GetGroupUsers();
- $focusGrpUsers->getAllUsersInGroup($share_grpid);
- $share_grp_users=$focusGrpUsers->group_users;
- $grp_write_per[$share_grpid]=$share_grp_users;
-
- }
- }
- elseif($share_permission == 0 && $def_org_share[$mod_tabid] == 3)
- {
- if(! array_key_exists($share_grpid,$grp_read_per))
- {
- $focusGrpUsers = new GetGroupUsers();
- $focusGrpUsers->getAllUsersInGroup($share_grpid);
- $share_grp_users=$focusGrpUsers->group_users;
- $grp_read_per[$share_grpid]=$share_grp_users;
- }
-
- }
}
@@ -826,8 +902,6 @@
$share_id_grp_members=Array();
$share_id_grps=Array();
$share_id_grps[]=$share_grpid;
- $share_id_grp_members['GROUP']=$share_id_grps;
- $share_id_members[$shareid]=$share_id_grp_members;
if($share_permission == 1)
{
@@ -839,6 +913,19 @@
$focusGrpUsers->getAllUsersInGroup($share_grpid);
$share_grp_users=$focusGrpUsers->group_users;
$grp_read_per[$share_grpid]=$share_grp_users;
+ foreach($focusGrpUsers->group_subgroups as $subgrpid=>$subgrpusers)
+ {
+ if(! array_key_exists($subgrpid,$grp_read_per))
+ {
+ $grp_read_per[$subgrpid]=$subgrpusers;
+ }
+ if(! in_array($subgrpid,$share_id_grps))
+ {
+ $share_id_grps[]=$subgrpid;
+ }
+
+
+ }
}
}
if(! array_key_exists($share_grpid,$grp_write_per))
@@ -847,6 +934,18 @@
$focusGrpUsers->getAllUsersInGroup($share_grpid);
$share_grp_users=$focusGrpUsers->group_users;
$grp_write_per[$share_grpid]=$share_grp_users;
+ foreach($focusGrpUsers->group_subgroups as $subgrpid=>$subgrpusers)
+ {
+ if(! array_key_exists($subgrpid,$grp_write_per))
+ {
+ $grp_write_per[$subgrpid]=$subgrpusers;
+ }
+ if(! in_array($subgrpid,$share_id_grps))
+ {
+ $share_id_grps[]=$subgrpid;
+ }
+
+ }
}
}
@@ -858,9 +957,23 @@
$focusGrpUsers->getAllUsersInGroup($share_grpid);
$share_grp_users=$focusGrpUsers->group_users;
$grp_read_per[$share_grpid]=$share_grp_users;
- }
-
- }
+ foreach($focusGrpUsers->group_subgroups as $subgrpid=>$subgrpusers)
+ {
+ if(! array_key_exists($subgrpid,$grp_read_per))
+ {
+ $grp_read_per[$subgrpid]=$subgrpusers;
+ }
+ if(! in_array($subgrpid,$share_id_grps))
+ {
+ $share_id_grps[]=$subgrpid;
+ }
+
+ }
+ }
+
+ }
+ $share_id_grp_members['GROUP']=$share_id_grps;
+ $share_id_members[$shareid]=$share_id_grp_members;
}
$mod_share_read_permission['GROUP']=$grp_read_per;
@@ -875,6 +988,7 @@
function getRelatedModuleSharingArray($par_mod,$share_mod,$mod_sharingrule_members,$mod_share_read_per,$mod_share_write_per,$def_org_share)
{
+
global $adb;
$related_mod_sharing_permission=Array();
$mod_share_read_permission=Array();
@@ -908,7 +1022,6 @@
{
foreach($shareEntArr as $key=>$shareEntId)
{
-
if($shareType == 'ROLE')
{
if($share_permission == 1)
@@ -986,7 +1099,8 @@
if($share_permission == 1)
{
if($def_org_share[$share_mod_id] == 3)
- {
+ {
+
if(! array_key_exists($shareEntId,$grp_read_per))
{
if(array_key_exists($shareEntId,$mod_share_read_per['GROUP']))
@@ -1002,6 +1116,15 @@
$focusGrpUsers = new GetGroupUsers();
$focusGrpUsers->getAllUsersInGroup($shareEntId);
$share_grp_users=$focusGrpUsers->group_users;
+
+ foreach($focusGrpUsers->group_subgroups as $subgrpid=>$subgrpusers)
+ {
+ if(! array_key_exists($subgrpid,$grp_read_per))
+ {
+ $grp_read_per[$subgrpid]=$subgrpusers;
+ }
+
+ }
}
@@ -1026,6 +1149,14 @@
$focusGrpUsers = new GetGroupUsers();
$focusGrpUsers->getAllUsersInGroup($shareEntId);
$share_grp_users=$focusGrpUsers->group_users;
+ foreach($focusGrpUsers->group_subgroups as $subgrpid=>$subgrpusers)
+ {
+ if(! array_key_exists($subgrpid,$grp_write_per))
+ {
+ $grp_write_per[$subgrpid]=$subgrpusers;
+ }
+
+ }
}
@@ -1051,6 +1182,14 @@
$focusGrpUsers = new GetGroupUsers();
$focusGrpUsers->getAllUsersInGroup($shareEntId);
$share_grp_users=$focusGrpUsers->group_users;
+ foreach($focusGrpUsers->group_subgroups as $subgrpid=>$subgrpusers)
+ {
+ if(! array_key_exists($subgrpid,$grp_read_per))
+ {
+ $grp_read_per[$subgrpid]=$subgrpusers;
+ }
+
+ }
}
More information about the vtigercrm-commits
mailing list