diff --git a/gosa-plugins/goto/admin/applications/class_applicationGeneric.inc b/gosa-plugins/goto/admin/applications/class_applicationGeneric.inc
index dffce7a49d032a267829e90e6b1caede90a98206..820c9cea070004e6ba4dd85cae8e39ce7e1a2e0e 100644 (file)
var $last_sorting= "invalid";
var $applications= array();
+ var $orig_base = "";
+ var $orig_cn = "";
+ var $orig_dn = "";
+
/* attribute list for save action */
var $attributes= array("cn", "description", "gosaApplicationExecute", "gosaApplicationName","gosaApplicationIcon",
"gosaApplicationFlags","gotoLogonScript");
- var $objectclasses= array("top", "gosaApplication");
- var $isReleaseApplikation = false;
+ var $objectclasses= array("top", "gosaApplication");
function application (&$config, $dn= NULL, $parent= NULL)
{
plugin::plugin ($config, $dn, $parent);
- $appfilter = session::get('appfilter') ;
-
- $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
- if(!empty($tmp)) {
- if(!preg_match("/^".get_ou('applicationou')."/",$appfilter['release'])){
- $this->isReleaseApplikation = true;
- }
- }
-
/* Load icon */
$ldap= $config->get_ldap_link();
+ $this->orig_dn = $dn;
if ($dn != 'new'){
$this->iconData= $ldap->get_attribute($dn, "gosaApplicationIcon");
$this->saved_attributes['gosaApplicationIcon'] = $this->iconData;
$this->base= dn2base($ui->dn);
}
} else {
-
- if($this->isReleaseApplikation){
- $this->base = preg_replace("/^.*,".get_ou('applicationou')."/","",$this->dn);
- }else{
- $this->base= preg_replace ("/^[^,]+,[^,]+,/", "", $this->dn);
- }
+ $this->base= preg_replace ("/^[^,]+,".get_ou('applicationou')."/", "", $this->dn);
}
+
+ $this->orig_cn = $this->cn;
+ $this->orig_base = $this->base;
}
/* Do we represent a valid group? */
if (!$this->is_account && $this->parent === NULL){
- $display= "<img alt=\"\" src=\"images/stop.png\" align=\"middle\"> <b>".
+ $display= "<img alt=\"\" src=\"images/small-error.png\" align=\"middle\"> <b>".
msgPool::noValidExtension(_("application"))."</b>";
return ($display);
}
/* Fill templating stuff */
$smarty->assign("cn", $this->cn);
- $smarty->assign("bases", $this->get_allowed_bases());
+ if(!$this->is_release()){
+ $smarty->assign("bases", $this->get_allowed_bases());
+ }else{
+ $smarty->assign("bases", array());
+ }
if ($this->dn == "new"){
$smarty->assign("selectmode", "");
$smarty->assign("namemode", "");
}
}
- $smarty->assign("isReleaseApplikation" , $this->isReleaseApplikation);
+ $smarty->assign("isReleaseApplikation" ,$this->is_release());
$smarty->assign("gotoLogonScript",htmlentities($this->gotoLogonScript, ENT_COMPAT, 'UTF-8'));
$smarty->assign("base_select", $this->base);
/* Show main page */
if (!function_exists("imagick_blob2image")){
/* Get temporary file name for conversation */
- $fname = tempnam ("/tmp", "GOsa");
+ $fname = tempnam (TEMP_DIR, "GOsa");
/* Open file and write out photoData */
$fp = fopen ($fname, "w");
$this->set_picture($_FILES['picture_file']['tmp_name']);
}
- if(!$this->isReleaseApplikation){
+ if(!$this->is_release()){
$tmp = $this->get_allowed_bases();
if(isset($_POST['base'])){
if(isset($tmp[$_POST['base']])){
$ldap->cd($this->config->current["BASE"]);
$tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
- $appfilter = session::get('appfilter');
- if((!empty($tmp)) && (isset($appfilter['release']))){
- $baseDn = str_replace($this->config->current['BASE'],$this->base,$appfilter['release']);
- $baseDn = preg_replace("/".get_ou('applicationou').".*/",get_ou('applicationou').$this->base,$appfilter['release']);
- $ldap->ls("(&(objectClass=gosaApplication)(cn=".$this->cn."))",$baseDn,array("cn"));
- if($ldap->count()){
- $attrs = $ldap->fetch();
- if($this->dn != $attrs['dn']) {
- $message[]= msgPool::duplicate("cn");
- }
- }
+
+ if($this->is_release()){
+ $base = $this->parent->parent->app_release;
}else{
- $ldap->ls("(&(objectClass=gosaApplication)(cn=".$this->cn."))",get_ou('applicationou').$this->base,array("cn"));
- if ($ldap->count()){
- $attrs = $ldap->fetch();
- if($this->dn != $attrs['dn']) {
- $message[]= msgPool::duplicate("cn");
- }
+ $base = get_ou('applicationou').$this->base;
+ }
+
+ $ldap->ls("(&(objectClass=gosaApplication)(cn=".$this->cn."))",$base,array("cn"));
+ if($ldap->count()){
+ $attrs = $ldap->fetch();
+ if($this->dn != $attrs['dn']) {
+ $message[]= msgPool::duplicated("cn");
}
}
+
+ /* Check if we are allowed to create or move this object
+ */
+ if($this->orig_dn == "new" && !$this->acl_is_createable($this->base)){
+ $message[] = msgPool::permCreate();
+ }elseif($this->orig_dn != "new" && $this->base != $this->orig_base && !$this->acl_is_moveable($this->base)){
+ $message[] = msgPool::permMove();
+ }
+
return $message;
}
}
}
+
+ function is_release()
+ {
+ if(isset($this->parent->parent)){
+ return($this->parent->parent->IsReleaseManagementActivated());
+ }else{
+ /* Check if we should enable the release selection */
+ $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
+ if(!empty($tmp)){
+ return(true);
+ }
+ }
+ return(FALSE);
+ }
+
+
function set_picture($filename)
{
if (!is_file($filename)){