summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: fad4bc6)
raw | patch | inline | side by side (parent: fad4bc6)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 24 Oct 2006 03:58:59 +0000 (03:58 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 24 Oct 2006 03:58:59 +0000 (03:58 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4918 594d385d-05f5-0310-b6e9-bd551577e9d8
index 63ffb647fa1dd7ad0cc4482e6185ef6de4787b43..1afeec431923d07042d9aac0e62728c25d08d383 100644 (file)
$acl = $this->ui->get_permissions($this->DivListFai->selectedBase,"fai/faiProfile");
if(preg_match("/c/",$acl)){
$a_setup= $this->get_type(array("objectClass"=>array("FAIprofile")));
- $this->dialog = new $a_setup[0]($this->config,$this->config->data['TABS'][$a_setup[2]],$this->dn);
+ $this->dialog = new $a_setup[0]($this->config,$this->config->data['TABS'][$a_setup[2]],$this->dn,"faiProfile");
+ $this->dialog->set_acl_base($_SESSION['CurrentMainBase']);
+
$this->is_dialog = false;
}else{
print_red(sprintf(_("You are not allowed to create a new '%s' object."),"FAIprofile"));
index 2641a0b5f3de7d250728a676c5aae691be8c6b77..a4ae413562f04e0afe9b4f7bc8378870cb8e5b3e 100644 (file)
var $FAIclass = ""; // Classnames used for this profile
var $FAIclasses = array(); // Contains classname seperated in an array
var $FAIAllclasses = array(); // Contains all possible Classnames
-
+ var $ui ;
var $FAIstate = "";
function faiProfile($config, $dn= NULL)
plugin::plugin ($config, $dn);
$ldap=$this->config->get_ldap_link();
- $this->acl = "#all#";
-
- if($this->dn != "new"){
- /* Set acls
- */
- $ui = get_userinfo();
- $acl = get_permissions ($this->dn, $ui->subtreeACL);
- $acli = get_module_permission($acl, "FAIclass", $this->dn);
- $this->acl=$acli;
- }
+ $this->ui = get_userinfo();
/* Parse ldap attribute to get all assigned classes */
$tmp = split(" ",$this->FAIclass);
return($ret);
}
+
+ function acl_base_for_current_object($dn)
+ {
+ if($dn == "new"){
+ if($this->dn == "new"){
+ $dn= $_SESSION['CurrentMainBase'];
+ }else{
+ $dn = $this->dn;
+ }
+ }
+ return($dn);
+ }
+
+
/* returns position in array */
function getpos($atr,$attrs)
{
/* Remove class name From list */
$sort_once = false;
foreach($_POST as $name => $post){
- if(preg_match("/DEL_/i",$name)){
+ if(preg_match("/DEL_/i",$name) && $this->acl_is_writeable("FAIclass")){
$s_action = "delete";
$s_entry = preg_replace("/DEL_/","",$name);
$s_entry = base64_decode(preg_replace("/_.*$/","",$s_entry));
- }elseif(preg_match("/Add_class/i",$name)){
+ }elseif(preg_match("/Add_class/i",$name)&& $this->acl_is_writeable("FAIclass")){
$s_action = "add";
- }elseif(preg_match("/DelClass/i",$name)){
+ }elseif(preg_match("/DelClass/i",$name) && $this->acl_is_writeable("FAIclass")){
$s_action = "delete";
$s_entry = $_POST['FAIclass'];
- }elseif(preg_match("/AddClass/i",$name)){
+ }elseif(preg_match("/AddClass/i",$name) && $this->acl_is_writeable("FAIclass")){
$s_action = "add";
}
/* Check if a list element should be pushed one position up */
- if((preg_match("/sortup_/",$name))&&(!$sort_once)){
+ if((preg_match("/sortup_/",$name))&&(!$sort_once) && $this->acl_is_writeable("FAIclass")){
$sort_once = true;
$val = preg_replace("/sortup_/","",$name);
$val = preg_replace("/_.*$/","",$val);
}
/* Check if a list element should be pushed one position down */
- if((preg_match("/sortdown_/",$name))&&(!$sort_once)){
+ if((preg_match("/sortdown_/",$name))&&(!$sort_once) && $this->acl_is_writeable("FAIclass")){
$sort_once = true;
$val = preg_replace("/sortdown_/","",$name);
$val = preg_replace("/_.*$/","",$val);
}
- if($s_action == "delete"){
+ if($s_action == "delete" && $this->acl_is_writeable("FAIclass")){
unset($this->FAIclasses[$s_entry]);
}
- if($s_action == "add"){
+ if($s_action == "add" && $this->acl_is_writeable("FAIclass")){
$this->dialog = new faiProfileEntry($this->config,$this->dn,$this->FAIclasses);
$this->is_dialog =true;
}
$linkupdown.= "<input type='image' name='sortdown_%s' alt='down' title='"._("Down")."' src='images/sort_down.png' >";
/* Append fai classes to divlist */
- foreach($this->FAIclasses as $usedClass){
- $str = " ";
+ if($this->acl_is_readable("FAIclass")){
+ foreach($this->FAIclasses as $usedClass){
+ $str = " ";
+ $act = "";
+
+ if(isset($this->FAIAllclasses[$usedClass])){
+ foreach($this->FAIAllclasses[$usedClass] as $class => $obj){
+ $str.= $objTypes[$class];
+ }
+ }
- if(isset($this->FAIAllclasses[$usedClass])){
- foreach($this->FAIAllclasses[$usedClass] as $class => $obj){
- $str.= $objTypes[$class];
+ $field1 = array("string"=> $usedClass,"attach"=>"");
+ $field2 = array("string"=> $str,"attach"=>"");
+ if(($this->FAIstate != "freeze") && $this->acl_is_writeable("FAIclass")){
+ $field3 = array("string"=> preg_replace("/%KEY%/",base64_encode($usedClass),$actions).
+ preg_replace("/%s/",base64_encode($usedClass),$linkupdown),
+ "attach"=>"style='border-right:none;'");
+ }else{
+ $field3 = array("string"=>" ", "attach"=>"style='border-right:none;'");
}
+ $divlist->AddEntry(array($field1,$field2,$field3));
}
-
- $field1 = array("string"=> $usedClass,"attach"=>"");
- $field2 = array("string"=> $str,"attach"=>"");
- if($this->FAIstate != "freeze"){
- $field3 = array("string"=> preg_replace("/%KEY%/",base64_encode($usedClass),$actions).
- preg_replace("/%s/",base64_encode($usedClass),$linkupdown),
- "attach"=>"style='border-right:none;'");
- }else{
- $field3 = array("string"=>" ", "attach"=>"style='border-right:none;'");
- }
- $divlist->AddEntry(array($field1,$field2,$field3));
}
$smarty->assign("FAIclasses" ,$this->FAIclasses);
}
}
- foreach($this->attributes as $attr){
- if(($this->FAIstate == "freeze") || (chkacl($this->acl,$attr)!= "")){
- $smarty->assign($attr."ACL"," disabled ");
- }else{
- $smarty->assign($attr."ACL"," ");
- }
+
+ $dn = $this->acl_base_for_current_object($this->dn);
+ $smarty->assign("sub_object_is_addable",
+ preg_match("/c/",$this->ui->get_permissions($dn,"fai/faiScriptEntry")) &&
+ !preg_match("/freeze/",$this->FAIstate));
+
+ $tmp = $this->plInfo();
+ foreach($tmp['plProvidedAcls'] as $name => $translated){
+ $smarty->assign($name."ACL",$this->getacl($name));
}
$display.= $smarty->fetch(get_template_path('faiProfile.tpl', TRUE));
function save_object()
{
plugin::save_object();
- foreach($this->attributes as $attrs){
- if(isset($_POST[$attrs])){
- $this->$attrs = $_POST[$attrs];
- }
- }
}
diff --git a/plugins/admin/fai/class_faiProfileEntry.inc b/plugins/admin/fai/class_faiProfileEntry.inc
index 3729141b80d197f34de51cbec317eb935df0a277..3f968dc9f11498a60a683f8918cd8f5570c7658f 100644 (file)
/* Array with available class names */
var $FAIAllclasses = array();
+ var $ui;
function faiProfileEntry ($config, $dn= NULL,$used=array(),$objects=false)
{
/* Search only in fai tree */
$base = "ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase'];
+ $this->ui = get_userinfo();
+
/* Create array with categories to be able to sort different types of objects */
- $categories = array("FAIscript","FAItemplate","FAIhook","FAIvariable","FAIpartitionTable","FAIpackageList");
+ $categories = array("FAIscript" => "faiScript",
+ "FAItemplate" => "faiTemplate",
+ "FAIhook" => "faiHook",
+ "FAIvariable" => "faiVariable",
+ "FAIpartitionTable" => "faiPartitionTable",
+ "FAIpackageList" => "faiPackageList");
/* Read out all objects from fai tree */
$ldap= $this->config->get_ldap_link();
/* Only use objects which have cn set */
if((isset($attrs['cn'][0]))&&(!in_array($attrs['cn'][0],$used))){
- foreach($categories as $cat){
+ foreach($categories as $cat => $acl){
if(in_array($cat,$attrs['objectClass'])){
+ $acl = $this->ui->get_permissions($attrs['dn'],"fai/".$acl);
+
/* Append different types of objects */
$this->FAIAllclasses[$attrs['cn'][0]]['objects'][$cat]=$cat;
+
+ if(!isset($this->FAIAllclasses[$attrs['cn'][0]]['acl'])){
+ $this->FAIAllclasses[$attrs['cn'][0]]['acl']="";
+ }
+ $this->FAIAllclasses[$attrs['cn'][0]]['acl'].=$acl;
/* Set selected status to false */
$this->FAIAllclasses[$attrs['cn'][0]]['status']=false;
}
}
}
+
+
$tmp = array();
ksort($sort);
foreach($sort as $name){
$this->FAIAllclasses = array();
$this->FAIAllclasses = $tmp;
-
/* If no search filter is set, create one */
if (!is_global("SUBfaifilter")){
$SUBfaifilter= array("base" => "ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase'], "Sregex" => "*");
/* Check every single class name to match the current search filter */
foreach($this->FAIAllclasses as $usedClass => $classes){
+ /* Skip those entries that we are not allowed to read. */
+ if(!preg_match("/r/",$classes['acl'])){
+ continue;
+ }
+
$fi = str_replace("*",".*",$SUBfaifilter['Sregex']);
$abort = true;
index 5020bc74557770a214669c7679e830ecc14fd53b..54431ff39bb2ab6f71159bb03cc5f55b3a0a7b89 100644 (file)
</LABEL>
</td>
<td>
- <input value="{$cn}" size="45" maxlength="80" id="cn" name="cn" {$cnACL}>
+{render acl=$cnACL}
+ <input value="{$cn}" size="45" maxlength="80" id="cn" name="cn">
+{/render}
</td>
</tr>
<tr>
</LABEL>
</td>
<td>
- <input value="{$description}" size="45" maxlength="80" name="description" id="description" {$descriptionACL}>
+{render acl=$descriptionACL}
+ <input value="{$description}" size="45" maxlength="80" name="description" id="description">
+{/render}
</td>
</tr>
</table>
</select>-->
{$divlist}
<br>
- <input type="submit" name="AddClass" value="{t}Add{/t}" {$cnACL}>
+{render acl=$FAIclassACL}
+ <input type="submit" name="AddClass" value="{t}Add{/t}">
+{/render}
<input type="hidden" name="edit_helper">
</td>
</tr>