RELEASE 0.9.2

This commit is contained in:
Deon George
2009-06-30 18:09:20 +10:00
parent 082c6b5fee
commit 92be67a1bf
88 changed files with 9889 additions and 2168 deletions

View File

@@ -25,7 +25,7 @@ if( $step == 1 )
<form action="creation_template.php" method="post" name="creation_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']; ?>" />
<input type="hidden" name="template" value="<?php echo htmlspecialchars( $_POST['template'] ); ?>" />
<table class="create">
<tr>
@@ -41,14 +41,27 @@ if( $step == 1 )
<td class="heading">ObjectClass(es):</td>
<td>
<select name="object_classes[]" multiple size="15">
<?php foreach( $oclasses as $oclass => $attrs ) { ?>
<option value="<?php echo htmlspecialchars($oclass); ?>">
<?php echo htmlspecialchars($attrs['name']); ?>
<?php foreach( $oclasses as $name => $oclass ) { ?>
<option value="<?php echo htmlspecialchars($name); ?>">
<?php echo htmlspecialchars($oclass->getName()); ?>
</option>
<?php } ?>
</select>
</td>
</tr>
<?php if( show_hints() ) { ?>
<tr>
<td></td>
<td>
<small>
<img src="images/light.png" />Hint: You must choose at least one <b>structural</b> objectClass
</small>
<br />
</td>
</tr>
<?php } ?>
<tr>
<td></td>
<td><input type="submit" value="Proceed >>" /></td>
@@ -74,14 +87,16 @@ if( $step == 2 )
// build a list of required attributes:
$dn = $rdn . ',' . $container;
//$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'] );
foreach( $oclasses as $oclass_name ) {
if( isset( $schema_oclasses[ strtolower( $oclass_name ) ] ) )
$oclass = $schema_oclasses[ strtolower( $oclass_name ) ];
else
continue;
$required_attrs = array_merge( $required_attrs, $oclass->getMustAttrNames( $oclasses ) );
$all_attrs = array_merge( $oclass->getMustAttrNames(), $oclass->getMayAttrNames( $oclasses ) );
}
$required_attrs = array_unique( $required_attrs );
@@ -111,7 +126,7 @@ if( $step == 2 )
$attr_select_html .= "<option value=\"$a\">$attr_display</option>\n";
}
$binary_select_html = "";
$binary_attr_select_html = "";
if( count( $binary_attrs ) > 0 ) {
foreach( $binary_attrs as $a ) {
if( isset( $friendly_attrs[ strtolower( $a ) ] ) ) {
@@ -200,8 +215,8 @@ if( $step == 2 )
<?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 ) { ?>
<?php for( $k=$i; $k<$i+count($binary_attrs); $k++ ) { $attr = $binary_attrs[$k-$i]; ?>
<?php if( $k % 2 == 0 ) { ?>
<tr class="row1">
<?php } else { ?>
<tr class="row2">

View File

@@ -10,9 +10,7 @@ $container = $_POST['container'];
$server_id = $_POST['server_id'];
// Unique to this template
$step = $_POST['step'];
if( ! $step )
$step = 1;
$step = isset( $_POST['step'] ) ? $_POST['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." );
@@ -56,7 +54,7 @@ function autoFillCommonName( form )
<form action="creation_template.php" method="post" id="address_form" name="address_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']; ?>" />
<input type="hidden" name="template" value="<?php echo htmlspecialchars( $_POST['template'] ); ?>" />
<center>
<table class="confirm">

View File

@@ -7,9 +7,9 @@ $container = $_POST['container'];
$server_id = $_POST['server_id'];
// Unique to this template
$step = $_POST['step'];
if( ! $step )
$step = 1;
$step = 1;
if( isset($_POST['step']) )
$step = $_POST['step'];
check_server_id( $server_id ) or die( "Bad server_id: " . htmlspecialchars( $server_id ) );
have_auth_info( $server_id ) or die( "Not enough information to login to server. Please check your configuration." );
@@ -23,7 +23,7 @@ if( ! $step )
<form action="creation_template.php" method="post" name="dns_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']; ?>" />
<input type="hidden" name="template" value="<?php echo htmlspecialchars( $_POST['template'] ); ?>" />
<center>
<table class="confirm">

View File

@@ -8,9 +8,9 @@ $server_id = $_POST['server_id'];
// Unique to this template
$step = $_POST['step'];
if( ! $step )
$step = 1;
$step = 1;
if( isset($_POST['step']) )
$step = $_POST['step'];
// A little config for this template
$default_gid_number = 30000;
@@ -30,7 +30,7 @@ have_auth_info( $server_id ) or pla_error( "Not enough information to login to s
<form action="creation_template.php" method="post" name="machine_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']; ?>" />
<input type="hidden" name="template" value="<?php echo htmlspecialchars( $_POST['template'] ); ?>" />
<center>
<table class="confirm">

View File

@@ -7,9 +7,9 @@ $container = $_POST['container'];
$server_id = $_POST['server_id'];
// Unique to this template
$step = $_POST['step'];
if( ! $step )
$step = 1;
$step = 1;
if( isset($_POST['step']) )
$step = $_POST['step'];
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." );
@@ -23,7 +23,7 @@ have_auth_info( $server_id ) or pla_error( "Not enough information to login to s
<form action="creation_template.php" method="post" name="ou_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']; ?>" />
<input type="hidden" name="template" value="<?php echo htmlspecialchars( $_POST['template'] ); ?>" />
<center>
<table class="confirm">

View File

@@ -9,9 +9,9 @@ $server_id = $_POST['server_id'];
// Change this to suit your needs
$default_number_of_users = 10;
$step = $_POST['step'];
if( ! $step )
$step = 1;
$step = 1;
if( isset($_POST['step']) )
$step = $_POST['step'];
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." );
@@ -88,7 +88,7 @@ have_auth_info( $server_id ) or pla_error( "Not enough information to login to s
<!-- 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="vals[]" value="<?php echo htmlspecialchars($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 ) { ?>

View File

@@ -10,10 +10,9 @@
// Common to all templates
$server_id = $_POST['server_id'];
// Unique to this template
$step = $_POST['step'];
if( ! $step )
$step = 1;
$step = 1;
if( isset($_POST['step']) )
$step = $_POST['step'];
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." );
@@ -68,7 +67,7 @@
<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']; ?>" />
<input type="hidden" name="template" value="<?php echo htmlspecialchars( $_POST['template'] ); ?>" />
<center>
<table class="confirm">
@@ -174,17 +173,17 @@
<?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'] ) );
$user_name = trim( $_POST['user_name'] );
$first_name = trim( $_POST['first_name'] );
$last_name = trim( $_POST['last_name'] );
$password1 = $_POST['user_pass1'];
$password2 = $_POST['user_pass2'];
$encryption = $_POST['encryption'];
$login_shell = trim( $_POST['login_shell'] );
$uid_number = trim( $_POST['uid_number'] );
$gid_number = trim( $_POST['group'] );
$container = trim( $_POST['container'] );
$home_dir = trim( $_POST['home_dir'] );
$samba_sid = trim( stripslashes( $_POST['samba_sid'] ) );

View File

@@ -2,17 +2,37 @@
require 'common.php';
/*
* TODO Add a check: If the server is configured to use auto_uid_numbers AND the
* mechanism is uidpool, update the uidpool when creating the entry. This may
* need to be added to create.php (scary). Perahsp this could be a candidate
* for the post-update event handler.
*/
// customize this to your needs
$default_container = "ou=People";
// Common to all templates
$container = $_POST['container'];
$server_id = $_POST['server_id'];
$container = isset( $_POST['container'] ) ? $_POST['container'] : null;
$server_id = isset( $_POST['server_id'] ) ? $_POST['server_id'] : false;
// Modify this array and add/remove the corresponding attributes below
$object_classes = array( 'top', 'person', 'posixAccount', 'shadowAccount' );
// A list of default attributes/values to create with this new user
$default_attributes = array(
'shadowMin' => -1,
'shadowMax' => 999999,
'shadowWarning' => 7,
'shadowInactive' => -1,
'shadowExpire' => -1,
'shadowFlag' => 0
);
// Unique to this template
$step = $_POST['step'];
if( ! $step )
$step = 1;
$step = 1;
if( isset($_POST['step']) )
$step = $_POST['step'];
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." );
@@ -46,7 +66,7 @@ function autoFillUserName( form )
}
/*
* Pipulates the home directory field based on the username provided
* Populates the home directory field based on the username provided
*/
function autoFillHomeDir( form )
{
@@ -65,14 +85,20 @@ function autoFillHomeDir( form )
-->
</script>
<center><h2>New User Account</h2></center>
<center>
<h2 style="margin:0px">New User Account</h2>
<?php if( show_hints() ) { ?>
<small><img src="images/light.png" />Hint: To customize this template, edit the file templates/creation/new_user_template.php<br />
<?php } ?>
<br />
</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']; ?>" />
<input type="hidden" name="template" value="<?php echo htmlspecialchars( $_POST['template'] ); ?>" />
<center>
<table class="confirm">
@@ -110,8 +136,10 @@ function autoFillHomeDir( form )
<td><select name="encryption">
<option>clear</option>
<option>md5</option>
<option>smd5</option>
<option>crypt</option>
<option>sha</option>
<option>ssha</option>
</select></td>
</tr>
<tr class="spacer"><td colspan="3"></tr>
@@ -141,10 +169,18 @@ function autoFillHomeDir( form )
<?php draw_chooser_link( 'user_form.container' ); ?></td>
</td>
</tr>
<?php
// determining the next available uidNumber may take a moment.
// give them something to look at in the mean time
flush();
?>
<tr>
<td></td>
<td class="heading">UID Number:</td>
<td><input type="text" name="uid_number" value="" /></td>
<?php $next_uid_number = get_next_uid_number( $server_id ); ?>
<td><input type="text" name="uid_number" value="<?php echo $next_uid_number ?>" />
<?php if( false !== $next_uid_number ) echo "<small>(automatically determined)</small>"; ?>
</td>
</tr>
<tr>
<td></td>
@@ -162,24 +198,24 @@ function autoFillHomeDir( form )
<td><input type="text" name="home_dir" value="/home/" id="home_dir" /></td>
</tr>
<tr>
<td colspan="3"><center><br /><input type="submit" value="Proceed &gt;&gt;" /></td>
<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'] ) );
$user_name = trim( $_POST['user_name'] );
$first_name = trim( $_POST['first_name'] );
$last_name = trim( $_POST['last_name'] );
$password1 = $_POST['user_pass1'];
$password2 = $_POST['user_pass2'];
$encryption = $_POST['encryption'];
$login_shell = trim( $_POST['login_shell'] );
$uid_number = trim( $_POST['uid_number'] );
$gid_number = trim( $_POST['group'] );
$container = trim( $_POST['container'] );
$home_dir = trim( $_POST['home_dir'] );
/* Critical assertions */
$password1 == $password2 or
@@ -202,7 +238,7 @@ function autoFillHomeDir( form )
<input type="hidden" name="new_dn" value="<?php echo htmlspecialchars( 'uid=' . $user_name . ',' . $container ); ?>" />
<!-- ObjectClasses -->
<?php $object_classes = rawurlencode( serialize( array( 'top', 'person', 'posixAccount' ) ) ); ?>
<?php $object_classes = rawurlencode( serialize( $object_classes ) ); ?>
<input type="hidden" name="object_classes" value="<?php echo $object_classes; ?>" />
@@ -224,6 +260,14 @@ function autoFillHomeDir( form )
<input type="hidden" name="attrs[]" value="homeDirectory" />
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($home_dir);?>" />
<?php foreach( $default_attributes as $default_attr => $default_val ) { ?>
<!-- default attribute, auto-added based on $default_attributes array specified in new_user_template.php -->
<input type="hidden" name="attrs[]" value="<?php echo htmlspecialchars($default_attr); ?>" />
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($default_val);?>" />
<?php } ?>
<center>
<table class="confirm">
<tr class="even"><td class="heading">User name:</td><td><b><?php echo htmlspecialchars( $user_name ); ?></b></td></tr>