Changeset 203 for LATMOS-Accounts/lib/LATMOS
- Timestamp:
- 05/27/09 03:45:05 (15 years ago)
- Location:
- LATMOS-Accounts/lib/LATMOS/Accounts
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Ad/User.pm
r199 r203 53 53 homeDirectory loginShell 54 54 uidNumber gidNumber gecos 55 userPassword56 55 shadowLastChange shadowMin shadowMax 57 56 shadowWarning shadowInactive shadowExpire … … 61 60 ipPhone otherTelephone department 62 61 title modbile homePhone 63 memberOf64 62 accountExpires 65 63 streetAddress postalCode postOfficeBox l … … 71 69 userAccountControl 72 70 locked 71 memberOf 73 72 ), 74 73 ($mode !~ /w/ … … 90 89 $entry->replace('sAMAccountName', $id); 91 90 $entry->replace(objectClass => [ qw(top person organizationalPerson user)],); 92 $entry->replace(userAccountControl => 66112); 91 # Must be 544 for creation... 92 $entry->replace(userAccountControl => 544); #66112); 93 93 # This attributes cannot be set via LDAP: 94 94 #$entry->replace(sAMAccountType => 0x30000000); 95 95 $entry->replace(accountExpires => '9223372036854775807'); # TODO hardcoded, burk 96 96 $entry->replace(userPrincipalName => "$id\@" . $base->ad_domain); 97 my %delayed; 97 98 foreach (keys %data) { 99 /^(manager|memberOf)$/ and do { 100 $delayed{$_} = $data{$_}; 101 next; 102 }; 98 103 $class->_populate_entry($entry, $_, $data{$_}); 99 104 } 100 105 my $msg = $base->ldap->add($entry); 101 warn $msg->error if ($msg->code); 102 return $msg->code ? 0 : 1; 106 if ($msg->code) { 107 warn $msg->error; 108 return 0; 109 } 110 my $res = $base->get_object('user', $id)->set_fields(%delayed); 111 return defined($res) ? 1 : 0; 103 112 } 104 113 … … 146 155 foreach (keys %users) { 147 156 $users{$_}{e} && $users{$_}{n} and next; 148 my $user = $self->base->get_object('group', $_) or next; 157 my $group = $self->base->get_object('group', $_) or next; 158 # memberOf field is read only 159 # so we modify the peer entry into peer object 149 160 if ($users{$_}{e}) { 150 $ self->{entry}->del(memberOf => $user->get_field('dn'));161 $group->{entry}->delete(member => $self->get_field('dn')); 151 162 } elsif ($users{$_}{n}) { 152 $ self->{entry}->add(memberOf => $user->get_field('dn'));163 $group->{entry}->add(member => $self->get_field('dn')); 153 164 } # else {} # can't happen 154 my $mesg = $self->{entry}->update($self->base->ldap); 165 my $mesg = $group->{entry}->update($self->base->ldap); 166 if ($mesg->code) { 167 warn $mesg->error; 168 return; 169 } 155 170 } 156 171 next; -
LATMOS-Accounts/lib/LATMOS/Accounts/Utils.pm
r175 r203 15 15 sub to_ascii { 16 16 my ($text) = @_; 17 return $text unless(defined($text)); 17 18 utf8::decode($text) unless(utf8::is_utf8($text)); 18 19 $text =~ tr/uà âÀÃÃÃçéÚêëÃÃÃÃïîÃÃöÎÃÃÌûÃÃ/uaaaAAAceeeeEEEEiiIIooOOuuUU/;
Note: See TracChangeset
for help on using the changeset viewer.