Project

General

Profile

« Previous | Next » 

Revision 8411

Added by Jing Tao about 11 years ago

Add the missed the attriubtes such as uidNumber, gidNumber and et al.

View differences:

src/perl/ldapweb.cgi
1143 1143
    
1144 1144
    ################create an account under tmp subtree 
1145 1145
    
1146
    #get the next avaliable uid number. If it fails, the program will exist.
1147
    my $nextUidNumber = getNextUidNumber($ldapUsername, $ldapPassword);
1148
    if(!$nextUidNumber) {
1149
        print "Content-type: text/html\n\n";
1150
         my $sender;
1151
        $sender = $skinProperties->getProperty("email.recipient") or $sender = $properties->getProperty('email.recipient');
1152
        my $errorMessage = "The Identity Service can't get the next avaliable uid number.  Please try again.  If the issue persists, please contact the administrator - $sender.";
1153
        fullTemplate(['register'], { stage => "register",
1154
                                     allParams => $allParams,
1155
                                     errorMessage => $errorMessage });
1156
        exit(0);
1157
    }
1158
    my $cn = join(" ", $query->param('givenName'), $query->param('sn')); 
1146 1159
    #generate a randomstr for matching the email.
1147 1160
    my $randomStr = getRandomPassword(16);
1148 1161
    # Create a hashed version of the password
1149 1162
    my $shapass = createSeededPassHash($query->param('userPassword'));
1150 1163
    my $additions = [ 
1151 1164
                'uid'   => $query->param('uid'),
1152
                'cn'   => join(" ", $query->param('givenName'), 
1153
                                    $query->param('sn')),
1165
                'cn'   => $cn,
1154 1166
                'sn'   => $query->param('sn'),
1155 1167
                'givenName'   => $query->param('givenName'),
1156 1168
                'mail' => $query->param('mail'),
1157 1169
                'userPassword' => $shapass,
1158 1170
                'employeeNumber' => $randomStr,
1171
                'uidNumber' => $nextUidNumber,
1172
                'gidNumber' => $nextUidNumber,
1173
                'loginShell' => '/sbin/nologin',
1174
                'homeDirectory' => '/dev/null',
1159 1175
                'objectclass' => ['top', 'person', 'organizationalPerson', 
1160
                                'inetOrgPerson', 'uidObject' ],
1176
                                'inetOrgPerson', 'posixAccount', 'shadowAccount' ],
1161 1177
                $organization   => $organizationName
1162 1178
                ];
1179
    my $gecos;
1163 1180
    if (defined($query->param('telephoneNumber')) && 
1164 1181
                $query->param('telephoneNumber') &&
1165 1182
                ! $query->param('telephoneNumber') =~ /^\s+$/) {
1166 1183
                $$additions[$#$additions + 1] = 'telephoneNumber';
1167 1184
                $$additions[$#$additions + 1] = $query->param('telephoneNumber');
1185
                $gecos = $cn . ',,'. $query->param('telephoneNumber'). ',';
1186
    } else {
1187
        $gecos = $cn . ',,,';
1168 1188
    }
1189
    
1190
    $$additions[$#$additions + 1] = 'gecos';
1191
    $$additions[$#$additions + 1] = $gecos;
1192
    
1169 1193
    if (defined($query->param('title')) && 
1170 1194
                $query->param('title') &&
1171 1195
                ! $query->param('title') =~ /^\s+$/) {
......
1185 1209
    
1186 1210
    my $overrideURL;
1187 1211
    $overrideURL = $skinProperties->getProperty("email.overrideURL");
1188
    debug("the overrideURL is " . $overrideURL);
1212
    debug("the overrideURL is $overrideURL");
1189 1213
    if (defined($overrideURL) && !($overrideURL eq '')) {
1190 1214
    	$link = $serverUrl . $overrideURL . $link;
1191 1215
    } else {
......
1560 1584
    my $uid_attribute_name = $properties->getProperty('ldap.nextuid.storing.attributename');
1561 1585
    my $maxAttempt = $properties->getProperty('ldap.nextuid.maxattempt');
1562 1586
    
1563
    my $ldapUsername = $ldapConfig->{'unaffiliated'}{'user'};
1564
    my $ldapPassword = $ldapConfig->{'unaffiliated'}{'password'};
1587
    my $ldapUsername = shift;
1588
    my $ldapPassword = shift;
1565 1589
    
1566
    my $realUidNumber="";
1567
    my $uidNumber="";
1590
    my $realUidNumber;
1591
    my $uidNumber;
1568 1592
    my $entry;
1569 1593
    my $mesg;
1570 1594
    my $ldap;

Also available in: Unified diff