summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ca02e8a)
raw | patch | inline | side by side (parent: ca02e8a)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 20 Sep 2006 05:13:02 +0000 (05:13 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 20 Sep 2006 05:13:02 +0000 (05:13 +0000) |
Added acls for repository service
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4735 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4735 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/plugins/admin/systems/class_servRepository.inc b/plugins/admin/systems/class_servRepository.inc
index b49778d17393c24028ecd8c98d45729196157267..e3dc800cdd6368d0620b0e9b59827733fa139e89 100644 (file)
<?php
-class servrepository extends plugin
+require_once("class_goService.inc");
+
+class servrepository extends goService
{
/* CLI vars */
var $cli_summary = "Manage server basic objects";
/* Repositories */
var $repositories = array();
var $FAIrepository = array();
-
-
var $conflicts = array("FAIrepositoryServer");
var $DisplayName = "";
var $StatusFlag = "";
/* Fill templating stuff */
$smarty= get_smarty();
+ $smarty->assign("is_createable",$this->acl_is_createable());
$display= "";
/* Smarty vars*/
if(isset($_POST['servRepository'])){
foreach($_POST as $name => $value){
- if(preg_match("/AddRepository/",$name)){
+ if(preg_match("/AddRepository/",$name) && $this->acl_is_createable()){
$once = true;
$this->dialog = new servRepositorySetup($this->config,$this->dn);
- $this->dialog->acl = $this->acl;
+ $this->dialog->parent = $this;
}
- if((preg_match("/^delete_/",$name))&&(!$once)){
+ if((preg_match("/^delete_/",$name)) && (!$once) && $this->acl_is_removeable()){
$once = true;
$value = preg_replace("/delete_/","",$name);
$value = base64_decode(preg_replace("/_.*$/","",$value));
/* to be able to detect if this was renamed */
$obj['initialy_was'] = $obj['Release'];
$this->dialog = new servRepositorySetup($this->config,$this->dn,$obj);
- $this->dialog->acl = $this->acl;
+ $this->dialog->parent = $this;
}
}
}
$obj = $this->repositories[base64_decode($_GET['id'])];
$obj['initialy_was'] = $obj['Release'];
$this->dialog = new servRepositorySetup($this->config,$this->dn,$obj);
- $this->dialog->acl = $this->acl;
+ $this->dialog->parent = $this;
}
- /*
- if(isset($_POST['AddRepository'])){
- $this->dialog = new servRepositorySetup($this->config,$this->dn);
- $this->dialog->acl = $this->acl;
- }
- */
-
if(isset($_POST['repository_setup_save'])){
$this->dialog->save_object();
if(($this->dialog->is_new_name())&&(isset($this->repositories[$this->dialog->GetName()]))){
$link = "<a href='?plug=".$_GET['plug']."&act=open&id=%s'>%s</a>";
$edit = "<input type='image' value='%s' name='edit_%s' src='images/edit.png'> ";
- $delete = "<input type='image' value='%s' name='delete_%s' src='images/edittrash.png'>";
+
+ /* Hide delete icon, if delete is not allowed */
+ if($this->acl_is_removeable()){
+ $delete = "<input type='image' value='%s' name='delete_%s' src='images/edittrash.png'>";
+ }else{
+ $delete = "<img src='images/empty.png' alt=' '>";
+ }
foreach($this->repositories as $name => $reps){
$str = " ";
-
if(preg_match("/".str_replace("*",".*",$this->regex)."/",$reps['Release'])){
-
-
foreach($reps['Sections'] as $sec){
$str.=$sec." ";
}
-
$divlist->AddEntry(array(
- array("string"=>sprintf($link,base64_encode($name),$name),"attach"=>"style='width:80px;'"),
- array("string"=>sprintf($link,base64_encode($name),_("Sections")." :".$str)),
- array("string"=>preg_replace("/%s/",base64_encode($name),$edit.$delete),"attach"=>"style='border-right:0px;width:55px;text-align:right;'")
+ array("string"=>sprintf($link,base64_encode($name),$name),"attach"=>"style='width:80px;'"),
+ array("string"=>sprintf($link,base64_encode($name),_("Sections")." :".$str)),
+ array("string"=>preg_replace("/%s/",base64_encode($name),$edit.$delete),"attach"=>"style='border-right:0px;width:55px;text-align:right;'")
));
}
}
return($display);
}
- function remove_from_parent()
- {
- plugin::remove_from_parent();
-
- /* Remove status flag, it is not a memeber of
- this->attributes, so ensure that it is deleted too */
- if(!empty($this->StatusFlag)){
- $this->attrs[$this->StatusFlag] = array();
- }
-
- $ldap= $this->config->get_ldap_link();
- $ldap->cd ($this->config->current['BASE']);
-
- $ldap->cat($this->dn, array('dn'));
-
- if($ldap->count()){
- $ldap->cd($this->dn);
- $this->cleanup();
- $ldap->modify ($this->attrs);
-
- $this->handle_post_events("modify");
- }
- }
-
/* Save data to object */
function save_object()
{
/* Call common method to give check the hook */
$message= plugin::check();
-
return ($message);
}
}
}
- /* Get updates for status flag */
- function updateStatusState()
- {
- if(empty($this->StatusFlag)) return;
-
- $attrs = array();
- $flag = $this->StatusFlag;
- $ldap = $this->config->get_ldap_link();
- $ldap->cd($this->cn);
- $ldap->cat($this->dn,array($flag));
- if($ldap->count()){
- $attrs = $ldap->fetch();
- }
- if(isset($attrs[$flag][0])){
- $this->$flag = $attrs[$flag][0];
- }
- }
-
function getListEntry()
{
- $this->updateStatusState();
- $flag = $this->StatusFlag;
- if(empty($flag)){
- $fields['Status'] = "";
- }else{
- $fields['Status'] = $this->$flag;
- }
+ $fields = goService::getListEntry();
$fields['Message'] = _("Repository service");
- $fields['AllowStart'] = true;
- $fields['AllowStop'] = true;
- $fields['AllowRestart'] = true;
- $fields['AllowRemove']= true;
$fields['AllowEdit'] = true;
return($fields);
}
-
- /* Directly save new status flag */
- function setStatus($value)
- {
- if($value == "none") return;
- if(!$this->initially_was_account) return;
- if(empty($this->StatusFlag)) return;
- $ldap = $this->config->get_ldap_link();
- $ldap->cd($this->dn);
- $ldap->cat($this->dn,array("objectClass"));
- if($ldap->count()){
-
- $tmp = $ldap->fetch();
- for($i = 0; $i < $tmp['objectClass']['count']; $i ++){
- $attrs['objectClass'][] = $tmp['objectClass'][$i];
- }
- $flag = $this->StatusFlag;
- $attrs[$flag] = $value;
- $this->$flag = $value;
- $ldap->modify($attrs);
- show_ldap_error($ldap->get_error(), sprintf(_("Set status flag for server services/repository with dn '%s' failed."),$this->dn));
- $this->action_hook();
- }
- }
-
-
/* Return plugin informations for acl handling */
function plInfo()
{
"plProvidedAcls"=> array(
"cn" => _("Name"),
"Release" => _("Releases"),
+ "Section" => _("Sections"),
"ParentServer" => _("Parent server"),
"Url" => _("Url"))
));
diff --git a/plugins/admin/systems/class_servRepositorySetup.inc b/plugins/admin/systems/class_servRepositorySetup.inc
index a1c62e7baad9a62b52d3681d66f81a5dc41eb0ad..3ed15dfab94241b51f7085c9bad3784380a61024 100644 (file)
var $ParentServers = "";
var $initialy_was = false;
var $cn = "";
+ var $parent = "";
function servRepositorySetup ($config, $dn= NULL,$data = false)
{
$smarty->assign("Sections",$divlist->DrawList());
+ /* Get && assign acls */
+ $tmp = $this->parent->plInfo();
+ foreach($tmp['plProvidedAcls'] as $name => $translated){
+ $smarty->assign($name."ACL",$this->parent->getacl($name));
+ }
+
+ /* Assign values */
foreach($this->attributes as $attr){
$smarty->assign($attr ,$this->$attr);
- $smarty->assign($attr."ACL" ,chkacl($this->acl,$attr));
}
$tmp = $this->getParentServers();
/* Save data to object */
function save_object()
- {
+ {
plugin::save_object();
}
diff --git a/plugins/admin/systems/class_serverService.inc b/plugins/admin/systems/class_serverService.inc
index 514563c8a9a356d96616688cc3ce3cfc442884ca..62a31f1e107bcb2a19a9e0cc28e9a548c5ad8831 100644 (file)
$this->divList = new divListSystemService($config,$this);
}
+ function set_acl_base($base)
+ {
+ plugin::set_acl_base($base);
+ foreach($this->plugins as $name => $obj){
+ $this->plugins[$name]->set_acl_base($base);
+ }
+ }
+
+ function set_acl_category($category)
+ {
+ plugin::set_acl_category($category);
+ foreach($this->plugins as $name => $obj){
+ $this->plugins[$name]->set_acl_category($category);
+ }
+ }
function execute()
{
/* Create resetted obj */
$new_obj = new $s_entry($this->config,$this->dn);
+ $new_obj -> set_acl_base($this->acl_base);
+ $new_obj -> set_acl_category(preg_replace("/\/$/","",$this->acl_category));
$tmp = $new_obj->getListEntry();
if($tmp['AllowRemove']){
- $this->plugins[$s_entry] = new $s_entry($this->config,$this->dn);
+ $this->plugins[$s_entry] = $new_obj;
$this->plugins[$s_entry]->is_account = false;
}
}
if(isset($_POST['CancelService'])){
if($this->backup == NULL){
$this->plugins[$this->current] = new $this->current($this->config,$this->dn);
+ $this->plugins[$this->current]-> set_acl_base($this->acl_base);
+ $this->plugins[$this->current]-> set_acl_category(preg_replace("/\/$/","",$this->acl_category));
+
}else{
foreach($this->backup as $name => $value){
$this->plugins[$this->current]->$name = $value;
index 84a4bcdb97e5bacfde0e2483843eb2e17e6f85bd..7feaf1d3c2b2838edfbac12439507428d062cfb9 100644 (file)
</div>
<div class="contentboxb">
<div style='background:#F0F0F9;padding:5px;'>
-<input type="image" src="images/fai_new_packages.png" title="{t}Add repository{/t}" name="AddRepository">
+{if $is_createable}
+ <input type="image" src="images/fai_new_packages.png" title="{t}Add repository{/t}" name="AddRepository">
+{/if}
</div>
</div>
<div style='height:4px;'></div>
diff --git a/plugins/admin/systems/servRepositorySetup.tpl b/plugins/admin/systems/servRepositorySetup.tpl
index a87c7b151f335ecb113c2b9ad1452bafc96ebe9b..210d853c1e14e5fdaacb166c02e2fd8e997f3174 100644 (file)
<td>{t}Parent server{/t}
</td>
<td>
- <select name="ParentServer" {$ParentServerACL}>
+{render acl=$ParentServerACL}
+ <select name="ParentServer">
{html_options options=$ParentServers values=$ParentServerKeys selected=$ParentServer}
</select>
+{/render}
</td>
</tr>
<tr>
<td>{t}Release{/t}
</td>
<td>
- <input type="text" value="{$Release}" name="Release" {$ReleaseACL}>
+{render acl=$ReleaseACL}
+ <input type="text" value="{$Release}" name="Release">
+{/render}
</td>
</tr>
<tr>
<td>{t}URL{/t}
</td>
<td>
- <input type="text" size="40" value="{$Url}" name="Url" {$UrlACL}>
+{render acl=$UrlACL}
+ <input type="text" size="40" value="{$Url}" name="Url">
+{/render}
</td>
</tr>
</table>
</td>
<td>
{t}Sections{/t}<br>
+{render acl=$SectionACL}
{$Sections}
+{/render}
+{render acl=$SectionACL}
<input type="text" name="SectionName" value="" style='width:100%;'>
+{/render}
+{render acl=$SectionACL}
<input type="submit" name="AddSection" value="{t}Add{/t}">
+{/render}
</td>
</tr>
</table>