summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0526416)
raw | patch | inline | side by side (parent: 0526416)
author | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 7 Nov 2006 07:25:20 +0000 (07:25 +0000) | ||
committer | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 7 Nov 2006 07:25:20 +0000 (07:25 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5026 594d385d-05f5-0310-b6e9-bd551577e9d8
plugins/admin/groups/class_groupApplication.inc | patch | blob | history |
diff --git a/plugins/admin/groups/class_groupApplication.inc b/plugins/admin/groups/class_groupApplication.inc
index 8166af28ccfba2cefc2b37966d609bde1f31baa3..9ba71a762c7e95e782eea9f70a9588259fb0fcec 100644 (file)
var $CopyPasteVars = array("Categories");
var $gosaApplicationParameter ;
-
+ var $ui = NULL;
+ var $no_release_acls = false;
function appgroup ($config, $dn= NULL, $parent= NULL)
{
$tmp = search_config($config->data,"faiManagement","CLASS");
if(!empty($tmp)){
$this->enableReleaseManagement = true;
- $this->objectclasses [] = "FAIreleaseTag";
- $this->attributes[] = "FAIrelease";
+ $this->objectclasses [] = "FAIreleaseTag";
+ $this->attributes [] = "FAIrelease";
}
plugin::plugin ($config, $dn, $parent);
+ $this->ui = get_userinfo();
/* In some case of old applikations with old release tag saving, we
must reassign is_account state.
/* Get required release informations */
if($this->enableReleaseManagement){
- $this->InitialFAIrelease = $this->FAIrelease;
- $this->Releases = $this->getReleases();
+ $this->InitialFAIrelease = $this->FAIrelease;
+ $this->Releases = $this->getReleases();
}
+
}
}
}
+
+ /* check application acls */
+ function check_acls()
+ {
+ return(count($this->ui->get_module_departments("application")));
+ }
+
+
function execute()
{
/* Call parent execute */
plugin::execute();
-
+
+
if((isset($_GET['act']))&&($_GET['act']=="depopen")){
$dep = base64_decode($_GET['depid']);
$this->curbase =$dep;
}
}
+ /* If releasemanagement is activated you will "need" al least read
+ access to application releases to configure application settings */
+ if(!$this->check_acls()){
+ $display = "<img src='images/button_cancel.png' alt='"._("ACL")."' class='center'>
+ <b>"._("Insufficient permissions")."</b>
+ <p>".
+ _("You do not have permission to query application entries. All your changes will not be saved.").
+ "</p>";
+ $this->no_release_acls = true;
+ }
+
/* Add Categorie */
if((isset($_POST['AddCat']))&&(isset($_POST['CatName']))&&(!empty($_POST['CatName']))){
/* Only allow adding a category, if it is allowed */
- if($this->acl_is_writeable("gosaMemberApplication")){
+ if($this->acl_is_writeable("gosaMemberApplication",$this->no_release_acls)){
if(preg_match("/[\\\\\/]/i",$_POST['CatName'])){
print_red(_("Invalid character in category name."));
$only_once = false;
/* Check POST variables for commands to add/remove some applications */
- if($this->acl_is_writeable("gosaMemberApplication")){
+ if($this->acl_is_writeable("gosaMemberApplication",$this->no_release_acls)){
foreach($_POST as $name => $value){
if((preg_match("/AddSep_/",$name))&&(!$only_once)){
}
}
}
-
- $this->reload();
/* Add group with post */
if((isset($_GET['act']))&&($_GET['act']=="add")){
/* get departments */
$ui = get_userinfo();
$departments = array();
- $res = get_list("(objectClass=gosaDepartment)", "department", $this->curbase,array("description","cn","ou"),GL_SIZELIMIT);
+ $res = get_list("(objectClass=gosaDepartment)", "application", $this->curbase,array("description","cn","ou"),GL_SIZELIMIT);
foreach($res as $value){
$fdn= @LDAP::fix(str_replace($this->curbase,"",$value['dn']));
if($value["description"][0]!=".."){
}
}
- if($this->acl_is_writeable("gosaMemberApplication")){
+ if($this->acl_is_writeable("gosaMemberApplication",$this->no_release_acls)){
$linkadd = "<a href='?plug=".$_GET['plug']."&act=add&id=%s'>%s</a>";
}else{
$linkadd = "%s";
$div2 = new DivSelectBox("appgroup");
$div2->SetHeight(300);
- if(!$this->acl_is_writeable("gosaMemberApplication")){
+ if(!$this->acl_is_writeable("gosaMemberApplication",$this->no_release_acls)){
$linkopen = "<img class='center' src='images/folder.png' alt=\"\"> <a href='?plug=".$_GET['plug']."&act=open&id=%s'>%s</a>";
$catremove = " <img src='images/empty.png' alt=' '>";
$catupdown = "";
$separator ="<hr size=1>";
- if($this->acl_is_writeable("gosaMemberApplication")){
+ if($this->acl_is_writeable("gosaMemberApplication",$this->no_release_acls)){
$sep = "<input type='image' src='images/back.png' title='"._("Insert seperator")."' value='%s' name='AddSep_%s'>";
$upudown = "<a href='?plug=".$_GET['plug']."&act=one_up&id=%s'>".
" <img alt='{t}sort{/t}' align='top' src='images/sort_up.png' title='"._("Move up")."' border=0>".
$upudown = "";
}
- if($this->acl_is_writeable("gosaApplicationParameter")){
+ if($this->acl_is_writeable("gosaApplicationParameter",$this->no_release_acls)){
$edit= " <input type='image' src='images/edit.png' title='"._("Edit entry")."' name='EdiApp_%s' value='%s' alt='{t}edit{/t}' >";
}else{
$edit= "";
$smarty->assign("apps", $apps);
$smarty->assign("enableReleaseManagement",$this->enableReleaseManagement);
+
+ $smarty->assign("ReleaseSelectAble", false);
+ $smarty->assign("Release", $this->FAIrelease);
if($this->enableReleaseManagement){
$smarty->assign("FAIrelease", $this->FAIrelease);
$smarty->assign("Releases", $this->Releases);
- if(count($this->used_apps)){
- $smarty->assign("ReleaseSelectAble", false);
- }else{
+ if(!$this->no_release_acls && count($this->Releases)){
$smarty->assign("ReleaseSelectAble", true);
}
}
- $smarty->assign("ReleaseSelectAble", true);
-
+
/* Set acls to template */
$tmp = $this->plInfo();
foreach($tmp['plProvidedAcls'] as $acl => $translation){
- $smarty->assign($acl."ACL",$this->getacl($acl));
+ $smarty->assign($acl."ACL",$this->getacl($acl,$this->no_release_acls));
}
/* Show main page */
function getReleases()
{
+ /* Only display those releases that we are able to read */
$dn = $this->config->current['BASE'];
$filter = "(&(objectClass=organizationalUnit)(objectClass=FAIbranch))";
- $res = get_list($filter,"groups", $dn, array("ou"), GL_SUBSEARCH);
+ $res = get_list($filter,"application", $dn, array("ou"), GL_SUBSEARCH);
$ret =array();
foreach($res as $attrs){
if(preg_match("/ou=apps,/",$attrs['dn'])){
- $bb = preg_replace("/ou=apps,.*/","",$attrs['dn']);
- $parts = array_reverse(split("ou=",$bb));
+ $bb = preg_replace("/ou=apps,.*/","",$attrs['dn']);
+ $parts = array_reverse(split("ou=",$bb));
$str ="";
foreach($parts as $part){
/* Save to LDAP */
function save()
{
+ /* Skip saving application settings, if we do not have release acls */
+ if($this->no_release_acls){
+ gosa_log("Skip saving group application extension. Caused by insufficient acls");
+ return;
+ }
+
plugin::save();
+
+
/* Copy members */
$this->Categories[""]="";
$this->attrs["gosaMemberApplication"]= array();
}else{
$old_r = $this->FAIrelease;
$k = key($tmp);
- $r = $tmp[$k];
- $this->FAIrelease = $k;
- $base = $r;
- if(!(!$this->initially_was_account && $old_r =="/")){
- print_red(sprintf(_("Can't resolve the release name '%s', setting release name to '%s'. Possibly the objects base has changed."),$this->FAIrelease,$k));
+ if(isset($tmp[$k])){
+ $r = $tmp[$k];
+ $this->FAIrelease = $k;
+ $base = $r;
+
+ if(!(!$this->initially_was_account && $old_r =="/")){
+ print_red(sprintf(_("Can't resolve the release name '%s', setting release name to '%s'. Possibly the objects base has changed."),$old_r,$k));
+ }
+ }else{
+ print_red(_("There are no releases available. You will not be able to select another release."));
+ return;
}
}
$base = preg_replace("/ou=apps,.*$/","ou=apps,".$this->curbase,$base);
-
- $ldap = $this->config->get_ldap_link();
- $ldap->cd ($base);
- $ldap->ls ("(objectClass=gosaApplication)",$base);
+ $res = get_list("(objectClass=gosaApplication)","application",$base,array("*"));
}else{
- $ldap = $this->config->get_ldap_link();
- $ldap->cd ("ou=apps,".$this->curbase);
- $ldap->ls ("(objectClass=gosaApplication)","ou=apps,".$this->curbase);
+ $res = get_list("(objectClass=gosaApplication)","application","ou=apps,".$this->curbase,array("*"));
}
- while ($attrs= $ldap->fetch()){
+ foreach($res as $attrs){
if (isset($attrs["description"][0])){
$this->apps[$attrs["cn"][0]]=
$attrs["cn"][0]." (".
}
}
- $ldap->cd($this->config->current['BASE']);
- $ldap->search("objectClass=gosaApplication",array("gosaApplicationParameter","cn"));
+ $res = get_list("objectClass=gosaApplication","application",$this->config->current['BASE'],array("gosaApplicationParameter","cn"));
+
$tmp = search_config($this->config->data,"faiManagement","CLASS");
$this->AllAppsForRelease = array();
if(!empty($tmp)){
-
$tmp = array_flip($this->Releases);
-
- while($attrs = $ldap->fetch()){
+ foreach($res as $attrs){
$testdn = preg_replace("/ou=apps,.*$/","ou=apps",$attrs['dn']);
$testdn = preg_replace("/^[^,]+/","",$testdn);
}
}
}else{
- while($attrs = $ldap->fetch()){
+ foreach($res as $attrs){
$this->AllAppsForRelease[$attrs['dn']] = $attrs['cn'][0];
}
}