index 7ca78fedd43ddf467bfce42ea802924a3a550406..6e4d85f7ea6cc4c9f863bfd78c6efa872d269169 100644 (file)
/* Create Acl attributes */
var $acl_create_dialog = FALSE;
/* Create Acl attributes */
var $acl_create_dialog = FALSE;
- var $acl_create_type = "group";
var $acl_create_selected= ""; // Currently selected element, that should receive admin rights
var $acl_create_changes = ""; // Contains ldif information about changes
var $acl_create_confirmed= FALSE;
var $acl_create_selected= ""; // Currently selected element, that should receive admin rights
var $acl_create_changes = ""; // Contains ldif information about changes
var $acl_create_confirmed= FALSE;
$this->checks['deps_visible']['ERROR_MSG'] = "";
$this->check_organizationalUnits();
$this->checks['deps_visible']['ERROR_MSG'] = "";
$this->check_organizationalUnits();
- $this->checks['users_visible']['TITLE'] = _("Checking for invisible user");
+ $this->checks['users_visible']['TITLE'] = _("Checking for invisible users");
$this->checks['users_visible']['STATUS'] = FALSE;
$this->checks['users_visible']['STATUS_MSG']= "";
$this->checks['users_visible']['ERROR_MSG'] = "";
$this->checks['users_visible']['STATUS'] = FALSE;
$this->checks['users_visible']['STATUS_MSG']= "";
$this->checks['users_visible']['ERROR_MSG'] = "";
$this->checks['acls']['ERROR_MSG'] = "";
$this->check_administrativeAccount();
$this->checks['acls']['ERROR_MSG'] = "";
$this->check_administrativeAccount();
- $this->checks['outside_users']['TITLE'] = _("Checking for users outside the people department");
+ $this->checks['outside_users']['TITLE'] = _("Checking for users outside the people tree");
$this->checks['outside_users']['STATUS'] = FALSE;
$this->checks['outside_users']['STATUS_MSG']= "";
$this->checks['outside_users']['ERROR_MSG'] = "";
$this->search_outside_users();
$this->checks['outside_users']['STATUS'] = FALSE;
$this->checks['outside_users']['STATUS_MSG']= "";
$this->checks['outside_users']['ERROR_MSG'] = "";
$this->search_outside_users();
- $this->checks['outside_groups']['TITLE'] = _("Checking for groups outside the groups department");
+ $this->checks['outside_groups']['TITLE'] = _("Checking for groups outside the groups tree");
$this->checks['outside_groups']['STATUS'] = FALSE;
$this->checks['outside_groups']['STATUS_MSG']= "";
$this->checks['outside_groups']['ERROR_MSG'] = "";
$this->search_outside_groups();
$this->checks['outside_groups']['STATUS'] = FALSE;
$this->checks['outside_groups']['STATUS_MSG']= "";
$this->checks['outside_groups']['ERROR_MSG'] = "";
$this->search_outside_groups();
- $this->checks['outside_winstations']['TITLE'] = _("Checking for windows workstations outside the winstation department");
+ $this->checks['outside_winstations']['TITLE'] = _("Checking for windows workstations outside the winstation tree");
$this->checks['outside_winstations']['STATUS'] = FALSE;
$this->checks['outside_winstations']['STATUS_MSG']= "";
$this->checks['outside_winstations']['ERROR_MSG'] = "";
$this->search_outside_winstations();
$this->checks['outside_winstations']['STATUS'] = FALSE;
$this->checks['outside_winstations']['STATUS_MSG']= "";
$this->checks['outside_winstations']['ERROR_MSG'] = "";
$this->search_outside_winstations();
- $this->checks['uidNumber_usage']['TITLE'] = _("Checking for multiple use of same uidNumber value");
+ $this->checks['uidNumber_usage']['TITLE'] = _("Checking for duplicate uid numbers");
$this->checks['uidNumber_usage']['STATUS'] = FALSE;
$this->checks['uidNumber_usage']['STATUS_MSG']= "";
$this->checks['uidNumber_usage']['ERROR_MSG'] = "";
$this->check_uidNumber();
$this->checks['uidNumber_usage']['STATUS'] = FALSE;
$this->checks['uidNumber_usage']['STATUS_MSG']= "";
$this->checks['uidNumber_usage']['ERROR_MSG'] = "";
$this->check_uidNumber();
- $this->checks['gidNumber_usage']['TITLE'] = _("Checking for multiple use of same gidNumber value");
+ $this->checks['gidNumber_usage']['TITLE'] = _("Checking for duplicate gid numbers");
$this->checks['gidNumber_usage']['STATUS'] = FALSE;
$this->checks['gidNumber_usage']['STATUS_MSG']= "";
$this->checks['gidNumber_usage']['ERROR_MSG'] = "";
$this->checks['gidNumber_usage']['STATUS'] = FALSE;
$this->checks['gidNumber_usage']['STATUS_MSG']= "";
$this->checks['gidNumber_usage']['ERROR_MSG'] = "";
if($this->check_uidNumbers){
$this->checks['uidNumber_usage']['STATUS'] = FALSE;
if($this->check_uidNumbers){
$this->checks['uidNumber_usage']['STATUS'] = FALSE;
- $this->checks['uidNumber_usage']['STATUS_MSG']= _("Failed");
+ $this->checks['uidNumber_usage']['STATUS_MSG']= "<font style='color:#F0A500'>"._("Warning")."</font>";
$this->checks['uidNumber_usage']['ERROR_MSG'] =
$this->checks['uidNumber_usage']['ERROR_MSG'] =
- sprintf(_("Found %s duplicated uidNumber values."),count($this->check_uidNumbers));
+ sprintf(_("Found %s duplicate values for attribute 'uidNumber'."),count($this->check_uidNumbers));
return(false);
}else{
$this->checks['uidNumber_usage']['STATUS'] = TRUE;
return(false);
}else{
$this->checks['uidNumber_usage']['STATUS'] = TRUE;
$cv['tls']);
$ldap->cd($cv['base']);
$cv['tls']);
$ldap->cd($cv['base']);
- $res = $ldap->search("gidNumber=*",array("dn","gidNumber"));
+ $res = $ldap->search("(&(objectClass=posixGroup)(gidNumber=*))",array("dn","gidNumber"));
if(!$res){
$this->checks['gidNumber_usage']['STATUS'] = FALSE;
$this->checks['gidNumber_usage']['STATUS_MSG']= _("LDAP query failed");
if(!$res){
$this->checks['gidNumber_usage']['STATUS'] = FALSE;
$this->checks['gidNumber_usage']['STATUS_MSG']= _("LDAP query failed");
if($this->check_gidNumbers){
$this->checks['gidNumber_usage']['STATUS'] = FALSE;
if($this->check_gidNumbers){
$this->checks['gidNumber_usage']['STATUS'] = FALSE;
- $this->checks['gidNumber_usage']['STATUS_MSG']= _("Failed");
+ $this->checks['gidNumber_usage']['STATUS_MSG']= "<font style='color:#F0A500'>"._("Warning")."</font>";
$this->checks['gidNumber_usage']['ERROR_MSG'] =
$this->checks['gidNumber_usage']['ERROR_MSG'] =
- sprintf(_("Found %s duplicated gidNumber values."),count($this->check_gidNumbers));
+ sprintf(_("Found %s duplicate values for attribute 'gidNumber'."),count($this->check_gidNumbers));
return(false);
}else{
$this->checks['gidNumber_usage']['STATUS'] = TRUE;
return(false);
}else{
$this->checks['gidNumber_usage']['STATUS'] = TRUE;
$this->checks['outside_winstations']['STATUS_MSG']= _("Failed");
$this->checks['outside_winstations']['ERROR_MSG'] =
sprintf(_("Found %s winstations outside the predefined winstation department ou '%s'."),count($this->outside_winstations),$winstation_ou);
$this->checks['outside_winstations']['STATUS_MSG']= _("Failed");
$this->checks['outside_winstations']['ERROR_MSG'] =
sprintf(_("Found %s winstations outside the predefined winstation department ou '%s'."),count($this->outside_winstations),$winstation_ou);
- $this->checks['outside_winstations']['ERROR_MSG'].= "<input type='submit' name='outside_winstations_dialog' value='"._("Migrate")."'>";
+ $this->checks['outside_winstations']['ERROR_MSG'].= "<input type='submit' name='outside_winstations_dialog' value='"._("Migrate")."...'>";
return(false);
}else{
$this->checks['outside_winstations']['STATUS'] = TRUE;
return(false);
}else{
$this->checks['outside_winstations']['STATUS'] = TRUE;
$group_ou = $cv['groupou'];
$ldap->cd($cv['base']);
$group_ou = $cv['groupou'];
$ldap->cd($cv['base']);
+
+ /***********
+ * Get all gosaDepartments to be able to
+ * validate correct ldap tree position of every single user
+ ***********/
+ $valid_deps = array();
+ $valid_deps['/'] = $cv['base'];
+ $ldap->search("(&(objectClass=gosaDepartment)(ou=*))",array("dn","ou"));
+ while($attrs = $ldap->fetch()){
+ $valid_deps[$attrs['ou'][0]] = $attrs['dn'];
+ }
+
+ /***********
+ * Get all groups
+ ***********/
$res = $ldap->search("(objectClass=posixGroup)",array("dn"));
if(!$res){
$this->checks['outside_groups']['STATUS'] = FALSE;
$res = $ldap->search("(objectClass=posixGroup)",array("dn"));
if(!$res){
$this->checks['outside_groups']['STATUS'] = FALSE;
return(false);
}
return(false);
}
-
$this->outside_groups = array();
while($attrs = $ldap->fetch()){
$this->outside_groups = array();
while($attrs = $ldap->fetch()){
- if((!preg_match("/^[^,]+,".normalizePreg($group_ou)."/",$attrs['dn'])) && !preg_match("/,dc=addressbook,/",$attrs['dn'])){
+ $group_db_base = preg_replace("/^[^,]+,".normalizePreg($group_ou)."+,/i","",$attrs['dn']);
+
+ /* Check if entry is not an addressbook only user
+ * and verify that he is in a valid department
+ */
+ if( !preg_match("/".normalizePreg("dc=addressbook,")."/",$group_db_base) &&
+ !in_array($group_db_base,$valid_deps)
+ ){
$attrs['selected'] = FALSE;
$attrs['ldif'] = "";
$this->outside_groups[base64_encode($attrs['dn'])] = $attrs;
$attrs['selected'] = FALSE;
$attrs['ldif'] = "";
$this->outside_groups[base64_encode($attrs['dn'])] = $attrs;
if(count($this->outside_groups)){
$this->checks['outside_groups']['STATUS'] = FALSE;
if(count($this->outside_groups)){
$this->checks['outside_groups']['STATUS'] = FALSE;
- $this->checks['outside_groups']['STATUS_MSG']= _("Failed");
- $this->checks['outside_groups']['ERROR_MSG'] =
- sprintf(_("Found %s groups outside the selected group ou '%s'."),count($this->outside_groups),$group_ou);
- $this->checks['outside_groups']['ERROR_MSG'].= "<input type='submit' name='outside_groups_dialog' value='"._("Migrate")."'>";
+ $this->checks['outside_groups']['STATUS_MSG']= "<font style='color:#F0A500'>"._("Warning")."</font>";
+ $this->checks['outside_groups']['ERROR_MSG'] =
+ sprintf(_("Found %s groups outside the configured tree '%s'."),count($this->outside_groups),$group_ou);
+ $this->checks['outside_groups']['ERROR_MSG'].= " <input type='submit' name='outside_groups_dialog' value='"._("Move")."...'>";
return(false);
}else{
$this->checks['outside_groups']['STATUS'] = TRUE;
return(false);
}else{
$this->checks['outside_groups']['STATUS'] = TRUE;
}
}
}
}
-
- /* Search for users outside the people ou
+ /* Search for users outside the people ou
*/
function search_outside_users()
{
*/
function search_outside_users()
{
$cv['connection'],
FALSE,
$cv['tls']);
$cv['connection'],
FALSE,
$cv['tls']);
- $people_ou = $cv['peopleou'];
+
$ldap->cd($cv['base']);
$ldap->cd($cv['base']);
+
+
+ /***********
+ * Get all gosaDepartments to be able to
+ * validate correct ldap tree position of every single user
+ ***********/
+ $valid_deps = array();
+ $valid_deps['/'] = $cv['base'];
+ $ldap->search("(&(objectClass=gosaDepartment)(ou=*))",array("dn","ou"));
+ while($attrs = $ldap->fetch()){
+ $valid_deps[$attrs['ou'][0]] = $attrs['dn'];
+ }
+
+ /***********
+ * Search for all users
+ ***********/
$res = $ldap->search("(&(objectClass=gosaAccount)(!(uid=*$)))",array("dn"));
if(!$res){
$this->checks['outside_users']['STATUS'] = FALSE;
$res = $ldap->search("(&(objectClass=gosaAccount)(!(uid=*$)))",array("dn"));
if(!$res){
$this->checks['outside_users']['STATUS'] = FALSE;
return(false);
}
return(false);
}
-
+ /***********
+ * Check if returned users are within a valid GOsa deparmtment. (peopleou,gosaDepartment,base)
+ ***********/
$this->outside_users = array();
$this->outside_users = array();
+ $people_ou = trim($cv['peopleou']);
+ if(!empty($people_ou)){
+ $people_ou = $people_ou.",";
+ }
+
while($attrs = $ldap->fetch()){
while($attrs = $ldap->fetch()){
- if((!preg_match("/^[^,]+,".normalizePreg($people_ou)."/",$attrs['dn']) && !preg_match("/,dc=addressbook,/",$attrs['dn']))){
+ $people_db_base = preg_replace("/^[^,]+,".normalizePreg($people_ou)."/i","",$attrs['dn']);
+
+ /* Check if entry is not an addressbook only user
+ * and verify that he is in a valid department
+ */
+ if( !preg_match("/".normalizePreg("dc=addressbook,")."/",$people_db_base) &&
+ !in_array($people_db_base,$valid_deps)
+ ){
$attrs['selected'] = FALSE;
$attrs['ldif'] = "";
$this->outside_users[base64_encode($attrs['dn'])] = $attrs;
$attrs['selected'] = FALSE;
$attrs['ldif'] = "";
$this->outside_users[base64_encode($attrs['dn'])] = $attrs;
if(count($this->outside_users)){
$this->checks['outside_users']['STATUS'] = FALSE;
if(count($this->outside_users)){
$this->checks['outside_users']['STATUS'] = FALSE;
- $this->checks['outside_users']['STATUS_MSG']= _("Failed");
- $this->checks['outside_users']['ERROR_MSG'] =
- sprintf(_("Found %s users outside the selected user ou '%s'."),count($this->outside_users),$people_ou);
- $this->checks['outside_users']['ERROR_MSG'].= "<input type='submit' name='outside_users_dialog' value='"._("Migrate")."'>";
+ $this->checks['outside_users']['STATUS_MSG']= "<font style='color:#F0A500'>"._("Warning")."</font>";
+ $this->checks['outside_users']['ERROR_MSG'] =
+ sprintf(_("Found %s user(s) outside the configured tree '%s'."),count($this->outside_users),$people_ou);
+ $this->checks['outside_users']['ERROR_MSG'].= "<input type='submit' name='outside_users_dialog' value='"._("Move")."...'>";
return(false);
}else{
$this->checks['outside_users']['STATUS'] = TRUE;
return(false);
}else{
$this->checks['outside_users']['STATUS'] = TRUE;
$res = $ldap->add($testEntry);
$ldap->cat($dn);
if(!$ldap->count()){
$res = $ldap->add($testEntry);
$ldap->cat($dn);
if(!$ldap->count()){
- gosa_log($ldap->get_error());
+ new log("view","setup/".get_class($this),$dn,array(),$ldap->get_error());
+
$this->checks['permissions']['STATUS'] = FALSE;
$this->checks['permissions']['STATUS_MSG']= _("Failed");
$this->checks['permissions']['ERROR_MSG'] =
$this->checks['permissions']['STATUS'] = FALSE;
$this->checks['permissions']['STATUS_MSG']= _("Failed");
$this->checks['permissions']['ERROR_MSG'] =
$res = $ldap->rmDir($dn);
$ldap->cat($dn);
if($ldap->count()){
$res = $ldap->rmDir($dn);
$ldap->cat($dn);
if($ldap->count()){
- gosa_log($ldap->get_error());
+ new log("view","setup/".get_class($this),$dn,array(),$ldap->get_error());
$this->checks['permissions']['STATUS'] = FALSE;
$this->checks['permissions']['STATUS_MSG']= _("Failed");
$this->checks['permissions']['ERROR_MSG'] =
$this->checks['permissions']['STATUS'] = FALSE;
$this->checks['permissions']['STATUS_MSG']= _("Failed");
$this->checks['permissions']['ERROR_MSG'] =
/* Get all invisible users
*/
$ldap->cd($cv['base']);
/* Get all invisible users
*/
$ldap->cd($cv['base']);
- $res =$ldap->search("(&(|(objectClass=posixAccount)(objectClass=inetOrgPerson)(objectClass=organizationalPerson))(!(objectClass=gosaAccount)))",array("sn","givenName","cn","uid"));
+ $res =$ldap->search("(&(|(objectClass=posixAccount)(&(objectClass=inetOrgPerson)(objectClass=organizationalPerson)))(!(objectClass=gosaAccount))(uid=*))",array("sn","givenName","cn","uid"));
while($attrs = $ldap->fetch()){
if(!preg_match("/,dc=addressbook,/",$attrs['dn'])){
$attrs['checked'] = FALSE;
while($attrs = $ldap->fetch()){
if(!preg_match("/,dc=addressbook,/",$attrs['dn'])){
$attrs['checked'] = FALSE;
$this->checks['users_visible']['ERROR_MSG'] = "";
}else{
$this->checks['users_visible']['STATUS'] = FALSE;
$this->checks['users_visible']['ERROR_MSG'] = "";
}else{
$this->checks['users_visible']['STATUS'] = FALSE;
- $this->checks['users_visible']['STATUS_MSG']= "";
- $this->checks['users_visible']['ERROR_MSG'] = sprintf(_("Found %s users that will not be visible in GOsa."),
+ $this->checks['users_visible']['STATUS_MSG']= "<font style='color:#F0A500'>"._("Warning")."</font>";
+ $this->checks['users_visible']['ERROR_MSG'] = sprintf(_("Found %s user(s) that will not be visible in GOsa."),
count($this->users_to_migrate));
count($this->users_to_migrate));
- $this->checks['users_visible']['ERROR_MSG'] .= "<input type='submit' name='users_visible_migrate' value='"._("Migrate")."'>";
+ $this->checks['users_visible']['ERROR_MSG'] .= "<input type='submit' name='users_visible_migrate' value='"._("Migrate")."...'>";
}
}
}
}
*/
function migrate_gosaAccounts($only_ldif = FALSE)
{
*/
function migrate_gosaAccounts($only_ldif = FALSE)
{
+ $this->show_details= $only_ldif;
+
/* Get collected configuration settings */
$cv = $this->parent->captured_values;
/* Get collected configuration settings */
$cv = $this->parent->captured_values;
$cv['tls']);
/* Skip GOsa internal departments */
$cv['tls']);
/* Skip GOsa internal departments */
- $skip_dns = array("/^ou=people,/","/^ou=groups,/","/(,|)ou=configs,/","/(,|)ou=systems,/",
- "/^ou=apps,/","/^ou=mime,/","/^ou=aclroles,/","/^ou=incoming,/",
+ $skip_dns = array("/".$cv['peopleou']."/","/".$cv['groupou']."/","/^ou=people,/","/^ou=groups,/",
+ "/(,|)ou=configs,/","/(,|)ou=systems,/",
+ "/(,|)ou=apps,/","/(,|)ou=mime,/","/^ou=aclroles,/","/^ou=incoming,/",
"/ou=snapshots,/","/(,|)dc=addressbook,/","/^(,|)ou=machineaccounts,/",
"/(,|)ou=winstations,/");
"/ou=snapshots,/","/(,|)dc=addressbook,/","/^(,|)ou=machineaccounts,/",
"/(,|)ou=winstations,/");
-
/* Get all invisible departments */
$ldap->cd($cv['base']);
$res = $ldap->search("(&(objectClass=organizationalUnit)(!(objectClass=gosaDepartment)))",array("ou","description","dn"));
/* Get all invisible departments */
$ldap->cd($cv['base']);
$res = $ldap->search("(&(objectClass=organizationalUnit)(!(objectClass=gosaDepartment)))",array("ou","description","dn"));
$this->checks['deps_visible']['STATUS'] = TRUE;
$this->checks['deps_visible']['STATUS_MSG']= '<font style="color:#FFA500">'._("Warning").'</font>';
$this->checks['deps_visible']['ERROR_MSG'] = sprintf(_("Found %s department(s) that will not be visible in GOsa."),count($this->deps_to_migrate));
$this->checks['deps_visible']['STATUS'] = TRUE;
$this->checks['deps_visible']['STATUS_MSG']= '<font style="color:#FFA500">'._("Warning").'</font>';
$this->checks['deps_visible']['ERROR_MSG'] = sprintf(_("Found %s department(s) that will not be visible in GOsa."),count($this->deps_to_migrate));
- $this->checks['deps_visible']['ERROR_MSG'] .= "<input type='submit' name='deps_visible_migrate' value='"._("Migrate")."'>";
+ $this->checks['deps_visible']['ERROR_MSG'] .= " <input type='submit' name='deps_visible_migrate' value='"._("Migrate")."...'>";
}
}
}
}
/* Start deparmtment migration */
function migrate_organizationalUnits($only_ldif = FALSE)
{
/* Start deparmtment migration */
function migrate_organizationalUnits($only_ldif = FALSE)
{
+ $this->show_details= $only_ldif;
+
/* Get collected configuration settings */
$cv = $this->parent->captured_values;
/* Get collected configuration settings */
$cv = $this->parent->captured_values;
/* Search for gosaAcls */
$ldap->cd($cv['base']);
/* Search for gosaAcls */
$ldap->cd($cv['base']);
- $res = $ldap->search("(&(objectClass=gosaAccount)(|(objectClass=posixAccount)".
- "(objectClass=inetOrgPerson)(objectClass=organizationalPerson)))");
+ $res = $ldap->cat($cv['base']);
+
if(!$res){
$this->checks['acls']['STATUS'] = FALSE;
$this->checks['acls']['STATUS_MSG']= _("LDAP query failed");
$this->checks['acls']['ERROR_MSG'] = _("Possibly the 'root object' is missing.");
if(!$res){
$this->checks['acls']['STATUS'] = FALSE;
$this->checks['acls']['STATUS_MSG']= _("LDAP query failed");
$this->checks['acls']['ERROR_MSG'] = _("Possibly the 'root object' is missing.");
- }elseif($ldap->count()){
- $this->checks['acls']['STATUS'] = TRUE;
- $this->checks['acls']['STATUS_MSG']= _("Ok");
- $this->checks['acls']['ERROR_MSG'] = "";
}else{
}else{
- $this->checks['acls']['STATUS'] = FALSE;
- $this->checks['acls']['STATUS_MSG']= _("Failed");
- $this->checks['acls']['ERROR_MSG']= _("There is no GOsa administrator account inside your LDAP.")." ";
- $this->checks['acls']['ERROR_MSG'].= "<input type='submit' name='create_acls' value='"._("Create")."'>";
+ $found = false;
+ $username = "";
+ $attrs = $ldap->fetch();
+ if(isset($attrs['gosaAclEntry'])){
+ $acls = $attrs['gosaAclEntry'];
+ for($i = 0 ; $i < $acls['count'] ; $i++){
+ $acl = $acls[$i];
+ $tmp = split(":",$acl);
+ if($tmp[1] == "psub"){
+ $members = split(",",$tmp[2]);
+ foreach($members as $member){
+ $member = base64_decode($member);
+
+ /* Check if acl owner is a valid GOsa user account */
+ $ldap->cat($member,array("objectClass","uid","cn"));
+ $ret = $ldap->fetch();
+
+ if(isset($ret['objectClass']) && in_array("posixGroup",$ret['objectClass'])){
+ $found = TRUE;
+ $username .= "ACL-Group: ".$ret['cn'][0]."<br>";
+ }elseif(isset($ret['objectClass']) && in_array("gosaAccount",$ret['objectClass']) &&
+ in_array("organizationalPerson",$ret['objectClass']) &&
+ in_array("inetOrgPerson",$ret['objectClass'])){
+ $found = TRUE;
+ $username .= "ACL: ".$ret['uid'][0]."<br>";
+ }
+ }
+ }elseif($tmp[1] == "role"){
+
+ /* Check if acl owner is a valid GOsa user account */
+ $ldap->cat(base64_decode($tmp[2]),array("gosaAclTemplate"));
+ $ret = $ldap->fetch();
+
+ if(isset($ret['gosaAclTemplate'])){
+ $cnt = $ret['gosaAclTemplate']['count'];
+ for($e = 0 ; $e < $cnt ; $e++){
+
+ $a_str = $ret['gosaAclTemplate'][$e];
+ if(preg_match("/^[0-9]*:psub:/",$a_str) && preg_match("/:all;cmdrw$/",$a_str)){
+
+ $members = split(",",$tmp[3]);
+ foreach($members as $member){
+ $member = base64_decode($member);
+
+ /* Check if acl owner is a valid GOsa user account */
+ $ldap->cat($member,array("objectClass","uid"));
+ $ret = $ldap->fetch();
+
+ if(isset($ret['objectClass']) && in_array("gosaAccount",$ret['objectClass']) &&
+ in_array("organizationalPerson",$ret['objectClass']) &&
+ in_array("inetOrgPerson",$ret['objectClass'])){
+ $found = TRUE;
+ $username .= "ACL Role: ".$ret['uid'][0]."<br>";
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ # For debugging
+ #echo $username;
+
+ if($found){
+ $this->checks['acls']['STATUS'] = TRUE;
+ $this->checks['acls']['STATUS_MSG']= _("Ok");
+ $this->checks['acls']['ERROR_MSG'] = "";
+ }else{
+ $this->checks['acls']['STATUS'] = FALSE;
+ $this->checks['acls']['STATUS_MSG']= _("Failed");
+ $this->checks['acls']['ERROR_MSG']= _("There is no GOsa administrator account inside your LDAP.")." ";
+ $this->checks['acls']['ERROR_MSG'].= "<input type='submit' name='create_acls' value='"._("Create")."'>";
+ }
}
return($ldap->count()>=1);
}
}
return($ldap->count()>=1);
}
$ldap->cd($cv['base']);
if(!$ldap->modify($attrs_new)){
print_red(sprintf(_("Adding acls for user '%s' failed, ldap says '%s'."),$dn,$ldap->get_error()));
$ldap->cd($cv['base']);
if(!$ldap->modify($attrs_new)){
print_red(sprintf(_("Adding acls for user '%s' failed, ldap says '%s'."),$dn,$ldap->get_error()));
+ return(FALSE);
+ }else{
+ return(TRUE);
}
}
}
}
}
}
function create_admin_user()
{
$pw1 = $pw2 = "";
function create_admin_user()
{
$pw1 = $pw2 = "";
-
+ $uid = "";
+
+ if(isset($_POST['new_user_uid'])){
+ $uid = $_POST['new_user_uid'];
+ }
if(isset($_POST['new_user_password'])){
$pw1 = $_POST['new_user_password'];
}
if(isset($_POST['new_user_password'])){
$pw1 = $_POST['new_user_password'];
}
return false;
}
return false;
}
+ if(!is_uid($uid) || empty($uid)){
+ print_red(_("Please specify a valid uid."));
+ return false;
+ }
+
+
/* Establish ldap connection */
$cv = $this->parent->captured_values;
$ldap = new LDAP($cv['admin'],
/* Establish ldap connection */
$cv = $this->parent->captured_values;
$ldap = new LDAP($cv['admin'],
/* Get current base attributes */
$ldap->cd($cv['base']);
/* Get current base attributes */
$ldap->cd($cv['base']);
+ $people_ou = trim($cv['peopleou']);
+ if(!empty($people_ou)){
+ $people_ou = trim($people_ou).",";
+ }
+
if($cv['peopledn'] == "cn"){
if($cv['peopledn'] == "cn"){
- $dn = "cn=System Administrator,".$cv['peopleou'].",".$cv['base'];
+ $dn = "cn=System Administrator,".$people_ou.$cv['base'];
}else{
}else{
- $dn = "uid=admin,".$cv['peopleou'].",".$cv['base'];
+ $dn = "uid=".$uid.",".$people_ou.$cv['base'];
}
}
- $methods = @passwordMethod::get_available_methods_if_not_loaded();
+ $methods = @passwordMethod::get_available_methods();
$p_m = $methods[$cv['encryption']];
$p_c = new $p_m(array());
$hash = $p_c->generate_hash($pw2);
$p_m = $methods[$cv['encryption']];
$p_c = new $p_m(array());
$hash = $p_c->generate_hash($pw2);
$new_user['givenName'] = "System";
$new_user['sn'] = "Administrator";
$new_user['cn'] = "System Administrator";
$new_user['givenName'] = "System";
$new_user['sn'] = "Administrator";
$new_user['cn'] = "System Administrator";
- $new_user['uid'] = "admin";
+ $new_user['uid'] = $uid;
$new_user['userPassword'] = $hash;
$new_user['userPassword'] = $hash;
-
+
$ldap->cd($cv['base']);
$ldap->cd($cv['base']);
+
+ $ldap->cat($dn,array("dn"));
+ if($ldap->count()){
+ print_red(sprintf(_("Could not add administrative user, there is already an object with the same dn '%s' in your ldap database."),$dn));
+ return(FALSE);
+ }
+
$ldap->create_missing_trees(preg_replace("/^[^,]+,/","",$dn));
$ldap->cd($dn);
$res = $ldap->add($new_user);
$ldap->create_missing_trees(preg_replace("/^[^,]+,/","",$dn));
$ldap->cd($dn);
$res = $ldap->add($new_user);
print_red(_("Couldn't move users to specified department."));
return(false);
}
print_red(_("Couldn't move users to specified department."));
return(false);
}
-
+
foreach($this->outside_users as $b_dn => $data){
$this->outside_users[$b_dn]['ldif'] ="";
if($data['selected']){
foreach($this->outside_users as $b_dn => $data){
$this->outside_users[$b_dn]['ldif'] ="";
if($data['selected']){
$refs .= "<br />\t".$ref_dn;
}
if(!empty($refs)){
$refs .= "<br />\t".$ref_dn;
}
if(!empty($refs)){
- $this->outside_users[$b_dn]['ldif'] .= "<br /><br /><i>"._("Updating following references too").":</i>".$refs;
+ $this->outside_users[$b_dn]['ldif'] .= "<br /><br /><i>"._("The following references will be updated").":</i>".$refs;
}
}else{
}
}else{
if(isset($_POST['outside_winstations_dialog_cancel'])){
$this->outside_winstations_dialog = FALSE;
$this->dialog = FALSE;
if(isset($_POST['outside_winstations_dialog_cancel'])){
$this->outside_winstations_dialog = FALSE;
$this->dialog = FALSE;
+ $this->show_details = FALSE;
}
if(isset($_POST['outside_winstations_dialog_whats_done'])){
}
if(isset($_POST['outside_winstations_dialog_whats_done'])){
if(isset($_POST['outside_winstations_dialog_perform'])){
$this->migrate_outside_winstations(TRUE);
$this->search_outside_winstations();
if(isset($_POST['outside_winstations_dialog_perform'])){
$this->migrate_outside_winstations(TRUE);
$this->search_outside_winstations();
+ $this->dialog = FALSE;
+ $this->show_details = FALSE;
+ $this->outside_winstations_dialog = FALSE;
}
if(isset($_POST['outside_winstations_dialog'])){
}
if(isset($_POST['outside_winstations_dialog'])){
if(isset($_POST['outside_groups_dialog_cancel'])){
$this->outside_groups_dialog = FALSE;
if(isset($_POST['outside_groups_dialog_cancel'])){
$this->outside_groups_dialog = FALSE;
+ $this->show_details = FALSE;
$this->dialog = FALSE;
}
if(isset($_POST['outside_groups_dialog_whats_done'])){
$this->dialog = FALSE;
}
if(isset($_POST['outside_groups_dialog_whats_done'])){
+ $this->show_details= TRUE;
$this->migrate_outside_groups(FALSE);
}
$this->migrate_outside_groups(FALSE);
}
+ if(isset($_POST['outside_groups_dialog_refresh'])){
+ $this->show_details= FALSE;
+ }
+
if(isset($_POST['outside_groups_dialog_perform'])){
$this->migrate_outside_groups(TRUE);
if(isset($_POST['outside_groups_dialog_perform'])){
$this->migrate_outside_groups(TRUE);
- $this->search_outside_groups();
+ $this->dialog = FALSE;
+ $this->show_details = FALSE;
+ $this->outside_groups_dialog = FALSE;
+ $this->initialize_checks();
}
if(isset($_POST['outside_groups_dialog'])){
}
if(isset($_POST['outside_groups_dialog'])){
$smarty->assign("ous",$this->get_all_group_ous());
$smarty->assign("method","outside_groups");
$smarty->assign("outside_groups",$this->outside_groups);
$smarty->assign("ous",$this->get_all_group_ous());
$smarty->assign("method","outside_groups");
$smarty->assign("outside_groups",$this->outside_groups);
+ $smarty->assign("group_details", $this->show_details);
return($smarty->fetch(get_template_path("setup_migrate.tpl",TRUE,dirname(__FILE__))));
}
return($smarty->fetch(get_template_path("setup_migrate.tpl",TRUE,dirname(__FILE__))));
}
if(isset($_POST['outside_users_dialog_cancel'])){
$this->outside_users_dialog = FALSE;
$this->dialog = FALSE;
if(isset($_POST['outside_users_dialog_cancel'])){
$this->outside_users_dialog = FALSE;
$this->dialog = FALSE;
+ $this->show_details = FALSE;
}
if(isset($_POST['outside_users_dialog_whats_done'])){
}
if(isset($_POST['outside_users_dialog_whats_done'])){
+ $this->show_details= TRUE;
$this->migrate_outside_users(FALSE);
}
if(isset($_POST['outside_users_dialog_perform'])){
$this->migrate_outside_users(TRUE);
$this->migrate_outside_users(FALSE);
}
if(isset($_POST['outside_users_dialog_perform'])){
$this->migrate_outside_users(TRUE);
- $this->search_outside_users();
+ $this->initialize_checks();
+ $this->dialog = FALSE;
+ $this->show_details = FALSE;
+ $this->outside_users_dialog = FALSE;
+ }
+
+ if (isset($_POST['outside_users_dialog_refresh'])){
+ $this->show_details= FALSE;
}
if(isset($_POST['outside_users_dialog'])){
}
if(isset($_POST['outside_users_dialog'])){
$smarty->assign("ous",$this->get_all_people_ous());
$smarty->assign("method","outside_users");
$smarty->assign("outside_users",$this->outside_users);
$smarty->assign("ous",$this->get_all_people_ous());
$smarty->assign("method","outside_users");
$smarty->assign("outside_users",$this->outside_users);
+ $smarty->assign("user_details", $this->show_details);
return($smarty->fetch(get_template_path("setup_migrate.tpl",TRUE,dirname(__FILE__))));
}
return($smarty->fetch(get_template_path("setup_migrate.tpl",TRUE,dirname(__FILE__))));
}
if(isset($_POST['create_acls_cancel'])){
$this->acl_create_dialog = FALSE;
$this->dialog = FALSE;
if(isset($_POST['create_acls_cancel'])){
$this->acl_create_dialog = FALSE;
$this->dialog = FALSE;
+ $this->show_details = FALSE;
}
}
- if(isset($_POST['create_acls_create_confirmed'])){
- $this->create_admin();
- }
+# if(isset($_POST['create_acls_create_confirmed'])){
+# if($this->create_admin()){
+# $this->acl_create_dialog = FALSE;
+# $this->dialog = FALSE;
+# $this->show_details = FALSE;
+# $this->initialize_checks();
+# }
+# }
if(isset($_POST['create_acls_create'])){
$this->create_admin(TRUE);
if(isset($_POST['create_acls_create'])){
$this->create_admin(TRUE);
if(isset($_POST['create_admin_user'])){
if($this->create_admin_user()){
$this->dialog = FALSE;
if(isset($_POST['create_admin_user'])){
if($this->create_admin_user()){
$this->dialog = FALSE;
+ $this->show_details = FALSE;
}
}
if($this->acl_create_dialog){
$smarty = get_smarty();
}
}
if($this->acl_create_dialog){
$smarty = get_smarty();
+
+ $uid = "admin";
+ if(isset($_POST['new_user_uid'])){
+ $uid = $_POST['new_user_uid'];
+ }
+
+ $smarty->assign("new_user_uid",$uid);
$smarty->assign("new_user_password",@$_POST['new_user_password']);
$smarty->assign("new_user_password2",@$_POST['new_user_password2']);
$smarty->assign("new_user_password",@$_POST['new_user_password']);
$smarty->assign("new_user_password2",@$_POST['new_user_password2']);
- $smarty->assign("users" ,$this->get_user_list());
- $smarty->assign("users_cnt" ,count($this->get_user_list()));
- $smarty->assign("groups",$this->get_group_list());
- $smarty->assign("groups_cnt",count($this->get_group_list()));
- $smarty->assign("type" ,$this->acl_create_type);
$smarty->assign("method","create_acls");
$smarty->assign("acl_create_selected",$this->acl_create_selected);
$smarty->assign("what_will_be_done_now",$this->acl_create_changes);
$smarty->assign("method","create_acls");
$smarty->assign("acl_create_selected",$this->acl_create_selected);
$smarty->assign("what_will_be_done_now",$this->acl_create_changes);
/* Open migration dialog */
if(isset($_POST['users_visible_migrate'])){
/* Open migration dialog */
if(isset($_POST['users_visible_migrate'])){
+ $this->show_details= FALSE;
$this->users_migration_dialog = TRUE;
$this->dialog =TRUE;
}
$this->users_migration_dialog = TRUE;
$this->dialog =TRUE;
}
if(isset($_POST['users_visible_migrate_close'])){
$this->users_migration_dialog = FALSE;
$this->dialog =FALSE;
if(isset($_POST['users_visible_migrate_close'])){
$this->users_migration_dialog = FALSE;
$this->dialog =FALSE;
+ $this->show_details = FALSE;
}
/* Start migration */
if(isset($_POST['users_visible_migrate_migrate'])){
if($this->migrate_gosaAccounts()){
}
/* Start migration */
if(isset($_POST['users_visible_migrate_migrate'])){
if($this->migrate_gosaAccounts()){
- $this->check_gosaAccounts();
+ $this->initialize_checks();
+ $this->dialog = FALSE;
+ $this->show_details = FALSE;
+ $this->users_migration_dialog = FALSE;
}
}
}
}
$smarty = get_smarty();
$smarty->assign("users_to_migrate",$this->users_to_migrate);
$smarty->assign("method","migrate_users");
$smarty = get_smarty();
$smarty->assign("users_to_migrate",$this->users_to_migrate);
$smarty->assign("method","migrate_users");
+ $smarty->assign("user_details", $this->show_details);
return($smarty->fetch(get_template_path("setup_migrate.tpl",TRUE,dirname(__FILE__))));
}
return($smarty->fetch(get_template_path("setup_migrate.tpl",TRUE,dirname(__FILE__))));
}
/* Refresh list of deparments */
if(isset($_POST['deps_visible_migrate_refresh'])){
/* Refresh list of deparments */
if(isset($_POST['deps_visible_migrate_refresh'])){
- $this->show_details= false;
$this->check_organizationalUnits();
$this->check_organizationalUnits();
+ $this->show_details= FALSE;
}
/* Open migration dialog */
}
/* Open migration dialog */
if(isset($_POST['deps_visible_migrate_close'])){
$this->dep_migration_dialog = FALSE;
$this->dialog =FALSE;
if(isset($_POST['deps_visible_migrate_close'])){
$this->dep_migration_dialog = FALSE;
$this->dialog =FALSE;
+ $this->show_details = FALSE;
}
/* Start migration */
if(isset($_POST['deps_visible_migrate_migrate'])){
if($this->migrate_organizationalUnits()){
}
/* Start migration */
if(isset($_POST['deps_visible_migrate_migrate'])){
if($this->migrate_organizationalUnits()){
+ $this->show_details= FALSE;
$this->check_organizationalUnits();
$this->check_organizationalUnits();
+ $this->dialog = FALSE;
+ $this->dep_migration_dialog = FALSE;
}
}
/* Start migration */
if(isset($_POST['deps_visible_migrate_whatsdone'])){
}
}
/* Start migration */
if(isset($_POST['deps_visible_migrate_whatsdone'])){
- $this->show_details= TRUE;
$this->migrate_organizationalUnits(TRUE);
}
$this->migrate_organizationalUnits(TRUE);
}
/* Get "create acl" dialog posts */
if($this->acl_create_dialog){
/* Get "create acl" dialog posts */
if($this->acl_create_dialog){
- if(isset($_POST['create_acls_create'])){
- if(isset($_POST['create_acls_selected'])){
- $this->acl_create_selected = base64_decode($_POST['create_acls_selected']);
- }else{
- $this->acl_create_selected = "";
- }
- }
if(isset($_POST['create_acls_create_abort'])){
$this->acl_create_selected = "";
}
if(isset($_POST['create_acls_create_abort'])){
$this->acl_create_selected = "";
}
-
- if(isset($_POST['acl_create_type'])){
- $this->acl_create_type = $_POST['acl_create_type'];
- }
}
/* Get selected departments */
}
/* Get selected departments */
$this->checks['root']['STATUS'] = FALSE;
$this->checks['root']['STATUS_MSG']= _("Failed");
$this->checks['root']['ERROR_MSG'] = _("Root object couldn't be created, you should try it on your own.");
$this->checks['root']['STATUS'] = FALSE;
$this->checks['root']['STATUS_MSG']= _("Failed");
$this->checks['root']['ERROR_MSG'] = _("Root object couldn't be created, you should try it on your own.");
- $this->checks['root']['ERROR_MSG'].= "<input type='submit' name='retry_root_create' value='"._("Try to create root object")."'>";
+ $this->checks['root']['ERROR_MSG'].= " <input type='submit' name='retry_root_create' value='"._("Try to create root object")."'>";
return($res);;
}
}
return($res);;
}
}
}
}
- function get_all_people_ous()
+ function get_all_people_ous()
{
/* Get collected configuration settings */
$cv = $this->parent->captured_values;
{
/* Get collected configuration settings */
$cv = $this->parent->captured_values;
+ $people_ou = trim($cv['peopleou']);
/* Establish ldap connection */
$ldap = new LDAP($cv['admin'],
/* Establish ldap connection */
$ldap = new LDAP($cv['admin'],
FALSE,
$cv['tls']);
FALSE,
$cv['tls']);
- $ldap->cd($cv['base']);
- $ldap->search("(".$cv['peopleou'].")",array("dn"));
-
- if($ldap->count() == 0 ){
- $add_dn = $cv['peopleou'].",".$cv['base'];
- $naming_attr = preg_replace("/=.*$/","",$add_dn);
- $naming_value = preg_replace("/^[^=]*+=([^,]*).*$/","\\1",$add_dn);
- $add = array();
- $add['objectClass'] = array("organizationalUnit");
- $add[$naming_attr] = $naming_value;
- $ldap->cd($cv['base']);
- $ldap->create_missing_trees(preg_replace("/^[^,]+,/","",$add_dn));
- $ldap->cd($add_dn);
- $ldap->add($add);
- }
+ /*****************
+ * If people ou is NOT empty
+ * search for for all objects matching the given container
+ *****************/
+ if(!empty($people_ou)){
+ $ldap->search("(".$people_ou.")",array("dn"));
+
+ /* Create people ou if there is currently none */
+ if($ldap->count() == 0 ){
+ $add_dn = $cv['peopleou'].",".$cv['base'];
+ $naming_attr = preg_replace("/=.*$/","",$add_dn);
+ $naming_value = preg_replace("/^[^=]*+=([^,]*).*$/","\\1",$add_dn);
+ $add = array();
+ $add['objectClass'] = array("organizationalUnit");
+ $add[$naming_attr] = $naming_value;
+ $ldap->cd($cv['base']);
+ $ldap->create_missing_trees(preg_replace("/^[^,]+,/","",$add_dn));
+ $ldap->cd($add_dn);
+ $ldap->add($add);
+ }
- $ldap->search("(".$cv['peopleou'].")",array("dn"));
- $tmp = array();
- while($attrs= $ldap->fetch()){
- if(!preg_match("/ou=snapshots,/",$attrs['dn'])){
- $tmp[base64_encode($attrs['dn'])] = $ldap->fix($attrs['dn']);
+ /* Create result */
+ $ldap->search("(".$cv['peopleou'].")",array("dn"));
+ $tmp = array();
+ while($attrs= $ldap->fetch()){
+ if(!preg_match("/ou=snapshots,/",$attrs['dn'])){
+ $tmp[base64_encode($attrs['dn'])] = $ldap->fix($attrs['dn']);
+ }
+ }
+ } else{
+
+ /************
+ * If people ou is empty
+ * Get all valid gosaDepartments
+ ************/
+ $ldap->cd($cv['base']);
+ $tmp = array();
+ $ldap->search("(&(objectClass=gosaDepartment)(ou=*))",array("dn"));
+ $tmp[base64_encode($cv['base'])] = $ldap->fix($cv['base']);
+ while($attrs = $ldap->fetch()){
+ $tmp[base64_encode($attrs['dn'])] = $ldap->fix($attrs['dn']);;
}
}
}
}
- return($tmp);
+ return($tmp);
}
}
+
function get_all_winstation_ous()
{
/* Get collected configuration settings */
function get_all_winstation_ous()
{
/* Get collected configuration settings */
}
}
- function get_all_group_ous()
+ function get_all_group_ous()
{
/* Get collected configuration settings */
$cv = $this->parent->captured_values;
{
/* Get collected configuration settings */
$cv = $this->parent->captured_values;
FALSE,
$cv['tls']);
FALSE,
$cv['tls']);
+ $group_ou = trim($cv['groupou']);
+ if(!empty($group_ou)){
+ $group_ou = trim($group_ou);
+ }
+
+ /************
+ * If group ou is NOT empty
+ * Get all valid group ous, create one if necessary
+ ************/
$ldap->cd($cv['base']);
$ldap->cd($cv['base']);
- $ldap->search("(".$cv['groupou'].")",array("dn"));
-
- if($ldap->count() == 0 ){
- $add_dn = $cv['groupou'].",".$cv['base'];
- $naming_attr = preg_replace("/=.*$/","",$add_dn);
- $naming_value = preg_replace("/^[^=]*+=([^,]*).*$/","\\1",$add_dn);
- $add = array();
- $add['objectClass'] = array("organizationalUnit");
- $add[$naming_attr] = $naming_value;
+ if(!empty($group_ou)){
+ $ldap->search("(".$group_ou.")",array("dn"));
+ if($ldap->count() == 0 ){
+ $add_dn = $group_ou.$cv['base'];
+ $naming_attr = preg_replace("/=.*$/","",$add_dn);
+ $naming_value = preg_replace("/^[^=]*+=([^,]*).*$/","\\1",$add_dn);
+ $add = array();
+ $add['objectClass'] = array("organizationalUnit");
+ $add[$naming_attr] = $naming_value;
+ $ldap->cd($cv['base']);
+ $ldap->create_missing_trees(preg_replace("/^[^,]+,/","",$add_dn));
+ $ldap->cd($add_dn);
+ $ldap->add($add);
+ }
+ $ldap->search("(".$group_ou.")",array("dn"));
+ $tmp = array();
+ while($attrs= $ldap->fetch()){
+ if(!preg_match("/ou=snapshots,/",$attrs['dn'])){
+ $tmp[base64_encode($attrs['dn'])] = $ldap->fix($attrs['dn']);
+ }
+ }
+ }else{
+ /************
+ * If group ou is empty
+ * Get all valid gosaDepartments
+ ************/
$ldap->cd($cv['base']);
$ldap->cd($cv['base']);
- $ldap->create_missing_trees(preg_replace("/^[^,]+,/","",$add_dn));
- $ldap->cd($add_dn);
- $ldap->add($add);
- }
-
- $ldap->search("(".$cv['groupou'].")",array("dn"));
- $tmp = array();
- while($attrs= $ldap->fetch()){
- if(!preg_match("/ou=snapshots,/",$attrs['dn'])){
- $tmp[base64_encode($attrs['dn'])] = $ldap->fix($attrs['dn']);
+ $tmp = array();
+ $ldap->search("(&(objectClass=gosaDepartment)(ou=*))",array("dn"));
+ $tmp[base64_encode($cv['base'])] = $ldap->fix($cv['base']);
+ while($attrs = $ldap->fetch()){
+ $tmp[base64_encode($attrs['dn'])] = $ldap->fix($attrs['dn']);;
}
}
}
}
- return($tmp);
+ return($tmp);
}
}