allows setting app for anonymous access

This commit is contained in:
skeeter 2001-01-21 23:18:05 +00:00
parent df86340292
commit 877985274a
3 changed files with 27 additions and 6 deletions

View File

@ -62,6 +62,12 @@
. "app_title='" . addslashes($n_app_title) . "', app_enabled='"
. "$n_app_status',app_order='$app_order' where app_name='$old_app_name'",__LINE__,__FILE__);
if($n_app_anonymous) {
$phpgw->acl->add($n_app_name,'everywhere',0,'g',PHPGW_ACL_READ);
} else {
$phpgw->acl->delete($n_app_name,'everywhere',0,'g');
}
Header("Location: " . $phpgw->link("applications.php"));
$phpgw->common->phpgw_exit();
}
@ -82,6 +88,7 @@
$n_app_status = $phpgw->db->f("app_enabled");
$old_app_name = $phpgw->db->f("app_name");
$app_order = $phpgw->db->f("app_order");
$n_app_anonymous = $phpgw->acl->check('', PHPGW_ACL_READ, $n_app_name);
}
$phpgw->template->set_var("lang_header",lang("Edit application"));
@ -103,6 +110,14 @@
display_row(lang("Status"),'<select name="n_app_status">' . $status_html . '</select>');
display_row(lang("Select which location this app should appear on the navbar, lowest (left) to highest (right)"),'<input name="app_order" value="' . $app_order . '">');
$str = '<input type="checkbox" name="n_app_anonymous" value="True"';
if ($n_app_anonymous) {
$str .= " checked";
}
$str .= ">";
display_row(lang("Allow Anonymous access to this app"),$str);
$phpgw->template->set_var("select_status",$status_html);
$phpgw->template->pparse("out","form");

View File

@ -60,6 +60,10 @@
. addslashes($n_app_name) . "','" . addslashes($n_app_title) . "','"
. "$n_app_status','$app_order')",__LINE__,__FILE__);
if($n_app_anonymous) {
$phpgw->acl->add($n_app_name,'everywhere',0,'g',1);
}
Header("Location: " . $phpgw->link("applications.php"));
$phpgw->common->phpgw_exit();
} else {
@ -95,6 +99,8 @@
display_row(lang("Select which location this app should appear on the navbar, lowest (left) to highest (right)"),'<input name="app_order" value="' . $app_order . '">');
display_row(lang("Allow Anonymous access to this app"),'<input type="checkbox" name="n_app_anonymous" value="True">');
$phpgw->template->set_var("lang_submit_button",lang("add"));
$phpgw->template->pparse("out","form");

View File

@ -139,7 +139,7 @@
return False;
}
$db2->query("SELECT * FROM phpgw_acl WHERE acl_location='run' AND acl_account_type='u' AND acl_account=".$account_id,__LINE__,__FILE__);
$db2->query("SELECT * FROM phpgw_acl WHERE (acl_location='run' AND acl_account_type='u' AND acl_account=".$account_id.") OR (acl_location='everywhere')",__LINE__,__FILE__);
if($db2->num_rows()) {
while($db2->next_record()) {
$apps[] = $db2->f("acl_appname");
@ -200,7 +200,7 @@
$db2 = $phpgw->db;
$db2->query("SELECT * FROM phpgw_acl WHERE acl_location='run' AND acl_account_type='g' AND acl_account=".$group_id,__LINE__,__FILE__);
$db2->query("SELECT * FROM phpgw_acl WHERE (acl_location='run' AND acl_account_type='g' AND acl_account=".$group_id.") OR (acl_location='everywhere')",__LINE__,__FILE__);
if($db2->num_rows()) {
while($db2->next_record()) {
$apps[] = $db2->f("acl_appname");
@ -332,8 +332,8 @@
$db2->query("UPDATE groups SET group_apps='".$this->group_app_string($group_id)."' WHERE group_id=".$group_id,__LINE__,__FILE__);
$db2->query("DELETE FROM phpgw_acl WHERE acl_location='run' AND acl_account_type='g' AND acl_account=".$group_id,__LINE__,__FILE__);
reset($this->group_apps[$group_id]);
while($group = each($this->group_apps[$group_id])) {
$phpgw->acl->add($group[1],'run',$group_id,'g',1);
while($app = each($this->group_apps[$group_id])) {
$phpgw->acl->add($app[1],'run',$group_id,'g',1);
}
}
}
@ -347,8 +347,8 @@
$db2->query("UPDATE account SET account_permissions = '".$this->user_app_string()."' WHERE account_id=".$this->account_id,__LINE__,__FILE__);
$db2->query("DELETE FROM phpgw_acl WHERE acl_location='run' AND acl_account_type='u' AND acl_account=".$this->account_id,__LINE__,__FILE__);
reset($this->user_apps);
while($user = each($this->user_apps)) {
$phpgw->acl->add($user[1],'run',$this->account_id,'u',1);
while($app = each($this->user_apps)) {
$phpgw->acl->add($app[1],'run',$this->account_id,'u',1);
}
}
}