RELEASE 0.9.1
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
<?php
|
||||
|
||||
require 'config.php';
|
||||
require 'common.php';
|
||||
|
||||
// Common to all templates
|
||||
$rdn = stripslashes( $_POST['rdn'] );
|
||||
$container = stripslashes( $_POST['container'] );
|
||||
$rdn = isset( $_POST['rdn'] ) ? $_POST['rdn'] : null;
|
||||
$container = $_POST['container'];
|
||||
$server_id = $_POST['server_id'];
|
||||
|
||||
// Unique to this template
|
||||
$step = $_POST['step'];
|
||||
$step = isset( $_POST['step'] ) ? $_POST['step'] : null;
|
||||
if( ! $step )
|
||||
$step = 1;
|
||||
|
||||
@@ -34,7 +34,7 @@ if( $step == 1 )
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="heading">Container:</td>
|
||||
<td><input type="text" name="container" size="40" value="<?php echo htmlspecialchars($container); ?>" />
|
||||
<td><input type="text" name="container" size="40" value="<?php echo htmlspecialchars( $container ); ?>" />
|
||||
<?php draw_chooser_link( 'creation_form.container' ); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -74,32 +74,55 @@ if( $step == 2 )
|
||||
|
||||
// build a list of required attributes:
|
||||
$dn = $rdn . ',' . $container;
|
||||
$schema = get_schema( $server_id );
|
||||
$attrs = $schema['attrs'];
|
||||
//$attrs = get_schema_attributes( $server_id );
|
||||
$schema_oclasses = get_schema_objectclasses( $server_id );
|
||||
$required_attrs = array();
|
||||
$all_attrs = array();
|
||||
foreach( $oclasses as $oclass ) {
|
||||
$required_attrs = array_merge( $required_attrs, $schema['oclasses'][strtolower($oclass)]['must_attrs'] );
|
||||
$all_attrs = array_merge( $all_attrs, $schema['oclasses'][strtolower($oclass)]['must_attrs'],
|
||||
$schema['oclasses'][strtolower($oclass)]['may_attrs'] );
|
||||
$required_attrs = array_merge( $required_attrs, $schema_oclasses[strtolower($oclass)]['must_attrs'] );
|
||||
$all_attrs = array_merge( $all_attrs, $schema_oclasses[strtolower($oclass)]['must_attrs'],
|
||||
$schema_oclasses[strtolower($oclass)]['may_attrs'] );
|
||||
}
|
||||
|
||||
$required_attrs = array_unique( $required_attrs );
|
||||
$all_attrs = array_unique( $all_attrs );
|
||||
sort( $required_attrs );
|
||||
sort( $all_attrs );
|
||||
|
||||
// remove binary attributes and add them to the binary_attrs array
|
||||
$binary_attrs = array();
|
||||
foreach( $all_attrs as $i => $attr_name ) {
|
||||
if( is_attr_binary( $server_id, $attr_name ) ) {
|
||||
unset( $all_attrs[ $i ] );
|
||||
$binary_attrs[] = $attr_name;
|
||||
}
|
||||
}
|
||||
|
||||
$attr_select_html = "";
|
||||
foreach( $all_attrs as $a ) {
|
||||
// is there a user-friendly translation available for this attribute?
|
||||
if( isset( $friendly_attrs[ strtolower( $a ) ] ) ) {
|
||||
$attr_display = htmlspecialchars( $friendly_attrs[ strtolower( $a ) ] ) . " (" .
|
||||
htmlspecialchars($a) . ")";
|
||||
htmlspecialchars($a) . ")";
|
||||
} else {
|
||||
$attr_display = htmlspecialchars( $a );
|
||||
}
|
||||
|
||||
echo $attr_display;
|
||||
$attr_select_html .= "<option>$attr_display</option>\n";
|
||||
$attr_select_html .= "<option value=\"$a\">$attr_display</option>\n";
|
||||
}
|
||||
|
||||
$binary_select_html = "";
|
||||
if( count( $binary_attrs ) > 0 ) {
|
||||
foreach( $binary_attrs as $a ) {
|
||||
if( isset( $friendly_attrs[ strtolower( $a ) ] ) ) {
|
||||
$attr_display = htmlspecialchars( $friendly_attrs[ strtolower( $a ) ] ) . " (" .
|
||||
htmlspecialchars( $a ) . ")";
|
||||
} else {
|
||||
$attr_display = htmlspecialchars( $a );
|
||||
}
|
||||
|
||||
$binary_attr_select_html .= "<option>$attr_display</option>\n";
|
||||
}
|
||||
}
|
||||
|
||||
// add the required attribute based on the RDN provided by the user
|
||||
@@ -107,29 +130,19 @@ if( $step == 2 )
|
||||
// in the list of required attributes.
|
||||
$rdn_attr = trim( substr( $rdn, 0, strpos( $rdn, '=' ) ) );
|
||||
$rdn_value = trim( substr( $rdn, strpos( $rdn, '=' ) + 1 ) );
|
||||
if( ! in_array( $rdn_attr, $required_attrs ) )
|
||||
if( in_array( $rdn_attr, $all_attrs ) && ! in_array( $rdn_attr, $required_attrs ) )
|
||||
$required_attrs[] = $rdn_attr;
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<h4>Step 2 of 2: Specify attributes and values</h4>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td style="padding-right:10px">
|
||||
<small>Creating entry with <acronym title="Distinguished Name">DN</acronym>:
|
||||
<b><?php echo htmlspecialchars( $dn ); ?></b></small></td>
|
||||
<small><b>Instructions</b>:
|
||||
Enter values for the <?php echo count($required_attrs); ?> required attributes.<br/>
|
||||
Then specify any optional attributes. <?php if( count( $binary_attrs ) > 0 ) { ?>
|
||||
Finally, you may<br />specify optional binary attributes from a file if needed. <?php } ?>
|
||||
</small>
|
||||
|
||||
<td>
|
||||
<small><b>Instrucions</b>: Enter values for the <?php echo count($required_attrs); ?>
|
||||
required attributes. Then create any optional attributes. You
|
||||
can specify multi-valued attributes as well.</small><br />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<form action="create.php" method="post">
|
||||
<form action="create.php" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="step" value="2" />
|
||||
<input type="hidden" name="new_dn" value="<?php echo htmlspecialchars( $dn ); ?>" />
|
||||
<input type="hidden" name="new_rdn" value="<?php echo htmlspecialchars( $rdn ); ?>" />
|
||||
@@ -139,7 +152,11 @@ if( $step == 2 )
|
||||
|
||||
<table class="edit_dn" cellspacing="0">
|
||||
<tr><th colspan="2">Required Attributes</th></tr>
|
||||
<?php foreach( $required_attrs as $count => $attr ) { ?>
|
||||
<?php if( count( $required_attrs ) == 0 ) {
|
||||
echo "<tr class=\"row1\"><td colspan=\"2\"><center>(none)</center></td></tr>\n";
|
||||
} else
|
||||
|
||||
foreach( $required_attrs as $count => $attr ) { ?>
|
||||
<?php if( $count % 2 == 0 ) { ?>
|
||||
<tr class="row1">
|
||||
<?php } else { ?>
|
||||
@@ -150,7 +167,7 @@ if( $step == 2 )
|
||||
// is there a user-friendly translation available for this attribute?
|
||||
if( isset( $friendly_attrs[ strtolower( $attr ) ] ) ) {
|
||||
$attr_display = "<acronym title=\"Alias for " . htmlspecialchars($attr) . "\">" .
|
||||
htmlspecialchars( $friendly_attrs[ strtolower( $attr ) ] ) . "</acronym>";
|
||||
htmlspecialchars( $friendly_attrs[ strtolower( $attr ) ] ) . "</acronym>";
|
||||
} else {
|
||||
$attr_display = htmlspecialchars( $attr );
|
||||
}
|
||||
@@ -158,7 +175,7 @@ if( $step == 2 )
|
||||
echo $attr_display;
|
||||
|
||||
?></b></td>
|
||||
<td class="val"><input type="text"
|
||||
<td class="val"><input type="<?php echo (is_attr_binary( $server_id, $attr ) ? "file" : "text"); ?>"
|
||||
name="required_attrs[<?php echo htmlspecialchars($attr); ?>]"
|
||||
value="<?php echo $attr == $rdn_attr ? $rdn_value : '' ?>" size="40" />
|
||||
</tr>
|
||||
@@ -166,16 +183,33 @@ if( $step == 2 )
|
||||
|
||||
<tr><th colspan="2">Optional Attributes</th></tr>
|
||||
|
||||
<?php for($i=0; $i<10; $i++ ) { ?>
|
||||
<?php if( count( $all_attrs ) == 0 ) { ?>
|
||||
<tr class="row1"><td colspan="2"><center>(none)</center></td></tr>
|
||||
<?php } else { ?>
|
||||
<?php for($i=0; $i<min( count( $all_attrs ), 10 ); $i++ ) { ?>
|
||||
<?php if( $i % 2 == 0 ) { ?>
|
||||
<tr class="row1">
|
||||
<?php } else { ?>
|
||||
<tr class="row2">
|
||||
<?php } ?>
|
||||
<td class="attr"><select name="attrs[<?php echo $i; ?>]"><?php echo $attr_select_html; ?></select></td>
|
||||
<td class="val"><input type="text" name="vals[<?php echo $i; ?>]" value="" size="40" />
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
|
||||
<?php if( count( $binary_attrs ) > 0 ) { ?>
|
||||
<tr><th colspan="2">Optional Binary Attributes</th></tr>
|
||||
<?php for( $k=$i; $k<$i+count($binary_attrs); $k++ ) { $attr = $binary_attrs[$k]; ?>
|
||||
<?php if( $i % 2 == 0 ) { ?>
|
||||
<tr class="row1">
|
||||
<?php } else { ?>
|
||||
<tr class="row2">
|
||||
<?php } ?>
|
||||
<td class="attr"><select name="attrs[<?php echo $i; ?>]"><?php echo $attr_select_html; ?></select></td>
|
||||
<td class="val"><input type="text" name="vals[<?php echo $i; ?>]" value="" size="40" />
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<td class="attr"><select name="attrs[<?php echo $k; ?>]"><?php echo $binary_attr_select_html;?></select></td>
|
||||
<td class="val"><input type="file" name="vals[<?php echo $k; ?>]" value="" size="40" />
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</table>
|
||||
|
||||
<center>
|
||||
|
@@ -1,12 +1,12 @@
|
||||
<?php
|
||||
|
||||
require 'config.php';
|
||||
require 'common.php';
|
||||
|
||||
// customize this to your needs
|
||||
$default_container = "ou=Addresses";
|
||||
|
||||
// Common to all templates
|
||||
$container = stripslashes( $_POST['container'] );
|
||||
$container = $_POST['container'];
|
||||
$server_id = $_POST['server_id'];
|
||||
|
||||
// Unique to this template
|
||||
@@ -65,8 +65,10 @@ function autoFillCommonName( form )
|
||||
<td><img src="images/uid.png" /></td>
|
||||
<td class="heading">Name:</td>
|
||||
<td>
|
||||
<input type="text" name="first_name" id="first_name" value="first" onChange="autoFillCommonName(this.form)" />
|
||||
<input type="text" name="last_name" id="last_name" value="last" onChange="autoFillCommonName(this.form)" />
|
||||
<input type="text" name="first_name"
|
||||
id="first_name" value="first" onChange="autoFillCommonName(this.form)" />
|
||||
<input type="text" name="last_name"
|
||||
id="last_name" value="last" onChange="autoFillCommonName(this.form)" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -136,18 +138,18 @@ function autoFillCommonName( form )
|
||||
|
||||
<?php } elseif( $step == 2 ) {
|
||||
|
||||
$common_name = trim( stripslashes( $_POST['common_name'] ) );
|
||||
$first_name = trim( stripslashes( $_POST['first_name'] ) );
|
||||
$last_name = trim( stripslashes( $_POST['last_name'] ) );
|
||||
$organization = trim( stripslashes( $_POST['organization'] ) );
|
||||
$city = trim( stripslashes( $_POST['city'] ) );
|
||||
$postal_code = trim( stripslashes( $_POST['postal_code'] ) );
|
||||
$street = trim( stripslashes( $_POST['street'] ) );
|
||||
$telephone_number = trim( stripslashes( $_POST['telephone_number'] ) );
|
||||
$fax_number = trim( stripslashes( $_POST['fax_number'] ) );
|
||||
$mobile_number = trim( stripslashes( $_POST['mobile_number'] ) );
|
||||
$email_address = trim( stripslashes( $_POST['email_address'] ) );
|
||||
$container = trim( stripslashes( $_POST['container'] ) );
|
||||
$common_name = trim( $_POST['common_name'] );
|
||||
$first_name = trim( $_POST['first_name'] );
|
||||
$last_name = trim( $_POST['last_name'] );
|
||||
$organization = trim( $_POST['organization'] );
|
||||
$city = trim( $_POST['city'] );
|
||||
$postal_code = trim( $_POST['postal_code'] );
|
||||
$street = trim( $_POST['street'] );
|
||||
$telephone_number = trim( $_POST['telephone_number'] );
|
||||
$fax_number = trim( $_POST['fax_number'] );
|
||||
$mobile_number = trim( $_POST['mobile_number'] );
|
||||
$email_address = trim( $_POST['email_address'] );
|
||||
$container = trim( $_POST['container'] );
|
||||
|
||||
/* Critical assertions */
|
||||
0 != strlen( $common_name ) or
|
||||
@@ -191,20 +193,60 @@ function autoFillCommonName( form )
|
||||
|
||||
<center>
|
||||
<table class="confirm">
|
||||
<tr class="even"><td class="heading">Common name:</td><td><b><?php echo htmlspecialchars( $common_name ); ?></b></td></tr>
|
||||
<tr class="odd"><td class="heading">First name:</td><td><b><?php echo htmlspecialchars( $first_name ); ?></b></td></tr>
|
||||
<tr class="even"><td class="heading">Last name:</td><td><b><?php echo htmlspecialchars( $last_name ); ?></b></td></tr>
|
||||
<tr class="odd"><td class="heading">Organization:</td><td><?php echo htmlspecialchars( $organization ); ?></td></tr>
|
||||
<tr class="even"><td class="heading">City:</td><td><?php echo htmlspecialchars( $city ); ?></td></tr>
|
||||
<tr class="odd"><td class="heading">Postal code:</td><td><?php echo htmlspecialchars( $postal_code ); ?></td></tr>
|
||||
<tr class="even"><td class="heading">Street:</td><td><?php echo htmlspecialchars( $street ); ?></td></tr>
|
||||
<tr class="odd"><td class="heading">Work phone:</td><td><?php echo htmlspecialchars( $telephone_number ); ?></td></tr>
|
||||
<tr class="even"><td class="heading">Fax:</td><td><?php echo htmlspecialchars( $fax_number ); ?></td></tr>
|
||||
<tr class="odd"><td class="heading">Mobile:</td><td><?php echo htmlspecialchars( $mobile_number ); ?></td></tr>
|
||||
<tr class="even"><td class="heading">Email:</td><td><?php echo htmlspecialchars( $email_address ); ?></td></tr>
|
||||
<tr class="odd"><td class="heading">Container:</td><td><?php echo htmlspecialchars( $container ); ?></td></tr>
|
||||
<tr class="even">
|
||||
<td class="heading">Common name:</td>
|
||||
<td><b><?php echo htmlspecialchars( $common_name ); ?></b></td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td class="heading">First name:</td>
|
||||
<td><b><?php echo htmlspecialchars( $first_name ); ?></b></td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td class="heading">Last name:</td>
|
||||
<td><b><?php echo htmlspecialchars( $last_name ); ?></b></td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td class="heading">Organization:</td>
|
||||
<td><?php echo htmlspecialchars( $organization ); ?></td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td class="heading">City:</td>
|
||||
<td><?php echo htmlspecialchars( $city ); ?></td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td class="heading">Postal code:</td>
|
||||
<td><?php echo htmlspecialchars( $postal_code ); ?></td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td class="heading">Street:</td>
|
||||
<td><?php echo htmlspecialchars( $street ); ?></td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td class="heading">Work phone:</td>
|
||||
<td><?php echo htmlspecialchars( $telephone_number ); ?></td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td class="heading">Fax:</td>
|
||||
<td><?php echo htmlspecialchars( $fax_number ); ?></td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td class="heading">Mobile:</td>
|
||||
<td><?php echo htmlspecialchars( $mobile_number ); ?></td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td class="heading">Email:</td>
|
||||
<td><?php echo htmlspecialchars( $email_address ); ?></td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td class="heading">Container:</td>
|
||||
<td><?php echo htmlspecialchars( $container ); ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
<br /><input type="submit" value="Create Address" />
|
||||
</center>
|
||||
</form>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
require 'config.php';
|
||||
require 'common.php';
|
||||
|
||||
// Common to all templates
|
||||
$container = stripslashes( $_POST['container'] );
|
||||
$container = $_POST['container'];
|
||||
$server_id = $_POST['server_id'];
|
||||
|
||||
// Unique to this template
|
||||
@@ -40,7 +40,7 @@ if( ! $step )
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="heading">Container <acronym title="Distinguished Name">DN</acronym>:</td>
|
||||
<td><input type="text" name="container" size="40" value="<?php echo htmlspecialchars( utf8_decode( $container ) ); ?>" />
|
||||
<td><input type="text" name="container" size="40" value="<?php echo htmlspecialchars( $container ); ?>" />
|
||||
<?php draw_chooser_link( 'dns_form.container' ); ?></td>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -52,9 +52,9 @@ if( ! $step )
|
||||
|
||||
<?php } elseif( $step == 2 ) {
|
||||
|
||||
$dc_name = trim( stripslashes( $_POST['dc_name'] ) );
|
||||
$container = trim( stripslashes( $_POST['container'] ) );
|
||||
$associateddomain = trim( stripslashes( $_POST['associateddomain'] ) );
|
||||
$dc_name = trim( $_POST['dc_name'] );
|
||||
$container = trim( $_POST['container'] );
|
||||
$associateddomain = trim( $_POST['associateddomain'] );
|
||||
|
||||
dn_exists( $server_id, $container ) or
|
||||
pla_error( "The container you specified (" . htmlspecialchars( $container ) . ") does not exist. " .
|
||||
|
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
require 'config.php';
|
||||
require 'common.php';
|
||||
|
||||
// Common to all templates
|
||||
$container = stripslashes( $_POST['container'] );
|
||||
$container = $_POST['container'];
|
||||
$server_id = $_POST['server_id'];
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ have_auth_info( $server_id ) or pla_error( "Not enough information to login to s
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="heading">Container:</td>
|
||||
<td><input type="text" size="40" name="container" value="<?php echo htmlspecialchars( utf8_decode( $container ) ); ?>" />
|
||||
<td><input type="text" size="40" name="container" value="<?php echo htmlspecialchars( $container ); ?>" />
|
||||
<?php draw_chooser_link( 'machine_form.container' ); ?></td>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -67,7 +67,7 @@ have_auth_info( $server_id ) or pla_error( "Not enough information to login to s
|
||||
<li>gidNumber <b><?php echo htmlspecialchars( $default_gid_number ); ?></b></li>
|
||||
<li>acctFlags <b><?php echo str_replace(' ', " ", htmlspecialchars($default_acct_flags)); ?></b></li>
|
||||
<li>cn <b><?php echo htmlspecialchars($default_cn); ?></b></li>
|
||||
<li>in container <b><?php echo htmlspecialchars($container); ?></b></li>
|
||||
<li>in container <b><?php echo htmlspecialchars( $container ); ?></b></li>
|
||||
</ul>
|
||||
To change these values, edit the template file:
|
||||
<code>templates/creation/new_nt_machine.php</code><br />
|
||||
@@ -81,8 +81,8 @@ have_auth_info( $server_id ) or pla_error( "Not enough information to login to s
|
||||
|
||||
<?php } elseif( $step == 2 ) {
|
||||
|
||||
$machine_name = trim( stripslashes( $_POST['machine_name'] ) );
|
||||
$uid_number = trim( stripslashes( $_POST['uid_number'] ) );
|
||||
$machine_name = trim( $_POST['machine_name'] );
|
||||
$uid_number = trim( $_POST['uid_number'] );
|
||||
|
||||
dn_exists( $server_id, $container ) or
|
||||
pla_error( "The container you specified (" . htmlspecialchars( $container ) . ") does not exist. " .
|
||||
@@ -94,7 +94,7 @@ have_auth_info( $server_id ) or pla_error( "Not enough information to login to s
|
||||
<input type="hidden" name="new_dn" value="<?php echo htmlspecialchars( 'uid=' . $machine_name . '$,' . $container ); ?>" />
|
||||
|
||||
<!-- ObjectClasses -->
|
||||
<?php $object_classes = rawurlencode( serialize( array( 'top', 'sambaAccount', 'posixAccount' ) ) ); ?>
|
||||
<?php $object_classes = rawurlencode( serialize( array( 'top', 'sambaAccount', 'posixAccount', 'account' ) ) ); ?>
|
||||
|
||||
<input type="hidden" name="object_classes" value="<?php echo $object_classes; ?>" />
|
||||
|
||||
|
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
require 'config.php';
|
||||
require 'common.php';
|
||||
|
||||
// Common to all templates
|
||||
$container = stripslashes( $_POST['container'] );
|
||||
$container = $_POST['container'];
|
||||
$server_id = $_POST['server_id'];
|
||||
|
||||
// Unique to this template
|
||||
@@ -35,7 +35,7 @@ have_auth_info( $server_id ) or pla_error( "Not enough information to login to s
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="heading">Container <acronym title="Distinguished Name">DN</acronym>:</td>
|
||||
<td><input type="text" name="container" size="40" value="<?php echo htmlspecialchars( utf8_decode( $container ) ); ?>" />
|
||||
<td><input type="text" name="container" size="40" value="<?php echo htmlspecialchars( $container ); ?>" />
|
||||
<?php draw_chooser_link( 'ou_form.container' ); ?></td>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -47,8 +47,8 @@ have_auth_info( $server_id ) or pla_error( "Not enough information to login to s
|
||||
|
||||
<?php } elseif( $step == 2 ) {
|
||||
|
||||
$ou_name = trim( stripslashes( $_POST['ou_name'] ) );
|
||||
$container = trim( stripslashes( $_POST['container'] ) );
|
||||
$ou_name = trim( $_POST['ou_name'] );
|
||||
$container = trim( $_POST['container'] );
|
||||
|
||||
dn_exists( $server_id, $container ) or
|
||||
pla_error( "The container you specified (" . htmlspecialchars( $container ) . ") does not exist. " .
|
||||
|
117
templates/creation/new_posix_group_template.php
Normal file
117
templates/creation/new_posix_group_template.php
Normal file
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
|
||||
require 'common.php';
|
||||
|
||||
// Common to all templates
|
||||
$container = $_POST['container'];
|
||||
$server_id = $_POST['server_id'];
|
||||
|
||||
// Change this to suit your needs
|
||||
$default_number_of_users = 10;
|
||||
|
||||
$step = $_POST['step'];
|
||||
if( ! $step )
|
||||
$step = 1;
|
||||
|
||||
check_server_id( $server_id ) or pla_error( "Bad server_id: " . htmlspecialchars( $server_id ) );
|
||||
have_auth_info( $server_id ) or pla_error( "Not enough information to login to server. Please check your configuration." );
|
||||
|
||||
?>
|
||||
|
||||
<center><h2>New Posix Group</h2></center>
|
||||
|
||||
<?php if( $step == 1 ) { ?>
|
||||
|
||||
<form action="creation_template.php" method="post" name="posix_group_form">
|
||||
<input type="hidden" name="step" value="2" />
|
||||
<input type="hidden" name="server_id" value="<?php echo $server_id; ?>" />
|
||||
<input type="hidden" name="template" value="<?php echo htmlspecialchars( $_POST['template'] ); ?>" />
|
||||
|
||||
<center>
|
||||
<table class="confirm">
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="heading">Posix Group Name:</td>
|
||||
<td><input type="text" name="posix_group_name" value="" /> <small>(example: MyGroup, do not include "cn=")</small></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="heading"><acronym title="Group Identification">GID</acronym> Number:</td>
|
||||
<td><input type="text" name="gid_number" value="" /> <small>(example: 2000)</small></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="heading">Container <acronym title="Distinguished Name">DN</acronym>:</td>
|
||||
<td><input type="text" name="container" size="40" value="<?php echo htmlspecialchars( $container ); ?>" />
|
||||
<?php draw_chooser_link( 'posix_group_form.container' ); ?></td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="heading">Users:</td>
|
||||
<td><input type="text" name="member_uids[]" value="" /> <small>(example: dsmith)</small><br />
|
||||
<?php for( $i=1; $i<$default_number_of_users; $i++ ) { ?>
|
||||
<input type="text" name="member_uids[]" value="" /><br />
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3"><center><br /><input type="submit" value="Proceed >>" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
|
||||
<?php } elseif( $step == 2 ) {
|
||||
|
||||
$group_name = trim( $_POST['posix_group_name'] );
|
||||
$container = trim( $_POST['container'] );
|
||||
$gid_number = trim( $_POST['gid_number'] );
|
||||
$uids = $_POST['member_uids'];
|
||||
$member_uids = array();
|
||||
foreach( $uids as $uid )
|
||||
if( '' != trim( $uid ) && ! in_array( $uid, $member_uids ) )
|
||||
$member_uids[] = $uid;
|
||||
|
||||
dn_exists( $server_id, $container ) or
|
||||
pla_error( "The container you specified (" . htmlspecialchars( $container ) . ") does not exist. " .
|
||||
"Please go back and try again." );
|
||||
|
||||
?>
|
||||
<form action="create.php" method="post">
|
||||
<input type="hidden" name="server_id" value="<?php echo $server_id; ?>" />
|
||||
<input type="hidden" name="new_dn" value="<?php echo htmlspecialchars( 'cn='.$group_name.','.$container ); ?>" />
|
||||
|
||||
<!-- ObjectClasses -->
|
||||
<?php $object_classes = rawurlencode( serialize( array( 'top', 'posixGroup' ) ) ); ?>
|
||||
|
||||
<input type="hidden" name="object_classes" value="<?php echo $object_classes; ?>" />
|
||||
|
||||
<!-- The array of attributes/values -->
|
||||
<input type="hidden" name="attrs[]" value="cn" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($posix_group_name);?>" />
|
||||
<input type="hidden" name="attrs[]" value="gidNumber" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($gid_number);?>" />
|
||||
<?php foreach( $member_uids as $uid ) { ?>
|
||||
<input type="hidden" name="attrs[]" value="memberUid" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($uid);?>" />
|
||||
<?php } ?>
|
||||
|
||||
<center>
|
||||
Really create this new Posix Group entry?<br />
|
||||
<br />
|
||||
|
||||
<table class="confirm">
|
||||
<tr class="even"><td>Name</td><td><b><?php echo htmlspecialchars($group_name); ?></b></td></tr>
|
||||
<tr class="odd"><td>Container</td><td><b><?php echo htmlspecialchars( $container ); ?></b></td></tr>
|
||||
<tr class="even"><td>gidNumber</td><td><b><?php echo htmlspecialchars( $gid_number ); ?></b></td></tr>
|
||||
<tr class="odd"><td>Member UIDs</td><td><b>
|
||||
<?php foreach( $member_uids as $i => $uid )
|
||||
echo htmlspecialchars($uid) . "<br />"; ?>
|
||||
</b></td></tr>
|
||||
</table>
|
||||
<br /><input type="submit" value="Create Group" />
|
||||
</center>
|
||||
</form>
|
||||
|
||||
<?php } ?>
|
||||
|
276
templates/creation/new_smbuser_template.php
Normal file
276
templates/creation/new_smbuser_template.php
Normal file
@@ -0,0 +1,276 @@
|
||||
<?php
|
||||
require realpath( 'common.php' );
|
||||
|
||||
// customize this to your needs
|
||||
$default_samba_sid = "S-1-5-21-3509297442-4087397136-3591104989";
|
||||
$default_container = "ou=Users";
|
||||
$default_home = "/export/home";
|
||||
$mkntpwdCommand = "./templates/creation/mkntpwd";
|
||||
|
||||
// Common to all templates
|
||||
$server_id = $_POST['server_id'];
|
||||
|
||||
// Unique to this template
|
||||
$step = $_POST['step'];
|
||||
if( ! $step )
|
||||
$step = 1;
|
||||
|
||||
check_server_id( $server_id ) or pla_error( "Bad server_id: " . htmlspecialchars( $server_id ) );
|
||||
have_auth_info( $server_id ) or pla_error( "Not enough information to login to server. Please check your configuration." );
|
||||
?>
|
||||
|
||||
<script language="javascript">
|
||||
<!--
|
||||
function autoFillUserName( form ) {
|
||||
var first_name;
|
||||
var last_name;
|
||||
var user_name;
|
||||
|
||||
first_name = form.first_name.value.toLowerCase();
|
||||
last_name = form.last_name.value.toLowerCase();
|
||||
if( last_name == '' ) {
|
||||
return false;
|
||||
}
|
||||
user_name = first_name.substr( 0,1 ) + last_name;
|
||||
user_name = first_name.substr( 0,8 );
|
||||
|
||||
form.user_name.value = user_name;
|
||||
autoFillHomeDir( form );
|
||||
}
|
||||
function autoFillHomeDir( form ){
|
||||
var user_name;
|
||||
var home_dir;
|
||||
|
||||
user_name = form.user_name.value.toLowerCase();
|
||||
|
||||
home_dir = '<?php echo $default_home; ?>/';
|
||||
home_dir += user_name;
|
||||
form.home_dir.value = home_dir;
|
||||
|
||||
}
|
||||
function autoFillSambaSID( form ){
|
||||
var sambaSID;
|
||||
var uidNumber;
|
||||
|
||||
uidNumber = form.uid_number.value;
|
||||
sambaSID = '<?php echo $default_samba_sid; ?>-'+(2*uidNumber+1000);
|
||||
|
||||
form.samba_sid.value = sambaSID;
|
||||
|
||||
}
|
||||
-->
|
||||
</script>
|
||||
|
||||
<center><h2>New Samba3-User Account</h2></center>
|
||||
|
||||
<?php if( $step == 1 ) { ?>
|
||||
|
||||
<form action="creation_template.php" method="post" id="user_form" name="user_form">
|
||||
<input type="hidden" name="step" value="2" />
|
||||
<input type="hidden" name="server_id" value="<?php echo $server_id; ?>" />
|
||||
<input type="hidden" name="template" value="<?php echo $_POST['template']; ?>" />
|
||||
|
||||
<center>
|
||||
<table class="confirm">
|
||||
<tr class="spacer"><td colspan="3"></tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="heading">UID Number:</td>
|
||||
<td><input type="text" name="uid_number" value="" onChange="autoFillSambaSID(this.form)" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="heading"><i>Samba SID:</i></td>
|
||||
<td><input type="text" name="samba_sid" value="" id="samba_sid" readonly=""/></td>
|
||||
</tr>
|
||||
<tr class="spacer"><td colspan="3"></tr>
|
||||
<tr>
|
||||
<td><img src="images/uid.png" /></td>
|
||||
<td class="heading">First name:</td>
|
||||
<td><input type="text" name="first_name" id="first_name" value="" onChange="autoFillUserName(this.form)" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="heading">Last name:</td>
|
||||
<td><input type="text" name="last_name" id="last_name" value="" onChange="autoFillUserName(this.form)" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="heading">User name:</td>
|
||||
<td><input type="text" name="user_name" id="user_name" value=""
|
||||
onChange="autoFillHomeDir(this.form)" onExit="autoFillHomeDir(this.form)" /></td>
|
||||
</tr>
|
||||
<tr class="spacer"><td colspan="3"></tr>
|
||||
<tr>
|
||||
<td><img src="images/lock.png" /></td>
|
||||
<td class="heading">Password:</td>
|
||||
<td><input type="password" name="user_pass1" value="" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="heading">Password:</td>
|
||||
<td><input type="password" name="user_pass2" value="" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="heading">Encryption:</td>
|
||||
<td>
|
||||
<input type="hidden" name="encryption" value="crypt"/>
|
||||
<i>crypt</i>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="spacer"><td colspan="3"></tr>
|
||||
<tr>
|
||||
<td><img src="images/nt.png" /></td>
|
||||
<td class="heading">Login Shell:</td>
|
||||
<td>
|
||||
<input type="hidden" name="login_shell" value="/bin/csh"/>
|
||||
<i>/bin/csh</i>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="heading">Container:</td>
|
||||
<td><input type="text" name="container" size="40"
|
||||
value="<?php if( isset( $container ) )
|
||||
echo htmlspecialchars( $container );
|
||||
else
|
||||
echo htmlspecialchars( $default_container . ',' . $servers[$server_id]['base'] ); ?>" />
|
||||
<?php draw_chooser_link( 'user_form.container' ); ?></td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="heading">Unix Group:</td>
|
||||
<td><select name="group">
|
||||
<option value="1000">admins (1000)</option>
|
||||
<option value="2000">users (2000)</option>
|
||||
<option value="3000">staff (3000)</option>
|
||||
<option value="5000">guest (5000)</option>
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="heading">Windows Group:</td>
|
||||
<td><select name="sambaPrimaryGroupSID">
|
||||
<option value="S-1-5-32-547">Local Power Users</option>
|
||||
<option value="S-1-5-32-544">Local Administrator</option>
|
||||
<option value="S-1-5-32-545">Local Users</option>
|
||||
<option value="<?php echo $default_samba_sid; ?>-512">Domain Admins</option>
|
||||
<option value="<?php echo $default_samba_sid; ?>-513">Domain Users</option>
|
||||
<option value="<?php echo $default_samba_sid; ?>-514">Domain Guests</option>
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="heading">Home Directory:</td>
|
||||
<td><input type="text" name="home_dir" value="<?php echo $default_home ?>" id="home_dir" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3"><center><br /><input type="submit" value="Proceed >>" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
|
||||
<?php } elseif( $step == 2 ) {
|
||||
|
||||
$user_name = trim( stripslashes( $_POST['user_name'] ) );
|
||||
$first_name = trim( stripslashes( $_POST['first_name'] ) );
|
||||
$last_name = trim( stripslashes( $_POST['last_name'] ) );
|
||||
$password1 = stripslashes( $_POST['user_pass1'] );
|
||||
$password2 = stripslashes( $_POST['user_pass2'] );
|
||||
$encryption = stripslashes( $_POST['encryption'] );
|
||||
$login_shell = trim( stripslashes( $_POST['login_shell'] ) );
|
||||
$uid_number = trim( stripslashes( $_POST['uid_number'] ) );
|
||||
$gid_number = trim( stripslashes( $_POST['group'] ) );
|
||||
$container = trim( stripslashes( $_POST['container'] ) );
|
||||
$home_dir = trim( stripslashes( $_POST['home_dir'] ) );
|
||||
|
||||
$samba_sid = trim( stripslashes( $_POST['samba_sid'] ) );
|
||||
|
||||
/* Critical assertions */
|
||||
$password1 == $password2 or
|
||||
pla_error( "Your passwords don't match. Please go back and try again." );
|
||||
0 != strlen( $uid_number ) or
|
||||
pla_error( "You cannot leave the UID number blank. Please go back and try again." );
|
||||
is_numeric( $uid_number ) or
|
||||
pla_error( "You can only enter numeric values for the UID number field. Please go back and try again." );
|
||||
dn_exists( $server_id, $container ) or
|
||||
pla_error( "The container you specified (" . htmlspecialchars( $container ) . ") does not exist. " .
|
||||
"Please go back and try again." );
|
||||
|
||||
$password = password_hash( $password1, $encryption );
|
||||
|
||||
$sambaPassCommand = $mkntpwdCommand . " " . $password1;
|
||||
$sambaPassCommandOutput = shell_exec($sambaPassCommand);
|
||||
$sambaLMPassword = substr($sambaPassCommandOutput,0,strPos($sambaPassCommandOutput,':'));
|
||||
$sambaNTPassword = substr($sambaPassCommandOutput,strPos($sambaPassCommandOutput,':')+1);
|
||||
?>
|
||||
<center><h3>Confirm account creation:</h3></center>
|
||||
|
||||
<form action="create.php" method="post">
|
||||
<input type="hidden" name="server_id" value="<?php echo $server_id; ?>" />
|
||||
<input type="hidden" name="new_dn" value="<?php echo htmlspecialchars( 'uid=' . $user_name . ',' . $container ); ?>" />
|
||||
|
||||
<!-- ObjectClasses -->
|
||||
<?php $object_classes = rawurlencode( serialize( array( 'top', 'account', 'posixAccount', 'shadowAccount' , 'sambaSamAccount' ) ) ); ?>
|
||||
|
||||
<input type="hidden" name="object_classes" value="<?php echo $object_classes; ?>" />
|
||||
|
||||
<!-- The array of attributes/values -->
|
||||
<input type="hidden" name="attrs[]" value="cn" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($first_name);?>" />
|
||||
<input type="hidden" name="attrs[]" value="displayName" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($first_name . ' ' . $last_name);?>" />
|
||||
<input type="hidden" name="attrs[]" value="gecos" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($first_name . ' ' . $last_name);?>" />
|
||||
<input type="hidden" name="attrs[]" value="gidNumber" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($gid_number);?>" />
|
||||
<input type="hidden" name="attrs[]" value="homeDirectory" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($home_dir);?>" />
|
||||
<input type="hidden" name="attrs[]" value="loginShell" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($login_shell);?>" />
|
||||
<input type="hidden" name="attrs[]" value="sambaAcctFlags" />
|
||||
<input type="hidden" name="vals[]" value="[U ]" />
|
||||
<input type="hidden" name="attrs[]" value="sambaLMPassword" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($sambaLMPassword);?>" />
|
||||
<input type="hidden" name="attrs[]" value="sambaNTPassword" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($sambaNTPassword);?>" />
|
||||
<input type="hidden" name="attrs[]" value="sambaPrimaryGroupSID" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($sambaPrimaryGroupSID);?>" />
|
||||
<input type="hidden" name="attrs[]" value="sambaPwdCanChange" />
|
||||
<input type="hidden" name="vals[]" value="0" />
|
||||
<input type="hidden" name="attrs[]" value="sambaPwdLastSet" />
|
||||
<input type="hidden" name="vals[]" value="0" />
|
||||
<input type="hidden" name="attrs[]" value="sambaPwdMustChange" />
|
||||
<input type="hidden" name="vals[]" value="2147483647" />
|
||||
|
||||
<input type="hidden" name="attrs[]" value="sambaSID" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($samba_sid); ?>" />
|
||||
|
||||
|
||||
<input type="hidden" name="attrs[]" value="shadowLastChange" />
|
||||
<input type="hidden" name="vals[]" value="11778" />
|
||||
<input type="hidden" name="attrs[]" value="uid" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($user_name);?>" />
|
||||
<input type="hidden" name="attrs[]" value="uidNumber" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($uid_number);?>" />
|
||||
<input type="hidden" name="attrs[]" value="userPassword" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($password);?>" />
|
||||
|
||||
<center>
|
||||
<table class="confirm">
|
||||
<tr class="even"><td class="heading">User name:</td><td><b><?php echo htmlspecialchars( $user_name ); ?></b></td></tr>
|
||||
<tr class="odd"><td class="heading">First name:</td><td><b><?php echo htmlspecialchars( $first_name ); ?></b></td></tr>
|
||||
<tr class="even"><td class="heading">Last name:</td><td><b><?php echo htmlspecialchars( $last_name ); ?></b></td></tr>
|
||||
<tr class="odd"><td class="heading">Password:</td><td>[secret]</td></tr>
|
||||
<tr class="even"><td class="heading">Login Shell:</td><td><?php echo htmlspecialchars( $login_shell); ?></td></tr>
|
||||
<tr class="odd"><td class="heading">UID Number:</td><td><?php echo htmlspecialchars( $uid_number ); ?></td></tr>
|
||||
<tr class="even"><td class="heading">GID Number:</td><td><?php echo htmlspecialchars( $gid_number ); ?></td></tr>
|
||||
<tr class="odd"><td class="heading">Container:</td><td><?php echo htmlspecialchars( $container ); ?></td></tr>
|
||||
<tr class="even"><td class="heading">Home dir:</td><td><?php echo htmlspecialchars( $home_dir ); ?></td></tr>
|
||||
</table>
|
||||
<br /><input type="submit" value="Create Account" />
|
||||
</center>
|
||||
|
||||
<?php } ?>
|
@@ -1,12 +1,12 @@
|
||||
<?php
|
||||
|
||||
require 'config.php';
|
||||
require 'common.php';
|
||||
|
||||
// customize this to your needs
|
||||
$default_container = "ou=People";
|
||||
|
||||
// Common to all templates
|
||||
$container = stripslashes( $_POST['container'] );
|
||||
$container = $_POST['container'];
|
||||
$server_id = $_POST['server_id'];
|
||||
|
||||
// Unique to this template
|
||||
|
Reference in New Issue
Block a user