* Admin/VFS/LDAP: on saving a group, check if group directory exists and create it if not

This commit is contained in:
Ralf Becker 2011-06-10 11:00:40 +00:00
parent fcfbd038bc
commit d7c7034771

View File

@ -127,6 +127,9 @@ class vfs_home_hooks
/** /**
* Hook called after group has been modified * Hook called after group has been modified
* *
* Checks if group has been renamed and renames the group directory too,
* or if the group directory exists and creates it if not.
*
* @param array $data * @param array $data
* @param int $data['account_id'] numerical id * @param int $data['account_id'] numerical id
* @param string $data['account_name'] new group-name * @param string $data['account_name'] new group-name
@ -135,12 +138,22 @@ class vfs_home_hooks
static function editGroup($data) static function editGroup($data)
{ {
if (self::LOG_LEVEL > 0) error_log(__METHOD__.'('.array2string($data).')'); if (self::LOG_LEVEL > 0) error_log(__METHOD__.'('.array2string($data).')');
if ($data['account_name'] == $data['old_name']) return; // nothing to do here
// rename the group-dir if ($data['account_name'] == $data['old_name'])
egw_vfs::$is_root = true; {
egw_vfs::rename('/home/'.$data['old_name'],'/home/'.$data['account_name']); // check if group directory exists and create it if not (by calling addGroup hook)
egw_vfs::$is_root = false; if (!egw_vfs::stat('/home/'.$data['account_name']))
{
self::addGroup($data);
}
}
else
{
// rename the group-dir
egw_vfs::$is_root = true;
egw_vfs::rename('/home/'.$data['old_name'],'/home/'.$data['account_name']);
egw_vfs::$is_root = false;
}
} }
/** /**