mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-13 01:18:42 +01:00
changed around the check function a little
This commit is contained in:
parent
775d0fc4bc
commit
8a23de20ea
@ -22,21 +22,43 @@
|
|||||||
|
|
||||||
function display_row($bg_color,$label,$id,$name) {
|
function display_row($bg_color,$label,$id,$name) {
|
||||||
global $p;
|
global $p;
|
||||||
|
global $phpgw;
|
||||||
global $phpgw_info;
|
global $phpgw_info;
|
||||||
|
|
||||||
$p->set_var('row_color',$bg_color);
|
$p->set_var('row_color',$bg_color);
|
||||||
$p->set_var('user',$name);
|
$p->set_var('user',$name);
|
||||||
|
$rights = $phpgw->acl->get_rights($label.$id,$phpgw_info["flags"]["currentapp"]);
|
||||||
$p->set_var('read',$label.$phpgw_info["flags"]["currentapp"].'['.$id.']['.PHPGW_ACL_READ.']');
|
$p->set_var('read',$label.$phpgw_info["flags"]["currentapp"].'['.$id.']['.PHPGW_ACL_READ.']');
|
||||||
|
if ($rights & PHPGW_ACL_READ) {
|
||||||
|
$p->set_var('read_selected',' checked');
|
||||||
|
} else {
|
||||||
|
$p->set_var('read_selected','');
|
||||||
|
}
|
||||||
$p->set_var('add',$label.$phpgw_info["flags"]["currentapp"].'['.$id.']['.PHPGW_ACL_ADD.']');
|
$p->set_var('add',$label.$phpgw_info["flags"]["currentapp"].'['.$id.']['.PHPGW_ACL_ADD.']');
|
||||||
|
if ($rights & PHPGW_ACL_ADD) {
|
||||||
|
$p->set_var('add_selected',' checked');
|
||||||
|
} else {
|
||||||
|
$p->set_var('add_selected','');
|
||||||
|
}
|
||||||
$p->set_var('edit',$label.$phpgw_info["flags"]["currentapp"].'['.$id.']['.PHPGW_ACL_EDIT.']');
|
$p->set_var('edit',$label.$phpgw_info["flags"]["currentapp"].'['.$id.']['.PHPGW_ACL_EDIT.']');
|
||||||
|
if ($rights & PHPGW_ACL_EDIT) {
|
||||||
|
$p->set_var('edit_selected',' checked');
|
||||||
|
} else {
|
||||||
|
$p->set_var('edit_selected','');
|
||||||
|
}
|
||||||
$p->set_var('delete',$label.$phpgw_info["flags"]["currentapp"].'['.$id.']['.PHPGW_ACL_DELETE.']');
|
$p->set_var('delete',$label.$phpgw_info["flags"]["currentapp"].'['.$id.']['.PHPGW_ACL_DELETE.']');
|
||||||
|
if ($rights & PHPGW_ACL_DELETE) {
|
||||||
|
$p->set_var('delete_selected',' checked');
|
||||||
|
} else {
|
||||||
|
$p->set_var('delete_selected','');
|
||||||
|
}
|
||||||
$p->parse('row','acl_row',True);
|
$p->parse('row','acl_row',True);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($submit) {
|
if ($submit) {
|
||||||
|
|
||||||
// Still need to write a function in ACL class to wipe all records where
|
$phpgw->acl->remove_granted_rights($phpgw_info["flags"]["currentapp"],"u");
|
||||||
// acl_location like '[gu]_$phpgw_info["flags"]["currentapp"]_%'
|
$phpgw->acl->remove_granted_rights($phpgw_info["flags"]["currentapp"],"g");
|
||||||
|
|
||||||
// Group records
|
// Group records
|
||||||
$group_variable = 'g_'.$phpgw_info["flags"]["currentapp"];
|
$group_variable = 'g_'.$phpgw_info["flags"]["currentapp"];
|
||||||
@ -46,7 +68,7 @@
|
|||||||
while(list($acl,$permission) = each($acllist)) {
|
while(list($acl,$permission) = each($acllist)) {
|
||||||
$totalacl += $acl;
|
$totalacl += $acl;
|
||||||
}
|
}
|
||||||
echo "Commiting ACL record for group_id[$group_id]: ".$totalacl."<br>\n";
|
$phpgw->acl->add($phpgw_info["flags"]["currentapp"],'g_'.$group_id,$phpgw_info["user"]["account_id"],'u',$totalacl);
|
||||||
}
|
}
|
||||||
|
|
||||||
// User records
|
// User records
|
||||||
@ -57,20 +79,8 @@
|
|||||||
while(list($acl,$permission) = each($acllist)) {
|
while(list($acl,$permission) = each($acllist)) {
|
||||||
$totalacl += $acl;
|
$totalacl += $acl;
|
||||||
}
|
}
|
||||||
echo "Commiting ACL record for user_id[$user_id]: ".$totalacl."<br>\n";
|
$phpgw->acl->add($phpgw_info["flags"]["currentapp"],'u_'.$user_id,$phpgw_info["user"]["account_id"],'u',$totalacl);
|
||||||
}
|
}
|
||||||
// $phpgw->db->query("DELETE FROM phpgw_acl WHERE acl_appname='calendar' AND ");
|
|
||||||
// $phpgw->preferences->change("calendar","weekdaystarts");
|
|
||||||
// $phpgw->preferences->change("calendar","workdaystarts");
|
|
||||||
// $phpgw->preferences->change("calendar","workdayends");
|
|
||||||
// $phpgw->preferences->change("calendar","defaultcalendar");
|
|
||||||
// $phpgw->preferences->change("calendar","defaultfilter");
|
|
||||||
// if ($mainscreen_showevents) {
|
|
||||||
// $phpgw->preferences->change("calendar","mainscreen_showevents");
|
|
||||||
// } else {
|
|
||||||
// $phpgw->preferences->delete("calendar","mainscreen_showevents");
|
|
||||||
// }
|
|
||||||
// $phpgw->preferences->commit();
|
|
||||||
|
|
||||||
header("Location: ".$phpgw->link($phpgw_info["server"]["webserver_url"]."/preferences/index.php"));
|
header("Location: ".$phpgw->link($phpgw_info["server"]["webserver_url"]."/preferences/index.php"));
|
||||||
$phpgw->common->phpgw_exit();
|
$phpgw->common->phpgw_exit();
|
||||||
|
@ -44,9 +44,8 @@
|
|||||||
values('filemanager', 'create', 2, 'g', 2);
|
values('filemanager', 'create', 2, 'g', 2);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function check($location, $required, $appname = False){
|
function get_rights($location,$appname = False){
|
||||||
global $phpgw, $phpgw_info;
|
global $phpgw, $phpgw_info;
|
||||||
// $this->db = $phpgw->db;
|
|
||||||
|
|
||||||
if ($appname == False){
|
if ($appname == False){
|
||||||
$appname = $phpgw_info["flags"]["currentapp"];
|
$appname = $phpgw_info["flags"]["currentapp"];
|
||||||
@ -72,6 +71,12 @@
|
|||||||
if ($this->db->f("acl_rights") == 0){ return False; }
|
if ($this->db->f("acl_rights") == 0){ return False; }
|
||||||
$rights |= $this->db->f("acl_rights");
|
$rights |= $this->db->f("acl_rights");
|
||||||
}
|
}
|
||||||
|
return $rights;
|
||||||
|
}
|
||||||
|
|
||||||
|
function check($location, $required, $appname = False){
|
||||||
|
$rights = $this->get_rights($location,$appname);
|
||||||
|
|
||||||
return !!($rights & $required);
|
return !!($rights & $required);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,5 +193,12 @@
|
|||||||
$sql = "DELETE FROM phpgw_acl WHERE acl_location='".$location."' AND acl_account_type='".$id_type."' AND acl_account='".$id."'";
|
$sql = "DELETE FROM phpgw_acl WHERE acl_location='".$location."' AND acl_account_type='".$id_type."' AND acl_account='".$id."'";
|
||||||
$this->db->query($sql ,__LINE__,__FILE__);
|
$this->db->query($sql ,__LINE__,__FILE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function remove_granted_rights($app, $id_type = "u", $id="") {
|
||||||
|
global $phpgw, $phpgw_info;
|
||||||
|
if ($id == ""){$id = $phpgw_info["user"]["account_id"];}
|
||||||
|
$sql = "DELETE FROM phpgw_acl WHERE acl_appname='".$app."' AND acl_account_type = 'u' AND acl_location like '".$id_type."_%' AND acl_account='".$id."'";
|
||||||
|
$this->db->query($sql ,__LINE__,__FILE__);
|
||||||
|
}
|
||||||
} //end of acl class
|
} //end of acl class
|
||||||
?>
|
?>
|
||||||
|
Loading…
Reference in New Issue
Block a user