Author Topic: 3.5 documentation error  (Read 1572 times)

dave2318

  • Zen Apprentice
  • *
  • Posts: 48
  • Karma: +3/-0
    • View Profile
3.5 documentation error
« on: August 04, 2014, 01:33:06 pm »
Hi All,

I have been waiting for ages for the 3.5 documentation to be updated so that i can get a new script for importing users.
The documentation now clearly says 3.5, but the import script is still for 3.4

The page in question is:-
https://wiki.zentyal.org/wiki/En/3.5/Development_and_advanced_configuration
but EBox::Users::User does not exist on 3.5, it's replaced with EBox::Samba::User

changing all occurrences to be Samba instead of Users causes a missing Argument error because SamAccountName isn't specified.
Adding the line samAccountName => $username, results in

LDAP error: The request contained an invalid DN
.<br/> Operation parameters:{
  'scope' => 'base',
  'attrs' => [
               '*',
               'objectGUID',
               'unicodePwd',
               'supplementalCredentials'
             ],
  'base' => 'CN=,CN=Users,DC=mycohens,DC=net',
  'filter' => '(objectclass=*)'
}

Please can this script be updated to work with 3.5?

StuartNaylor

  • Guest
Re: 3.5 documentation error
« Reply #1 on: August 04, 2014, 03:09:23 pm »
I managed it another way if that is any use?

https://forum.zentyal.org/index.php/topic,22477.msg86568.html#msg86568

Dunno as its hard with the Zentyal object model whilst they are developing when changes happen.

You seem to know some scripting so maybe the bulkuser script will be of use.

J. A. Calvo

  • Zentyal Staff
  • Zen Hero
  • *****
  • Posts: 1986
  • Karma: +67/-3
    • View Profile
    • http://blogs.zentyal.org/jacalvo
Re: 3.5 documentation error
« Reply #2 on: August 04, 2014, 03:15:52 pm »
I've updated the script, thanks for reporting!
Zentyal Server Lead Developer

dave2318

  • Zen Apprentice
  • *
  • Posts: 48
  • Karma: +3/-0
    • View Profile
Re: 3.5 documentation error
« Reply #3 on: August 04, 2014, 04:39:12 pm »
Superb! thanks, this is now working. On 3.4 though i had adjusted the script to import contacts into a different OU called Contacts.
I've moded the new one to the following but am having problems:-

Code: [Select]
#!/usr/bin/perl

use strict;
use warnings;

use EBox;
use EBox::Samba::Contact;
use File::Slurp;

EBox::init();

sub FindContainer {
    my ($class, $ro) = @_;
    my $usersMod = EBox::Global->getInstance($ro)->modInstance('samba');
    return $usersMod->objectFromDN('CN=Contacts,' . $usersMod->ldap->dn());
}

my @lines = read_file('contacts.csv');
chomp (@lines);

my $parent = FindContainer();

for my $line (@lines) {
    my ($username, $givenname, $surname, $email) = split(',', $line);
    EBox::Samba::Contact->create(
        samAccountName => $username,
        parent => $parent,
        givenName => $givenname,
        sn => $surname,
        mail => $email
    );
}

1;

It keeps saying "missing argument: parent"
the findcontainer sub is pinched from the contacts.pm file with a moded DN path.
Can't see why it's returning a blank value though! (I have created the OU Contacts)

Dave
« Last Edit: August 04, 2014, 06:11:13 pm by dave2318 »

dave2318

  • Zen Apprentice
  • *
  • Posts: 48
  • Karma: +3/-0
    • View Profile
Re: 3.5 documentation error
« Reply #4 on: August 04, 2014, 06:00:02 pm »
Much more messing about and still no further.
I have changed CN=Contacts back to CN=Users and it works, but puts the contacts in the Users OU.
I copied and pasted the name of the Contacts OU i created into the script and still get "Missing argument: parent"

I have around 300 users and several hundred contacts, so obviously i don't want them all in one OU as it would be huge!

Any ideas?

StuartNaylor

  • Guest
Re: 3.5 documentation error
« Reply #5 on: August 04, 2014, 11:42:48 pm »
Dave as far as I am aware Openchange only supports a singular OU. The original CN=Users.

If you do unless they have made changes to how openchange works you will not have mail settings on the other OU's

I have posted before about this as its something I can not get my head round as OU's are really important for organisation and group policies.

dave2318

  • Zen Apprentice
  • *
  • Posts: 48
  • Karma: +3/-0
    • View Profile
Re: 3.5 documentation error
« Reply #6 on: August 05, 2014, 09:15:42 am »
Hi Stuart, to my knowledge it's only openchange mailboxes that only work in the Users OU, Contacts can go in any OU.
I have just tested it by creating a contact in my Contacts OU and it was visible in SOGo.

I agree about the annoyance of only having mail enabled users in one OU, it's a real limitation, hopefully we will get round it soon. Apparently the main restriction was having to sync 2 separate LDAP trees, but not we only have one I hope it's should not be too far away:)

The other things i would like:-
Ability to move Users/Contacts to another OU
Ability to select multiple Users/Contacts to move/delete

Dave