added getAccountContainer()

This commit is contained in:
Roland Gruber 2007-10-03 18:02:10 +00:00
parent b336f2f7b3
commit 79307debea
14 changed files with 166 additions and 147 deletions

View File

@ -9,6 +9,10 @@ Style changes:
- "fieldset.<type>edit fieldset" and "fieldset.<type>edit fieldset fieldset" were removed. - "fieldset.<type>edit fieldset" and "fieldset.<type>edit fieldset fieldset" were removed.
- "table.<type>list input" changed to "table.<type>list input,select" - "table.<type>list input" changed to "table.<type>list input,select"
baseModule:
- The class variable $base is no longer visible in child classes. Please use
$this->getAccountContainer() to access the accountContainer object.
1.3.0 -> 2.0.0 1.3.0 -> 2.0.0

View File

@ -52,7 +52,7 @@ abstract class baseModule {
protected $selfServiceSettings; protected $selfServiceSettings;
/** name of parent accountContainer ($_SESSION[$base]) */ /** name of parent accountContainer ($_SESSION[$base]) */
protected $base; private $base;
/** contains all ldap attributes which should be written */ /** contains all ldap attributes which should be written */
protected $attributes; protected $attributes;
@ -748,6 +748,21 @@ abstract class baseModule {
// needs to be implemented by the subclasses, if needed // needs to be implemented by the subclasses, if needed
return array(); return array();
} }
/**
* Returns the accountContainer object.
*
* @return accountContainer accountContainer object
*
*/
protected function getAccountContainer() {
if (isset($this->base) && isset($_SESSION[$this->base])) {
return $_SESSION[$this->base];
}
else {
return null;
}
}
} }

View File

@ -151,9 +151,9 @@ class account extends baseModule {
* @return string status ("enabled", "disabled", "hidden") * @return string status ("enabled", "disabled", "hidden")
*/ */
function getButtonStatus() { function getButtonStatus() {
if (!$_SESSION[$this->base]->isNewAccount) { if (!$this->getAccountContainer()->isNewAccount) {
// check if account is based on our object class // check if account is based on our object class
$objectClasses = $_SESSION[$this->base]->attributes_orig['objectClass']; $objectClasses = $this->getAccountContainer()->attributes_orig['objectClass'];
if (is_array($objectClasses) && !in_array('account', $objectClasses)) { if (is_array($objectClasses) && !in_array('account', $objectClasses)) {
return "disabled"; return "disabled";
} }
@ -171,11 +171,11 @@ class account extends baseModule {
*/ */
function save_attributes() { function save_attributes() {
// skip saving if account is based on another structural object class // skip saving if account is based on another structural object class
if (!$_SESSION[$this->base]->isNewAccount && !in_array('account', $_SESSION[$this->base]->attributes_orig['objectClass'])) { if (!$this->getAccountContainer()->isNewAccount && !in_array('account', $this->getAccountContainer()->attributes_orig['objectClass'])) {
return array(); return array();
} }
// Get easy attributes // Get easy attributes
$return = $_SESSION[$this->base]->save_module_attributes($this->attributes, $this->orig); $return = $this->getAccountContainer()->save_module_attributes($this->attributes, $this->orig);
// Return attributes // Return attributes
return $return; return $return;
} }

View File

@ -410,9 +410,9 @@ class inetOrgPerson extends baseModule {
* @return boolean true, if all is ok * @return boolean true, if all is ok
*/ */
function module_complete() { function module_complete() {
if (!$_SESSION[$this->base]->isNewAccount) { if (!$this->getAccountContainer()->isNewAccount) {
// check if account is based on our object class // check if account is based on our object class
$objectClasses = $_SESSION[$this->base]->attributes_orig['objectClass']; $objectClasses = $this->getAccountContainer()->attributes_orig['objectClass'];
if (is_array($objectClasses) && !in_array('inetOrgPerson', $objectClasses)) { if (is_array($objectClasses) && !in_array('inetOrgPerson', $objectClasses)) {
return true; return true;
} }
@ -427,9 +427,9 @@ class inetOrgPerson extends baseModule {
* @return string status ("enabled", "disabled", "hidden") * @return string status ("enabled", "disabled", "hidden")
*/ */
function getButtonStatus() { function getButtonStatus() {
if (!$_SESSION[$this->base]->isNewAccount) { if (!$this->getAccountContainer()->isNewAccount) {
// check if account is based on our object class // check if account is based on our object class
$objectClasses = $_SESSION[$this->base]->attributes_orig['objectClass']; $objectClasses = $this->getAccountContainer()->attributes_orig['objectClass'];
if (is_array($objectClasses) && !in_array('inetOrgPerson', $objectClasses)) { if (is_array($objectClasses) && !in_array('inetOrgPerson', $objectClasses)) {
return "disabled"; return "disabled";
} }
@ -447,32 +447,32 @@ class inetOrgPerson extends baseModule {
*/ */
function save_attributes() { function save_attributes() {
// skip saving if account is based on another structural object class // skip saving if account is based on another structural object class
if (!$_SESSION[$this->base]->isNewAccount && !in_array('inetOrgPerson', $_SESSION[$this->base]->attributes_orig['objectClass'])) { if (!$this->getAccountContainer()->isNewAccount && !in_array('inetOrgPerson', $this->getAccountContainer()->attributes_orig['objectClass'])) {
return array(); return array();
} }
$return = $_SESSION[$this->base]->save_module_attributes($this->attributes, $this->orig); $return = $this->getAccountContainer()->save_module_attributes($this->attributes, $this->orig);
// do not set password if posixAccount is active // do not set password if posixAccount is active
$modules = $_SESSION['config']->get_AccountModules($this->get_scope()); $modules = $_SESSION['config']->get_AccountModules($this->get_scope());
if (in_array('posixAccount', $modules)) { if (in_array('posixAccount', $modules)) {
if (isset($return[$_SESSION[$this->base]->dn]['modify']['userPassword'])) { if (isset($return[$this->getAccountContainer()->dn]['modify']['userPassword'])) {
unset($return[$_SESSION[$this->base]->dn]['modify']['userPassword']); unset($return[$this->getAccountContainer()->dn]['modify']['userPassword']);
} }
if (isset($return[$_SESSION[$this->base]->dn]['add']['userPassword'])) { if (isset($return[$this->getAccountContainer()->dn]['add']['userPassword'])) {
unset($return[$_SESSION[$this->base]->dn]['add']['userPassword']); unset($return[$this->getAccountContainer()->dn]['add']['userPassword']);
} }
} }
// postalAddress, facsimileTelephoneNumber and jpegPhoto need special removing // postalAddress, facsimileTelephoneNumber and jpegPhoto need special removing
if (isset($return[$_SESSION[$this->base]->dn]['remove']['postalAddress'])) { if (isset($return[$this->getAccountContainer()->dn]['remove']['postalAddress'])) {
$return[$_SESSION[$this->base]->dn]['modify']['postalAddress'] = array(); $return[$this->getAccountContainer()->dn]['modify']['postalAddress'] = array();
unset($return[$_SESSION[$this->base]->dn]['remove']['postalAddress']); unset($return[$this->getAccountContainer()->dn]['remove']['postalAddress']);
} }
if (isset($return[$_SESSION[$this->base]->dn]['remove']['facsimileTelephoneNumber'])) { if (isset($return[$this->getAccountContainer()->dn]['remove']['facsimileTelephoneNumber'])) {
$return[$_SESSION[$this->base]->dn]['modify']['facsimileTelephoneNumber'] = array(); $return[$this->getAccountContainer()->dn]['modify']['facsimileTelephoneNumber'] = array();
unset($return[$_SESSION[$this->base]->dn]['remove']['facsimileTelephoneNumber']); unset($return[$this->getAccountContainer()->dn]['remove']['facsimileTelephoneNumber']);
} }
if (isset($return[$_SESSION[$this->base]->dn]['remove']['jpegPhoto'])) { if (isset($return[$this->getAccountContainer()->dn]['remove']['jpegPhoto'])) {
$return[$_SESSION[$this->base]->dn]['modify']['jpegPhoto'] = array(); $return[$this->getAccountContainer()->dn]['modify']['jpegPhoto'] = array();
unset($return[$_SESSION[$this->base]->dn]['remove']['jpegPhoto']); unset($return[$this->getAccountContainer()->dn]['remove']['jpegPhoto']);
} }
return $return; return $return;
} }
@ -634,7 +634,7 @@ class inetOrgPerson extends baseModule {
// password // password
if (!in_array('posixAccount', $modules)) { if (!in_array('posixAccount', $modules)) {
// new account, show input fields // new account, show input fields
if ($_SESSION[$this->base]->isNewAccount) { if ($this->getAccountContainer()->isNewAccount) {
$return[] = array( $return[] = array(
array('kind' => 'text', 'text' => _('Password') ), array('kind' => 'text', 'text' => _('Password') ),
array('kind' => 'input', 'name' => 'userPassword', 'type' => 'password', 'size' => '30', 'maxlength' => '255', 'value' => $this->attributes['userPassword'][0]), array('kind' => 'input', 'name' => 'userPassword', 'type' => 'password', 'size' => '30', 'maxlength' => '255', 'value' => $this->attributes['userPassword'][0]),

View File

@ -260,20 +260,20 @@ class kolabUser extends baseModule {
* This function will create the meta HTML code to show a page with all attributes. * This function will create the meta HTML code to show a page with all attributes.
*/ */
function display_html_attributes() { function display_html_attributes() {
if ($_SESSION[$this->base]->isNewAccount) { if ($this->getAccountContainer()->isNewAccount) {
if (isset($_SESSION[$this->base]->module['posixAccount'])) { if (isset($this->getAccountContainer()->module['posixAccount'])) {
if (!$_SESSION[$this->base]->module['posixAccount']->attributes['userPassword'][0]) { if (!$this->getAccountContainer()->module['posixAccount']->attributes['userPassword'][0]) {
StatusMessage('ERROR', _("Please enter a user password on this page: %s"), '', array($_SESSION[$this->base]->module['posixAccount']->get_alias())); StatusMessage('ERROR', _("Please enter a user password on this page: %s"), '', array($this->getAccountContainer()->module['posixAccount']->get_alias()));
} }
} }
elseif (isset($_SESSION[$this->base]->module['inetOrgPerson'])) { elseif (isset($this->getAccountContainer()->module['inetOrgPerson'])) {
if (!$_SESSION[$this->base]->module['inetOrgPerson']->attributes['userPassword'][0]) { if (!$this->getAccountContainer()->module['inetOrgPerson']->attributes['userPassword'][0]) {
StatusMessage('ERROR', _("Please enter a user password on this page: %s"), '', array($_SESSION[$this->base]->module['inetOrgPerson']->get_alias())); StatusMessage('ERROR', _("Please enter a user password on this page: %s"), '', array($this->getAccountContainer()->module['inetOrgPerson']->get_alias()));
} }
} }
} }
if (!$_SESSION[$this->base]->module['inetOrgPerson']->attributes['mail'][0]) { if (!$this->getAccountContainer()->module['inetOrgPerson']->attributes['mail'][0]) {
StatusMessage('ERROR', _("Please enter an email address on this page: %s"), '', array($_SESSION[$this->base]->module['inetOrgPerson']->get_alias())); StatusMessage('ERROR', _("Please enter an email address on this page: %s"), '', array($this->getAccountContainer()->module['inetOrgPerson']->get_alias()));
} }
$return = array(); $return = array();
// check if account is marked for deletion // check if account is marked for deletion
@ -392,7 +392,7 @@ class kolabUser extends baseModule {
); );
$return[] = $returnDelegates; $return[] = $returnDelegates;
// delete flag // delete flag
if (!$_SESSION[$this->base]->isNewAccount) { if (!$this->getAccountContainer()->isNewAccount) {
$returnDelete = array( $returnDelete = array(
0 => array('kind' => 'input', 'type' => 'submit', 'value' => _('Mark account for deletion'), 'name' => 'form_subpage_kolabUser_deleteUser_open'), 0 => array('kind' => 'input', 'type' => 'submit', 'value' => _('Mark account for deletion'), 'name' => 'form_subpage_kolabUser_deleteUser_open'),
1 => array('kind' => 'help', 'value' => 'deleteFlag')); 1 => array('kind' => 'help', 'value' => 'deleteFlag'));
@ -581,13 +581,13 @@ class kolabUser extends baseModule {
* @return true, if account can be saved * @return true, if account can be saved
*/ */
function module_complete() { function module_complete() {
if (!$_SESSION[$this->base]->module['inetOrgPerson']->attributes['mail'][0]) return false; if (!$this->getAccountContainer()->module['inetOrgPerson']->attributes['mail'][0]) return false;
if ($_SESSION[$this->base]->isNewAccount) { if ($this->getAccountContainer()->isNewAccount) {
if (isset($_SESSION[$this->base]->module['posixAccount'])) { if (isset($this->getAccountContainer()->module['posixAccount'])) {
if (!$_SESSION[$this->base]->module['posixAccount']->attributes['userPassword'][0]) return false; if (!$this->getAccountContainer()->module['posixAccount']->attributes['userPassword'][0]) return false;
} }
elseif (isset($_SESSION[$this->base]->module['inetOrgPerson'])) { elseif (isset($this->getAccountContainer()->module['inetOrgPerson'])) {
if (!$_SESSION[$this->base]->module['inetOrgPerson']->attributes['userPassword'][0]) return false; if (!$this->getAccountContainer()->module['inetOrgPerson']->attributes['userPassword'][0]) return false;
} }
} }
return true; return true;

View File

@ -117,7 +117,7 @@ class nisMailAlias extends baseModule {
*/ */
function save_attributes() { function save_attributes() {
// skip saving if account is based on another structural object class // skip saving if account is based on another structural object class
if (!$_SESSION[$this->base]->isNewAccount && !in_array('nisMailAlias', $_SESSION[$this->base]->attributes_orig['objectClass'])) { if (!$this->getAccountContainer()->isNewAccount && !in_array('nisMailAlias', $this->getAccountContainer()->attributes_orig['objectClass'])) {
return array(); return array();
} }
return parent::save_attributes(); return parent::save_attributes();
@ -207,9 +207,9 @@ class nisMailAlias extends baseModule {
* @return string status ("enabled", "disabled", "hidden") * @return string status ("enabled", "disabled", "hidden")
*/ */
function getButtonStatus() { function getButtonStatus() {
if (!$_SESSION[$this->base]->isNewAccount) { if (!$this->getAccountContainer()->isNewAccount) {
// check if account is based on our object class // check if account is based on our object class
$objectClasses = $_SESSION[$this->base]->attributes_orig['objectClass']; $objectClasses = $this->getAccountContainer()->attributes_orig['objectClass'];
if (is_array($objectClasses) && !in_array('nisMailAlias', $objectClasses)) { if (is_array($objectClasses) && !in_array('nisMailAlias', $objectClasses)) {
return "disabled"; return "disabled";
} }

View File

@ -480,7 +480,7 @@ class posixAccount extends baseModule {
* <br>"modify" are attributes which have to been modified in LDAP entry * <br>"modify" are attributes which have to been modified in LDAP entry
*/ */
function save_attributes() { function save_attributes() {
$return = $_SESSION[$this->base]->save_module_attributes($this->attributes, $this->orig); $return = $this->getAccountContainer()->save_module_attributes($this->attributes, $this->orig);
// Remove primary group from additional groups // Remove primary group from additional groups
for ($i=0; $i<count($this->groups); $i++) { for ($i=0; $i<count($this->groups); $i++) {
if ($this->groups[$i]==$_SESSION['cache']->getgrnam($this->attributes['gidNumber'][0])) unset($this->groups[$i]); if ($this->groups[$i]==$_SESSION['cache']->getgrnam($this->attributes['gidNumber'][0])) unset($this->groups[$i]);
@ -676,12 +676,12 @@ class posixAccount extends baseModule {
if (($this->scope == 'host') && (substr($_POST['uid'], -1, 1) == '$')) { if (($this->scope == 'host') && (substr($_POST['uid'], -1, 1) == '$')) {
$this->attributes['cn'][0] = substr($_POST['uid'], 0, strlen($_POST['uid']) - 1); $this->attributes['cn'][0] = substr($_POST['uid'], 0, strlen($_POST['uid']) - 1);
} }
elseif (isset($_SESSION[$this->base]->module['inetOrgPerson'])) { elseif (isset($this->getAccountContainer()->module['inetOrgPerson'])) {
if ($_SESSION[$this->base]->module['inetOrgPerson']->attributes['givenName'][0]) { if ($this->getAccountContainer()->module['inetOrgPerson']->attributes['givenName'][0]) {
$this->attributes['cn'][0] = $_SESSION[$this->base]->module['inetOrgPerson']->attributes['givenName'][0] . " " . $_SESSION[$this->base]->module['inetOrgPerson']->attributes['sn'][0]; $this->attributes['cn'][0] = $this->getAccountContainer()->module['inetOrgPerson']->attributes['givenName'][0] . " " . $this->getAccountContainer()->module['inetOrgPerson']->attributes['sn'][0];
} }
elseif ($_SESSION[$this->base]->module['inetOrgPerson']->attributes['sn'][0]) { elseif ($this->getAccountContainer()->module['inetOrgPerson']->attributes['sn'][0]) {
$this->attributes['cn'][0] = $_SESSION[$this->base]->module['inetOrgPerson']->attributes['sn'][0]; $this->attributes['cn'][0] = $this->getAccountContainer()->module['inetOrgPerson']->attributes['sn'][0];
} }
else { else {
$this->attributes['cn'][0] = $_POST['uid']; $this->attributes['cn'][0] = $_POST['uid'];
@ -698,11 +698,11 @@ class posixAccount extends baseModule {
$this->attributes['gidNumber'][0] = $_SESSION['cache']->getgid($_POST['gidNumber']); $this->attributes['gidNumber'][0] = $_SESSION['cache']->getgid($_POST['gidNumber']);
// Check if UID is valid. If none value was entered, the next useable value will be inserted // Check if UID is valid. If none value was entered, the next useable value will be inserted
// load min and may uidNumber // load min and may uidNumber
if ($_SESSION[$this->base]->type=='user') { if ($this->getAccountContainer()->type=='user') {
$minID = intval($this->moduleSettings['posixAccount_minUID'][0]); $minID = intval($this->moduleSettings['posixAccount_minUID'][0]);
$maxID = intval($this->moduleSettings['posixAccount_maxUID'][0]); $maxID = intval($this->moduleSettings['posixAccount_maxUID'][0]);
} }
if ($_SESSION[$this->base]->type=='host') { if ($this->getAccountContainer()->type=='host') {
$minID = intval($this->moduleSettings['posixAccount_minMachine'][0]); $minID = intval($this->moduleSettings['posixAccount_minMachine'][0]);
$maxID = intval($this->moduleSettings['posixAccount_maxMachine'][0]); $maxID = intval($this->moduleSettings['posixAccount_maxMachine'][0]);
} }
@ -742,13 +742,13 @@ class posixAccount extends baseModule {
} }
} }
} }
if ($_SESSION[$this->base]->type=='user') { if ($this->getAccountContainer()->type=='user') {
if (($this->attributes['uid'][0] != $_POST['uid']) && !get_preg($_POST['uid'], '!upper')) if (($this->attributes['uid'][0] != $_POST['uid']) && !get_preg($_POST['uid'], '!upper'))
$errors[] = $this->messages['uid'][1]; $errors[] = $this->messages['uid'][1];
if ( !get_preg($this->attributes['homeDirectory'][0], 'homeDirectory' )) if ( !get_preg($this->attributes['homeDirectory'][0], 'homeDirectory' ))
$errors[] = $this->messages['homeDirectory'][0]; $errors[] = $this->messages['homeDirectory'][0];
} }
if ($_SESSION[$this->base]->type=='user') { if ($this->getAccountContainer()->type=='user') {
$this->attributes['homeDirectory'][0] = str_replace('$group', $_SESSION['cache']->getgrnam($this->attributes['gidNumber'][0]), $this->attributes['homeDirectory'][0]); $this->attributes['homeDirectory'][0] = str_replace('$group', $_SESSION['cache']->getgrnam($this->attributes['gidNumber'][0]), $this->attributes['homeDirectory'][0]);
if ($this->attributes['uid'][0] != '') if ($this->attributes['uid'][0] != '')
$this->attributes['homeDirectory'][0] = str_replace('$user', $this->attributes['uid'][0], $this->attributes['homeDirectory'][0]); $this->attributes['homeDirectory'][0] = str_replace('$user', $this->attributes['uid'][0], $this->attributes['homeDirectory'][0]);
@ -757,7 +757,7 @@ class posixAccount extends baseModule {
if ( !get_preg($this->attributes['uid'][0], 'username')) if ( !get_preg($this->attributes['uid'][0], 'username'))
$errors[] = $this->messages['uid'][2]; $errors[] = $this->messages['uid'][2];
} }
if ($_SESSION[$this->base]->type=='host') { if ($this->getAccountContainer()->type=='host') {
// add "$" to uid if needed // add "$" to uid if needed
if (substr($this->attributes['uid'][0], -1, 1) != '$') { if (substr($this->attributes['uid'][0], -1, 1) != '$') {
$this->attributes['uid'][0] .= '$'; $this->attributes['uid'][0] .= '$';
@ -781,13 +781,13 @@ class posixAccount extends baseModule {
// Change uid to a new uid until a free uid is found // Change uid to a new uid until a free uid is found
else else
while ($_SESSION['cache']->in_cache($this->attributes['uid'][0], 'uid', array('user', 'host'))) { while ($_SESSION['cache']->in_cache($this->attributes['uid'][0], 'uid', array('user', 'host'))) {
if ($_SESSION[$this->base]->type=='host') $this->attributes['uid'][0] = substr($this->attributes['uid'][0], 0, -1); if ($this->getAccountContainer()->type=='host') $this->attributes['uid'][0] = substr($this->attributes['uid'][0], 0, -1);
// get last character of username // get last character of username
$lastchar = substr($this->attributes['uid'][0], strlen($this->attributes['uid'][0])-1, 1); $lastchar = substr($this->attributes['uid'][0], strlen($this->attributes['uid'][0])-1, 1);
// Last character is no number // Last character is no number
if ( !ereg('^([0-9])+$', $lastchar)) { if ( !ereg('^([0-9])+$', $lastchar)) {
// Last character is no number. Therefore we only have to add "2" to it. // Last character is no number. Therefore we only have to add "2" to it.
if ($_SESSION[$this->base]->type=='host') { if ($this->getAccountContainer()->type=='host') {
$this->attributes['uid'][0] = $this->attributes['uid'][0] . '2$'; $this->attributes['uid'][0] = $this->attributes['uid'][0] . '2$';
} }
else { else {
@ -811,14 +811,14 @@ class posixAccount extends baseModule {
$firstchars = substr($this->attributes['uid'][0], 0, $i+1); $firstchars = substr($this->attributes['uid'][0], 0, $i+1);
$lastchars = substr($this->attributes['uid'][0], $i+1, strlen($this->attributes['uid'][0])-$i); $lastchars = substr($this->attributes['uid'][0], $i+1, strlen($this->attributes['uid'][0])-$i);
// Put username together // Put username together
if ($_SESSION[$this->base]->type=='host') $this->attributes['uid'][0] = $firstchars . (intval($lastchars)+1)."$"; if ($this->getAccountContainer()->type=='host') $this->attributes['uid'][0] = $firstchars . (intval($lastchars)+1)."$";
else $this->attributes['uid'][0] = $firstchars . (intval($lastchars)+1); else $this->attributes['uid'][0] = $firstchars . (intval($lastchars)+1);
} }
} }
// Show warning if lam has changed username // Show warning if lam has changed username
if ($this->attributes['uid'][0] != $_POST['uid']) { if ($this->attributes['uid'][0] != $_POST['uid']) {
if ($_SESSION[$this->base]->type=='user') $errors[] = $this->messages['uid'][5]; if ($this->getAccountContainer()->type=='user') $errors[] = $this->messages['uid'][5];
if ($_SESSION[$this->base]->type=='host') $errors[] = $this->messages['uid'][6]; if ($this->getAccountContainer()->type=='host') $errors[] = $this->messages['uid'][6];
} }
$attributeList = array('gecos', 'homeDirectory'); $attributeList = array('gecos', 'homeDirectory');
for ($i = 0; $i < sizeof($attributeList); $i++) { for ($i = 0; $i < sizeof($attributeList); $i++) {
@ -934,7 +934,7 @@ class posixAccount extends baseModule {
1 => array('kind' => 'select', 'name' => 'gidNumber', 'options' => $groups, 'options_selected' => array($_SESSION['cache']->getgrnam($this->attributes['gidNumber'][0]))), 1 => array('kind' => 'select', 'name' => 'gidNumber', 'options' => $groups, 'options_selected' => array($_SESSION['cache']->getgrnam($this->attributes['gidNumber'][0]))),
2 => array('kind' => 'help', 'value' => 'gidNumber')); 2 => array('kind' => 'help', 'value' => 'gidNumber'));
if ($_SESSION[$this->base]->type=='user') { if ($this->getAccountContainer()->type=='user') {
$return[] = array( $return[] = array(
0 => array('kind' => 'text', 'text' => _('Additional groups')), 0 => array('kind' => 'text', 'text' => _('Additional groups')),
1 => array('kind' => 'input', 'name' => 'form_subpage_posixAccount_group_open', 'type' => 'submit', 'value' => _('Edit groups')), 1 => array('kind' => 'input', 'name' => 'form_subpage_posixAccount_group_open', 'type' => 'submit', 'value' => _('Edit groups')),
@ -943,7 +943,7 @@ class posixAccount extends baseModule {
0 => array('kind' => 'text', 'text' => _('Home directory').'*'), 0 => array('kind' => 'text', 'text' => _('Home directory').'*'),
1 => array('kind' => 'input', 'name' => 'homeDirectory', 'type' => 'text', 'size' => '30', 'maxlength' => '255', 'value' => $this->attributes['homeDirectory'][0]), 1 => array('kind' => 'input', 'name' => 'homeDirectory', 'type' => 'text', 'size' => '30', 'maxlength' => '255', 'value' => $this->attributes['homeDirectory'][0]),
2 => array('kind' => 'help', 'value' => 'homeDirectory')); 2 => array('kind' => 'help', 'value' => 'homeDirectory'));
if ($_SESSION[$this->base]->isNewAccount && isset($_SESSION['config']->scriptPath) && ($_SESSION['config']->scriptPath != '')) { if ($this->getAccountContainer()->isNewAccount && isset($_SESSION['config']->scriptPath) && ($_SESSION['config']->scriptPath != '')) {
// get list of lamdaemon servers // get list of lamdaemon servers
$lamdaemonServers = explode(";", $_SESSION['config']->get_scriptServers()); $lamdaemonServers = explode(";", $_SESSION['config']->get_scriptServers());
for ($i = 0; $i < sizeof($lamdaemonServers); $i++) { for ($i = 0; $i < sizeof($lamdaemonServers); $i++) {

View File

@ -133,7 +133,7 @@ class posixGroup extends baseModule {
} }
} }
if ($found) { if ($found) {
$return[$_SESSION[$this->base]->dn]['errors'][] = $this->messages['primaryGroup'][0]; $return[$this->getAccountContainer()->dn]['errors'][] = $this->messages['primaryGroup'][0];
} }
return $return; return $return;
} }
@ -474,9 +474,9 @@ class posixGroup extends baseModule {
* @return boolean true, if settings are complete * @return boolean true, if settings are complete
*/ */
function module_complete() { function module_complete() {
if (!$_SESSION[$this->base]->isNewAccount) { if (!$this->getAccountContainer()->isNewAccount) {
// check if account is based on our object class // check if account is based on our object class
$objectClasses = $_SESSION[$this->base]->attributes_orig['objectClass']; $objectClasses = $this->getAccountContainer()->attributes_orig['objectClass'];
if (is_array($objectClasses) && !in_array('posixGroup', $objectClasses)) { if (is_array($objectClasses) && !in_array('posixGroup', $objectClasses)) {
return true; return true;
} }
@ -493,9 +493,9 @@ class posixGroup extends baseModule {
* @return string status ("enabled", "disabled", "hidden") * @return string status ("enabled", "disabled", "hidden")
*/ */
function getButtonStatus() { function getButtonStatus() {
if (!$_SESSION[$this->base]->isNewAccount) { if (!$this->getAccountContainer()->isNewAccount) {
// check if account is based on our object class // check if account is based on our object class
$objectClasses = $_SESSION[$this->base]->attributes_orig['objectClass']; $objectClasses = $this->getAccountContainer()->attributes_orig['objectClass'];
if (is_array($objectClasses) && !in_array('posixGroup', $objectClasses)) { if (is_array($objectClasses) && !in_array('posixGroup', $objectClasses)) {
return "disabled"; return "disabled";
} }
@ -680,10 +680,10 @@ class posixGroup extends baseModule {
*/ */
function save_attributes() { function save_attributes() {
// skip saving if account is based on another structural object class // skip saving if account is based on another structural object class
if (!$_SESSION[$this->base]->isNewAccount && !in_array('posixGroup', $_SESSION[$this->base]->attributes_orig['objectClass'])) { if (!$this->getAccountContainer()->isNewAccount && !in_array('posixGroup', $this->getAccountContainer()->attributes_orig['objectClass'])) {
return array(); return array();
} }
$return = $_SESSION[$this->base]->save_module_attributes($this->attributes, $this->orig); $return = $this->getAccountContainer()->save_module_attributes($this->attributes, $this->orig);
// Change gids of users and hosts? // Change gids of users and hosts?
if ($this->changegids) { if ($this->changegids) {
// get gidNumber // get gidNumber

View File

@ -138,7 +138,7 @@ class quota extends baseModule {
function initQuotas() { function initQuotas() {
if (isset($this->quota)) return; if (isset($this->quota)) return;
$userName = '+'; $userName = '+';
if (isset($_SESSION[$this->base]) && !$_SESSION[$this->base]->isNewAccount) { if (($this->getAccountContainer() != null) && !$this->getAccountContainer()->isNewAccount) {
if (!isset($this->attributes['uid'][0])) return; if (!isset($this->attributes['uid'][0])) return;
$userName = $this->attributes['uid'][0]; $userName = $this->attributes['uid'][0];
} }
@ -163,8 +163,8 @@ class quota extends baseModule {
} }
function module_ready() { function module_ready() {
if ($_SESSION[$this->base]->type=='user' && $_SESSION[$this->base]->module['posixAccount']->attributes['uid'][0]=='') return false; if ($this->getAccountContainer()->type=='user' && $this->getAccountContainer()->module['posixAccount']->attributes['uid'][0]=='') return false;
if ($_SESSION[$this->base]->type=='group' && $_SESSION[$this->base]->module['posixGroup']->attributes['cn'][0]=='') return false; if ($this->getAccountContainer()->type=='group' && $this->getAccountContainer()->module['posixGroup']->attributes['cn'][0]=='') return false;
return true; return true;
} }
@ -184,8 +184,8 @@ class quota extends baseModule {
function postModifyActions($newAccount) { function postModifyActions($newAccount) {
if (!isset($this->quota) || !is_array($this->quota)) return; if (!isset($this->quota) || !is_array($this->quota)) return;
// determine if this is a user or group account // determine if this is a user or group account
if ($_SESSION[$this->base]->type=='user') $id = $_SESSION[$this->base]->module['posixAccount']->attributes['uid'][0]; if ($this->getAccountContainer()->type=='user') $id = $this->getAccountContainer()->module['posixAccount']->attributes['uid'][0];
if ($_SESSION[$this->base]->type=='group') $id = $_SESSION[$this->base]->module['posixGroup']->attributes['cn'][0]; if ($this->getAccountContainer()->type=='group') $id = $this->getAccountContainer()->module['posixGroup']->attributes['cn'][0];
// get list of lamdaemon servers // get list of lamdaemon servers
$serverDescriptions = array(); $serverDescriptions = array();
$lamdaemonServers = explode(";", $_SESSION['config']->get_scriptServers()); $lamdaemonServers = explode(";", $_SESSION['config']->get_scriptServers());
@ -204,7 +204,7 @@ class quota extends baseModule {
$quotastring = $quotastring . $this->quota[$server][$i][0] . ',' . $this->quota[$server][$i][2] . ',' . $this->quota[$server][$i][3] $quotastring = $quotastring . $this->quota[$server][$i][0] . ',' . $this->quota[$server][$i][2] . ',' . $this->quota[$server][$i][3]
. ',' . $this->quota[$server][$i][6] . ',' . $this->quota[$server][$i][7] . ':'; . ',' . $this->quota[$server][$i][6] . ',' . $this->quota[$server][$i][7] . ':';
} }
$ret = lamdaemon(array($id . " quota set " . $_SESSION[$this->base]->type . " $quotastring\n"), $server); $ret = lamdaemon(array($id . " quota set " . $this->getAccountContainer()->type . " $quotastring\n"), $server);
} }
} }
@ -218,8 +218,8 @@ class quota extends baseModule {
$this->initQuotas(); $this->initQuotas();
if (!isset($this->quota) || !is_array($this->quota)) return true; if (!isset($this->quota) || !is_array($this->quota)) return true;
// determine if this is a user or group account // determine if this is a user or group account
if ($_SESSION[$this->base]->type=='user') $id = $_SESSION[$this->base]->module['posixAccount']->attributes['uid'][0]; if ($this->getAccountContainer()->type=='user') $id = $this->getAccountContainer()->module['posixAccount']->attributes['uid'][0];
if ($_SESSION[$this->base]->type=='group') $id = $_SESSION[$this->base]->module['posixGroup']->attributes['cn'][0]; if ($this->getAccountContainer()->type=='group') $id = $this->getAccountContainer()->module['posixGroup']->attributes['cn'][0];
// get list of lamdaemon servers // get list of lamdaemon servers
$serverDescriptions = array(); $serverDescriptions = array();
$lamdaemonServers = explode(";", $_SESSION['config']->get_scriptServers()); $lamdaemonServers = explode(";", $_SESSION['config']->get_scriptServers());
@ -238,7 +238,7 @@ class quota extends baseModule {
$quotastring = $quotastring . $this->quota[$server][$i][0] . ',0,0,0,0:'; $quotastring = $quotastring . $this->quota[$server][$i][0] . ',0,0,0,0:';
$i++; $i++;
} }
$ret = lamdaemon(array($id . " quota set " . $_SESSION[$this->base]->type . " $quotastring\n"), $server); $ret = lamdaemon(array($id . " quota set " . $this->getAccountContainer()->type . " $quotastring\n"), $server);
} }
return true; return true;
} }

View File

@ -436,8 +436,8 @@ class sambaAccount extends baseModule {
var $rids; var $rids;
function module_ready() { function module_ready() {
if ($_SESSION[$this->base]->module['posixAccount']->attributes['gidNumber'][0]=='') return false; if ($this->getAccountContainer()->module['posixAccount']->attributes['gidNumber'][0]=='') return false;
if ($_SESSION[$this->base]->module['posixAccount']->attributes['uidNumber'][0]=='') return false; if ($this->getAccountContainer()->module['posixAccount']->attributes['uidNumber'][0]=='') return false;
return true; return true;
} }
@ -481,7 +481,7 @@ class sambaAccount extends baseModule {
*/ */
$special = false; $special = false;
if ($this->attributes['rid'][0] < 1000) $special = true; if ($this->attributes['rid'][0] < 1000) $special = true;
if (!$special) $this->attributes['rid'][0] == $_SESSION[$this->base]->module['posixAccount']->attributes['uidNumber'][0]*2+1000; if (!$special) $this->attributes['rid'][0] == $this->getAccountContainer()->module['posixAccount']->attributes['uidNumber'][0]*2+1000;
$rids = array_values($this->rids); $rids = array_values($this->rids);
$wrid = false; $wrid = false;
for ($i=0; $i<count($rids); $i++) { for ($i=0; $i<count($rids); $i++) {
@ -490,8 +490,8 @@ class sambaAccount extends baseModule {
break; break;
} }
} }
if (!$wrid) $this->attributes['primaryGroupID'][0] = ($_SESSION[$this->base]->module['posixAccount']->attributes['gidNumber'][0]*2)+1001; if (!$wrid) $this->attributes['primaryGroupID'][0] = ($this->getAccountContainer()->module['posixAccount']->attributes['gidNumber'][0]*2)+1001;
$return = $_SESSION[$this->base]->save_module_attributes($this->attributes, $this->orig); $return = $this->getAccountContainer()->save_module_attributes($this->attributes, $this->orig);
return $return; return $return;
} }
@ -544,10 +544,10 @@ class sambaAccount extends baseModule {
} }
// host attributes // host attributes
if ($_SESSION[$this->base]->type=='host') { if ($this->getAccountContainer()->type=='host') {
$this->attributes['primaryGroupID'][0] = $this->rids[_('Domain computers')]; $this->attributes['primaryGroupID'][0] = $this->rids[_('Domain computers')];
if ($_POST['ResetSambaPassword'] || (!$this->attributes['lmPassword'][0])) { if ($_POST['ResetSambaPassword'] || (!$this->attributes['lmPassword'][0])) {
$hostname = $_SESSION[$this->base]->module['posixAccount']->attributes['uid'][0]; $hostname = $this->getAccountContainer()->module['posixAccount']->attributes['uid'][0];
$hostname = substr($hostname, 0, strlen($hostname) - 1); $hostname = substr($hostname, 0, strlen($hostname) - 1);
$this->attributes['lmPassword'][0] = lmPassword($hostname); $this->attributes['lmPassword'][0] = lmPassword($hostname);
$this->attributes['ntPassword'][0] = ntPassword($hostname); $this->attributes['ntPassword'][0] = ntPassword($hostname);
@ -575,13 +575,13 @@ class sambaAccount extends baseModule {
break; break;
} }
} }
if (!$wrid) $this->attributes['primaryGroupID'][0] = ($_SESSION[$this->base]->module['posixAccount']->attributes['gidNumber'][0]*2)+1001; if (!$wrid) $this->attributes['primaryGroupID'][0] = ($this->getAccountContainer()->module['posixAccount']->attributes['gidNumber'][0]*2)+1001;
if ($_POST['useunixpwd']) $this->useunixpwd = true; if ($_POST['useunixpwd']) $this->useunixpwd = true;
else $this->useunixpwd = false; else $this->useunixpwd = false;
if ($_POST['useunixpwd']) { if ($_POST['useunixpwd']) {
$this->useunixpwd = true; $this->useunixpwd = true;
$this->attributes['lmPassword'][0] = lmPassword($_SESSION[$this->base]->module['posixAccount']->clearTextPassword); $this->attributes['lmPassword'][0] = lmPassword($this->getAccountContainer()->module['posixAccount']->clearTextPassword);
$this->attributes['ntPassword'][0] = ntPassword($_SESSION[$this->base]->module['posixAccount']->clearTextPassword); $this->attributes['ntPassword'][0] = ntPassword($this->getAccountContainer()->module['posixAccount']->clearTextPassword);
$this->attributes['pwdLastSet'][0] = time(); $this->attributes['pwdLastSet'][0] = time();
} }
else $this->useunixpwd = false; else $this->useunixpwd = false;
@ -605,16 +605,16 @@ class sambaAccount extends baseModule {
$this->attributes['rid'][0] = $this->rids[$_POST['rid']]; $this->attributes['rid'][0] = $this->rids[$_POST['rid']];
} }
else { else {
$this->attributes['rid'][0] = $_SESSION[$this->base]->module['posixAccount']->attributes['uidNumber'][0]*2+1000; $this->attributes['rid'][0] = $this->getAccountContainer()->module['posixAccount']->attributes['uidNumber'][0]*2+1000;
} }
$this->attributes['smbHome'][0] = str_replace('$user', $_SESSION[$this->base]->module['posixAccount']->attributes['uid'][0], $this->attributes['smbHome'][0]); $this->attributes['smbHome'][0] = str_replace('$user', $this->getAccountContainer()->module['posixAccount']->attributes['uid'][0], $this->attributes['smbHome'][0]);
$this->attributes['smbHome'][0] = str_replace('$group', $_SESSION['cache']->getgrnam($_SESSION[$this->base]->module['posixAccount']->attributes['gidNumber'][0]), $this->attributes['smbHome'][0]); $this->attributes['smbHome'][0] = str_replace('$group', $_SESSION['cache']->getgrnam($this->getAccountContainer()->module['posixAccount']->attributes['gidNumber'][0]), $this->attributes['smbHome'][0]);
if ($this->attributes['smbHome'][0] != $_POST['smbHome']) $errors[] = $this->messages['homePath'][1]; if ($this->attributes['smbHome'][0] != $_POST['smbHome']) $errors[] = $this->messages['homePath'][1];
$this->attributes['scriptPath'][0] = str_replace('$user', $_SESSION[$this->base]->module['posixAccount']->attributes['uid'][0], $this->attributes['scriptPath'][0]); $this->attributes['scriptPath'][0] = str_replace('$user', $this->getAccountContainer()->module['posixAccount']->attributes['uid'][0], $this->attributes['scriptPath'][0]);
$this->attributes['scriptPath'][0] = str_replace('$group', $_SESSION['cache']->getgrnam($_SESSION[$this->base]->module['posixAccount']->attributes['gidNumber'][0]), $this->attributes['scriptPath'][0]); $this->attributes['scriptPath'][0] = str_replace('$group', $_SESSION['cache']->getgrnam($this->getAccountContainer()->module['posixAccount']->attributes['gidNumber'][0]), $this->attributes['scriptPath'][0]);
if ($this->attributes['scriptPath'][0] != $_POST['scriptPath']) $errors[] = $this->messages['logonScript'][1]; if ($this->attributes['scriptPath'][0] != $_POST['scriptPath']) $errors[] = $this->messages['logonScript'][1];
$this->attributes['profilePath'][0] = str_replace('$user', $_SESSION[$this->base]->module['posixAccount']->attributes['uid'][0], $this->attributes['profilePath'][0]); $this->attributes['profilePath'][0] = str_replace('$user', $this->getAccountContainer()->module['posixAccount']->attributes['uid'][0], $this->attributes['profilePath'][0]);
$this->attributes['profilePath'][0] = str_replace('$group', $_SESSION['cache']->getgrnam($_SESSION[$this->base]->module['posixAccount']->attributes['gidNumber'][0]), $this->attributes['profilePath'][0]); $this->attributes['profilePath'][0] = str_replace('$group', $_SESSION['cache']->getgrnam($this->getAccountContainer()->module['posixAccount']->attributes['gidNumber'][0]), $this->attributes['profilePath'][0]);
if ($this->attributes['profiletPath'][0] != $_POST['profilePath']) $errors[] = $this->messages['profilePath'][1]; if ($this->attributes['profiletPath'][0] != $_POST['profilePath']) $errors[] = $this->messages['profilePath'][1];
if ( (!$this->attributes['smbHome'][0]=='') && (!get_preg($this->attributes['smbHome'][0], 'UNC'))) if ( (!$this->attributes['smbHome'][0]=='') && (!get_preg($this->attributes['smbHome'][0], 'UNC')))
$errors[] = $this->messages['homePath'][0]; $errors[] = $this->messages['homePath'][0];
@ -626,10 +626,10 @@ class sambaAccount extends baseModule {
// check values for host account // check values for host account
else { else {
if (!$this->attributes['rid'][0]) { if (!$this->attributes['rid'][0]) {
$this->attributes['rid'][0] = ($_SESSION[$this->base]->module['posixAccount']->attributes['uidNumber'][0] * 2) + 1000; $this->attributes['rid'][0] = ($this->getAccountContainer()->module['posixAccount']->attributes['uidNumber'][0] * 2) + 1000;
} }
if (!$this->attributes['primaryGroupID'][0]) { if (!$this->attributes['primaryGroupID'][0]) {
$this->attributes['primaryGroupID'][0] = ($_SESSION[$this->base]->module['posixAccount']->attributes['gidNumber'][0] * 2) + 1001; $this->attributes['primaryGroupID'][0] = ($this->getAccountContainer()->module['posixAccount']->attributes['gidNumber'][0] * 2) + 1001;
} }
} }
@ -647,7 +647,7 @@ class sambaAccount extends baseModule {
*/ */
function process_userWorkstations() { function process_userWorkstations() {
// Load attributes // Load attributes
if ($_SESSION[$this->base]->type=='user') { if ($this->getAccountContainer()->type=='user') {
if (isset($_POST['availableUserWorkstations']) && isset($_POST['userWorkstations_add'])) { // Add workstations to list if (isset($_POST['availableUserWorkstations']) && isset($_POST['userWorkstations_add'])) { // Add workstations to list
$temp = str_replace(' ', '', $this->attributes['userWorkstations'][0]); $temp = str_replace(' ', '', $this->attributes['userWorkstations'][0]);
$workstations = explode (',', $temp); $workstations = explode (',', $temp);
@ -699,7 +699,7 @@ class sambaAccount extends baseModule {
1 => array('kind' => 'input', 'type' => 'text', 'name' => 'displayName', 'size' => '20', 'value' => $this->attributes['displayName'][0]), 1 => array('kind' => 'input', 'type' => 'text', 'name' => 'displayName', 'size' => '20', 'value' => $this->attributes['displayName'][0]),
2 => array('kind' => 'help', 'value' => 'displayName')); 2 => array('kind' => 'help', 'value' => 'displayName'));
// user attributes // user attributes
if ($_SESSION[$this->base]->type=='user') { if ($this->getAccountContainer()->type=='user') {
if (isset($this->attributes['pwdCanChange'][0])) $canchangedate = getdate(intval($this->attributes['pwdCanChange'][0])); if (isset($this->attributes['pwdCanChange'][0])) $canchangedate = getdate(intval($this->attributes['pwdCanChange'][0]));
else $canchangedate = getdate(0); else $canchangedate = getdate(0);
if (isset($this->attributes['pwdMustChange'][0])) $mustchangedate = getdate(intval($this->attributes['pwdMustChange'][0])); if (isset($this->attributes['pwdMustChange'][0])) $mustchangedate = getdate(intval($this->attributes['pwdMustChange'][0]));
@ -718,7 +718,7 @@ class sambaAccount extends baseModule {
0 => array('kind' => 'text', 'text' => _('Repeat password') ), 0 => array('kind' => 'text', 'text' => _('Repeat password') ),
1 => array('kind' => 'input', 'name' => 'lmPassword2', 'type' => 'password', 'size' => '20', 'maxlength' => '255', 'value' => ''), 1 => array('kind' => 'input', 'name' => 'lmPassword2', 'type' => 'password', 'size' => '20', 'maxlength' => '255', 'value' => ''),
2 => array('kind' => 'help', 'value' => 'password')); 2 => array('kind' => 'help', 'value' => 'password'));
if (isset($_SESSION[$this->base]->module['posixAccount']->clearTextPassword)) { if (isset($this->getAccountContainer()->module['posixAccount']->clearTextPassword)) {
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Use Unix password') ), $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Use Unix password') ),
1 => array ( 'kind' => 'input', 'name' => 'useunixpwd', 'type' => 'checkbox', 'checked' => $this->useunixpwd, 'value' => true), 1 => array ( 'kind' => 'input', 'name' => 'useunixpwd', 'type' => 'checkbox', 'checked' => $this->useunixpwd, 'value' => true),
2 => array ('kind' => 'help', 'value' => 'pwdUnix')); 2 => array ('kind' => 'help', 'value' => 'pwdUnix'));
@ -779,8 +779,8 @@ class sambaAccount extends baseModule {
} }
else $options[] = $names[$i]; else $options[] = $names[$i];
} }
if ($wrid) $options[] = $_SESSION['cache']->getgrnam($_SESSION[$this->base]->module['posixAccount']->attributes['gidNumber'][0]); if ($wrid) $options[] = $_SESSION['cache']->getgrnam($this->getAccountContainer()->module['posixAccount']->attributes['gidNumber'][0]);
else $selected[] = $_SESSION['cache']->getgrnam($_SESSION[$this->base]->module['posixAccount']->attributes['gidNumber'][0]); else $selected[] = $_SESSION['cache']->getgrnam($this->getAccountContainer()->module['posixAccount']->attributes['gidNumber'][0]);
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Windows group') ), $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Windows group') ),
1 => array ( 'kind' => 'select', 'name' => 'primaryGroupID', 'options' => $options, 'options_selected' => $selected), 1 => array ( 'kind' => 'select', 'name' => 'primaryGroupID', 'options' => $options, 'options_selected' => $selected),
2 => array ( 'kind' => 'help', 'value' => 'group' )); 2 => array ( 'kind' => 'help', 'value' => 'group' ));
@ -803,7 +803,7 @@ class sambaAccount extends baseModule {
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Domain') ), $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Domain') ),
1 => array ( 'kind' => 'input', 'type' => 'text', 'name' => 'domain', 'size' => '20', 'maxlength' => '255', 'value' => $this->attributes['domain'][0]), 1 => array ( 'kind' => 'input', 'type' => 'text', 'name' => 'domain', 'size' => '20', 'maxlength' => '255', 'value' => $this->attributes['domain'][0]),
2 => array ( 'kind' => 'help', 'value' => 'domain' )); 2 => array ( 'kind' => 'help', 'value' => 'domain' ));
if ($_SESSION[$this->base]->type=='host') { if ($this->getAccountContainer()->type=='host') {
$return[] = array ( 0 => array ( 'kind' => 'input', 'name' => 'acctFlagsW', 'type' => 'hidden', 'value' => 'true' )); $return[] = array ( 0 => array ( 'kind' => 'input', 'name' => 'acctFlagsW', 'type' => 'hidden', 'value' => 'true' ));
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Reset password') ), $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Reset password') ),
1 => array ( 'kind' => 'input', 'type' => 'submit', 'name' => 'ResetSambaPassword', 'value' => _('Reset')), 1 => array ( 'kind' => 'input', 'type' => 'submit', 'name' => 'ResetSambaPassword', 'value' => _('Reset')),
@ -817,7 +817,7 @@ class sambaAccount extends baseModule {
* It will output a complete html-table * It will output a complete html-table
*/ */
function display_html_userWorkstations() { function display_html_userWorkstations() {
if ($_SESSION[$this->base]->type=='user') { if ($this->getAccountContainer()->type=='user') {
// Get list of all hosts. // Get list of all hosts.
$result = $_SESSION['cache']->get_cache('uid', 'sambaAccount', 'host'); $result = $_SESSION['cache']->get_cache('uid', 'sambaAccount', 'host');
if (is_array($result)) { if (is_array($result)) {

View File

@ -206,7 +206,7 @@ class sambaDomain extends baseModule {
function display_html_attributes() { function display_html_attributes() {
$return = array(); $return = array();
// domain name // domain name
if ($_SESSION[$this->base]->isNewAccount) { if ($this->getAccountContainer()->isNewAccount) {
$return[] = array( $return[] = array(
0 => array('kind' => 'text', 'text' => _('Domain name').'*'), 0 => array('kind' => 'text', 'text' => _('Domain name').'*'),
1 => array('kind' => 'input', 'name' => 'domainName', 'type' => 'text', 'value' => $this->attributes['sambaDomainName'][0]), 1 => array('kind' => 'input', 'name' => 'domainName', 'type' => 'text', 'value' => $this->attributes['sambaDomainName'][0]),
@ -219,7 +219,7 @@ class sambaDomain extends baseModule {
2 => array('kind' => 'help', 'value' => 'domainName')); 2 => array('kind' => 'help', 'value' => 'domainName'));
} }
// domain SID // domain SID
if ($_SESSION[$this->base]->isNewAccount) { if ($this->getAccountContainer()->isNewAccount) {
$return[] = array( $return[] = array(
0 => array('kind' => 'text', 'text' => _('Domain SID').'*'), 0 => array('kind' => 'text', 'text' => _('Domain SID').'*'),
1 => array('kind' => 'input', 'name' => 'domainSID', 'type' => 'text', 'value' => $this->attributes['sambaSID'][0]), 1 => array('kind' => 'input', 'name' => 'domainSID', 'type' => 'text', 'value' => $this->attributes['sambaSID'][0]),
@ -326,7 +326,7 @@ class sambaDomain extends baseModule {
2 => array('kind' => 'help', 'value' => 'nextGroupRID')); 2 => array('kind' => 'help', 'value' => 'nextGroupRID'));
// RID base // RID base
if (!isset($this->attributes['sambaAlgorithmicRidBase'][0])) $this->attributes['sambaAlgorithmicRidBase'][0] = 1000; if (!isset($this->attributes['sambaAlgorithmicRidBase'][0])) $this->attributes['sambaAlgorithmicRidBase'][0] = 1000;
if ($_SESSION[$this->base]->isNewAccount) { if ($this->getAccountContainer()->isNewAccount) {
$return[] = array( $return[] = array(
0 => array('kind' => 'text', 'text' => _('RID base').'*'), 0 => array('kind' => 'text', 'text' => _('RID base').'*'),
1 => array('kind' => 'input', 'name' => 'RIDbase', 'type' => 'text', 'value' => $this->attributes['sambaAlgorithmicRidBase'][0]), 1 => array('kind' => 'input', 'name' => 'RIDbase', 'type' => 'text', 'value' => $this->attributes['sambaAlgorithmicRidBase'][0]),
@ -349,7 +349,7 @@ class sambaDomain extends baseModule {
*/ */
function process_attributes() { function process_attributes() {
$errors = array(); $errors = array();
if ($_SESSION[$this->base]->isNewAccount) { if ($this->getAccountContainer()->isNewAccount) {
// domain SID // domain SID
if (!get_preg($_POST['domainSID'], 'domainSID')) { if (!get_preg($_POST['domainSID'], 'domainSID')) {
$errors[] = $this->messages['domainSID'][0]; $errors[] = $this->messages['domainSID'][0];

View File

@ -200,8 +200,8 @@ class sambaGroupMapping extends baseModule {
} }
else $options[] = $names[$i]; else $options[] = $names[$i];
} }
if ($wrid) $options[] = $_SESSION[$this->base]->module['posixGroup']->attributes['cn'][0]; if ($wrid) $options[] = $this->getAccountContainer()->module['posixGroup']->attributes['cn'][0];
else $selected[] = $_SESSION[$this->base]->module['posixGroup']->attributes['cn'][0]; else $selected[] = $this->getAccountContainer()->module['posixGroup']->attributes['cn'][0];
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Windows group') ), $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Windows group') ),
1 => array ( 'kind' => 'select', 'name' => 'sambaSID', 'options' => $options, 'options_selected' => $selected), 1 => array ( 'kind' => 'select', 'name' => 'sambaSID', 'options' => $options, 'options_selected' => $selected),
2 => array ( 'kind' => 'help', 'value' => 'sambaSID' )); 2 => array ( 'kind' => 'help', 'value' => 'sambaSID' ));
@ -390,7 +390,7 @@ class sambaGroupMapping extends baseModule {
function module_ready() { function module_ready() {
if ($_SESSION[$this->base]->module['posixGroup']->attributes['gidNumber'][0]=='') return false; if ($this->getAccountContainer()->module['posixGroup']->attributes['gidNumber'][0]=='') return false;
return true; return true;
} }
@ -429,7 +429,7 @@ class sambaGroupMapping extends baseModule {
// Get Domain SID // Get Domain SID
$this->attributes['sambaSID'][0] = $SID."-".$this->rids[$rids[$i]]; $this->attributes['sambaSID'][0] = $SID."-".$this->rids[$rids[$i]];
// Do a check if special group is unique // Do a check if special group is unique
if ($_SESSION[$this->base]->isNewAccount) { if ($this->getAccountContainer()->isNewAccount) {
if ($_SESSION['cache']->in_cache($SID."-".$this->rids[$rids[$i]], 'sambaSID', 'group')) { if ($_SESSION['cache']->in_cache($SID."-".$this->rids[$rids[$i]], 'sambaSID', 'group')) {
$message = $this->messages['sambaSID'][0]; $message = $this->messages['sambaSID'][0];
$message[] = $rids[$i]; $message[] = $rids[$i];
@ -438,7 +438,7 @@ class sambaGroupMapping extends baseModule {
} }
} }
} }
if (!$wrid) $this->attributes['sambaSID'][0] = $SID . "-" . ($_SESSION[$this->base]->module['posixGroup']->attributes['gidNumber'][0]*2+$RIDbase+1); if (!$wrid) $this->attributes['sambaSID'][0] = $SID . "-" . ($this->getAccountContainer()->module['posixGroup']->attributes['gidNumber'][0]*2+$RIDbase+1);
// Return error-messages // Return error-messages
return $errors; return $errors;
} }
@ -470,8 +470,8 @@ class sambaGroupMapping extends baseModule {
$wrid=true; $wrid=true;
} }
} }
if (!$wrid) $this->attributes['sambaSID'][0] == $SID."-".($_SESSION[$this->base]->module['posixGroup']->attributes['gidNumber'][0]*2+1+$RIDbase); if (!$wrid) $this->attributes['sambaSID'][0] == $SID."-".($this->getAccountContainer()->module['posixGroup']->attributes['gidNumber'][0]*2+1+$RIDbase);
$return = $_SESSION[$this->base]->save_module_attributes($this->attributes, $this->orig); $return = $this->getAccountContainer()->save_module_attributes($this->attributes, $this->orig);
return $return; return $return;
} }

View File

@ -492,9 +492,9 @@ class sambaSamAccount extends baseModule {
* @return boolean true, if page can be displayed * @return boolean true, if page can be displayed
*/ */
function module_ready() { function module_ready() {
if ($_SESSION[$this->base]->module['posixAccount']->attributes['gidNumber'][0]=='') return false; if ($this->getAccountContainer()->module['posixAccount']->attributes['gidNumber'][0]=='') return false;
if ($_SESSION[$this->base]->module['posixAccount']->attributes['uidNumber'][0]=='') return false; if ($this->getAccountContainer()->module['posixAccount']->attributes['uidNumber'][0]=='') return false;
if ($_SESSION[$this->base]->module['posixAccount']->attributes['uid'][0]=='') return false; if ($this->getAccountContainer()->module['posixAccount']->attributes['uid'][0]=='') return false;
return true; return true;
} }
@ -549,9 +549,9 @@ class sambaSamAccount extends baseModule {
$special = false; $special = false;
if ($this->attributes['sambaSID'][0] == $SID."-500") $special = true; if ($this->attributes['sambaSID'][0] == $SID."-500") $special = true;
if ($this->attributes['sambaSID'][0] == $SID."-501") $special = true; if ($this->attributes['sambaSID'][0] == $SID."-501") $special = true;
if (!$special) $this->attributes['sambaSID'][0] == $SID."-".($_SESSION[$this->base]->module['posixAccount']->attributes['uidNumber'][0]*2+$RIDbase); if (!$special) $this->attributes['sambaSID'][0] == $SID."-".($this->getAccountContainer()->module['posixAccount']->attributes['uidNumber'][0]*2+$RIDbase);
$return = $_SESSION[$this->base]->save_module_attributes($this->attributes, $this->orig); $return = $this->getAccountContainer()->save_module_attributes($this->attributes, $this->orig);
return $return; return $return;
} }
@ -619,10 +619,10 @@ class sambaSamAccount extends baseModule {
} }
// host attributes // host attributes
if ($_SESSION[$this->base]->type=='host') { if ($this->getAccountContainer()->type=='host') {
$this->attributes['sambaPrimaryGroupSID'][0] = $SID."-".$this->rids[_('Domain computers')]; $this->attributes['sambaPrimaryGroupSID'][0] = $SID."-".$this->rids[_('Domain computers')];
if ($_POST['ResetSambaPassword'] || !$this->attributes['sambaLMPassword'][0]) { if ($_POST['ResetSambaPassword'] || !$this->attributes['sambaLMPassword'][0]) {
$hostname = $_SESSION[$this->base]->module['posixAccount']->attributes['uid'][0]; $hostname = $this->getAccountContainer()->module['posixAccount']->attributes['uid'][0];
$hostname = substr($hostname, 0, strlen($hostname) - 1); $hostname = substr($hostname, 0, strlen($hostname) - 1);
$this->attributes['sambaLMPassword'][0] = lmPassword($hostname); $this->attributes['sambaLMPassword'][0] = lmPassword($hostname);
$this->attributes['sambaNTPassword'][0] = ntPassword($hostname); $this->attributes['sambaNTPassword'][0] = ntPassword($hostname);
@ -630,7 +630,7 @@ class sambaSamAccount extends baseModule {
} }
} }
// user attributes // user attributes
if ($_SESSION[$this->base]->type=='user') { if ($this->getAccountContainer()->type=='user') {
$this->attributes['sambaHomePath'][0] = $_POST['sambaHomePath']; $this->attributes['sambaHomePath'][0] = $_POST['sambaHomePath'];
if ($_POST['sambaHomeDrive'] == "-") if ($_POST['sambaHomeDrive'] == "-")
$this->attributes['sambaHomeDrive'][0] = ''; $this->attributes['sambaHomeDrive'][0] = '';
@ -648,7 +648,7 @@ class sambaSamAccount extends baseModule {
} }
} }
if (!$wrid) { if (!$wrid) {
$gidnumber = $_SESSION[$this->base]->module['posixAccount']->attributes['gidNumber'][0]; $gidnumber = $this->getAccountContainer()->module['posixAccount']->attributes['gidNumber'][0];
$groups = $_SESSION['cache']->get_cache(array('gidNumber', 'sambaSID'), 'sambaGroupMapping', 'group'); $groups = $_SESSION['cache']->get_cache(array('gidNumber', 'sambaSID'), 'sambaGroupMapping', 'group');
$groupKeys = array_keys($groups); $groupKeys = array_keys($groups);
for ($i = 0; $i < sizeof($groupKeys); $i++) { for ($i = 0; $i < sizeof($groupKeys); $i++) {
@ -663,8 +663,8 @@ class sambaSamAccount extends baseModule {
if ($_POST['useunixpwd']) { if ($_POST['useunixpwd']) {
$this->useunixpwd = true; $this->useunixpwd = true;
$this->attributes['sambaLMPassword'][0] = lmPassword($_SESSION[$this->base]->module['posixAccount']->clearTextPassword); $this->attributes['sambaLMPassword'][0] = lmPassword($this->getAccountContainer()->module['posixAccount']->clearTextPassword);
$this->attributes['sambaNTPassword'][0] = ntPassword($_SESSION[$this->base]->module['posixAccount']->clearTextPassword); $this->attributes['sambaNTPassword'][0] = ntPassword($this->getAccountContainer()->module['posixAccount']->clearTextPassword);
$this->attributes['sambaPwdLastSet'][0] = time(); $this->attributes['sambaPwdLastSet'][0] = time();
} }
else $this->useunixpwd = false; else $this->useunixpwd = false;
@ -692,18 +692,18 @@ class sambaSamAccount extends baseModule {
$rid = substr($this->attributes['sambaSID'][0], strrpos($this->attributes['sambaSID'][0], '-') + 1, strlen($this->attributes['sambaSID'][0])); $rid = substr($this->attributes['sambaSID'][0], strrpos($this->attributes['sambaSID'][0], '-') + 1, strlen($this->attributes['sambaSID'][0]));
// change only if not yet set or previously set to special SID // change only if not yet set or previously set to special SID
if (!$this->attributes['sambaSID'][0] || in_array($rid, $this->rids)) { if (!$this->attributes['sambaSID'][0] || in_array($rid, $this->rids)) {
$this->attributes['sambaSID'][0] = $SID."-". (($_SESSION[$this->base]->module['posixAccount']->attributes['uidNumber'][0]*2)+$RIDbase); $this->attributes['sambaSID'][0] = $SID."-". (($this->getAccountContainer()->module['posixAccount']->attributes['uidNumber'][0]*2)+$RIDbase);
} }
} }
// Check values // Check values
$this->attributes['sambaHomePath'][0] = str_replace('$user', $_SESSION[$this->base]->module['posixAccount']->attributes['uid'][0], $this->attributes['sambaHomePath'][0]); $this->attributes['sambaHomePath'][0] = str_replace('$user', $this->getAccountContainer()->module['posixAccount']->attributes['uid'][0], $this->attributes['sambaHomePath'][0]);
$this->attributes['sambaHomePath'][0] = str_replace('$group', $_SESSION['cache']->getgrnam($_SESSION[$this->base]->module['posixAccount']->attributes['gidNumber'][0]), $this->attributes['sambaHomePath'][0]); $this->attributes['sambaHomePath'][0] = str_replace('$group', $_SESSION['cache']->getgrnam($this->getAccountContainer()->module['posixAccount']->attributes['gidNumber'][0]), $this->attributes['sambaHomePath'][0]);
if ($this->attributes['sambaHomePath'][0] != $_POST['sambaHomePath']) $errors[] = $this->messages['homePath'][1]; if ($this->attributes['sambaHomePath'][0] != $_POST['sambaHomePath']) $errors[] = $this->messages['homePath'][1];
$this->attributes['sambaLogonScript'][0] = str_replace('$user', $_SESSION[$this->base]->module['posixAccount']->attributes['uid'][0], $this->attributes['sambaLogonScript'][0]); $this->attributes['sambaLogonScript'][0] = str_replace('$user', $this->getAccountContainer()->module['posixAccount']->attributes['uid'][0], $this->attributes['sambaLogonScript'][0]);
$this->attributes['sambaLogonScript'][0] = str_replace('$group', $_SESSION['cache']->getgrnam($_SESSION[$this->base]->module['posixAccount']->attributes['gidNumber'][0]), $this->attributes['sambaLogonScript'][0]); $this->attributes['sambaLogonScript'][0] = str_replace('$group', $_SESSION['cache']->getgrnam($this->getAccountContainer()->module['posixAccount']->attributes['gidNumber'][0]), $this->attributes['sambaLogonScript'][0]);
if ($this->attributes['sambaLogonScript'][0] != $_POST['sambaLogonScript']) $errors[] = $this->messages['logonScript'][1]; if ($this->attributes['sambaLogonScript'][0] != $_POST['sambaLogonScript']) $errors[] = $this->messages['logonScript'][1];
$this->attributes['sambaProfilePath'][0] = str_replace('$user', $_SESSION[$this->base]->module['posixAccount']->attributes['uid'][0], $this->attributes['sambaProfilePath'][0]); $this->attributes['sambaProfilePath'][0] = str_replace('$user', $this->getAccountContainer()->module['posixAccount']->attributes['uid'][0], $this->attributes['sambaProfilePath'][0]);
$this->attributes['sambaProfilePath'][0] = str_replace('$group', $_SESSION['cache']->getgrnam($_SESSION[$this->base]->module['posixAccount']->attributes['gidNumber'][0]), $this->attributes['sambaProfilePath'][0]); $this->attributes['sambaProfilePath'][0] = str_replace('$group', $_SESSION['cache']->getgrnam($this->getAccountContainer()->module['posixAccount']->attributes['gidNumber'][0]), $this->attributes['sambaProfilePath'][0]);
if ($this->attributes['sambaProfilePath'][0] != $_POST['sambaProfilePath']) $errors[] = $this->messages['profilePath'][1]; if ($this->attributes['sambaProfilePath'][0] != $_POST['sambaProfilePath']) $errors[] = $this->messages['profilePath'][1];
if ( (!$this->attributes['sambaHomePath'][0]=='') && (!get_preg($this->attributes['sambaHomePath'][0], 'UNC'))) if ( (!$this->attributes['sambaHomePath'][0]=='') && (!get_preg($this->attributes['sambaHomePath'][0], 'UNC')))
$errors[] = $this->messages['homePath'][0]; $errors[] = $this->messages['homePath'][0];
@ -715,7 +715,7 @@ class sambaSamAccount extends baseModule {
} }
else { // host else { // host
if (!$this->attributes['sambaSID'][0]) { if (!$this->attributes['sambaSID'][0]) {
$this->attributes['sambaSID'][0] = $SID."-". (($_SESSION[$this->base]->module['posixAccount']->attributes['uidNumber'][0]*2)+$RIDbase); $this->attributes['sambaSID'][0] = $SID."-". (($this->getAccountContainer()->module['posixAccount']->attributes['uidNumber'][0]*2)+$RIDbase);
} }
} }
return $errors; return $errors;
@ -729,7 +729,7 @@ class sambaSamAccount extends baseModule {
*/ */
function process_sambaUserWorkstations() { function process_sambaUserWorkstations() {
// Load attributes // Load attributes
if ($_SESSION[$this->base]->type=='user') { if ($this->getAccountContainer()->type=='user') {
if (isset($_POST['availableSambaUserWorkstations']) && isset($_POST['sambaUserWorkstations_add'])) { // Add workstations to list if (isset($_POST['availableSambaUserWorkstations']) && isset($_POST['sambaUserWorkstations_add'])) { // Add workstations to list
$temp = str_replace(' ', '', $this->attributes['sambaUserWorkstations'][0]); $temp = str_replace(' ', '', $this->attributes['sambaUserWorkstations'][0]);
$workstations = explode (',', $temp); $workstations = explode (',', $temp);
@ -878,7 +878,7 @@ class sambaSamAccount extends baseModule {
0 => array('kind' => 'text', 'text' => _('Display name')), 0 => array('kind' => 'text', 'text' => _('Display name')),
1 => array('kind' => 'input', 'type' => 'text', 'name' => 'displayName', 'size' => '20', 'value' => $this->attributes['displayName'][0]), 1 => array('kind' => 'input', 'type' => 'text', 'name' => 'displayName', 'size' => '20', 'value' => $this->attributes['displayName'][0]),
2 => array('kind' => 'help', 'value' => 'displayName')); 2 => array('kind' => 'help', 'value' => 'displayName'));
if ($_SESSION[$this->base]->type=='user') { if ($this->getAccountContainer()->type=='user') {
$return[] = array ( 0 => array ( 'kind' => 'input', 'name' => 'sambaPwdCanChange_h', 'type' => 'hidden', 'value' => $canchangedate['hours']), $return[] = array ( 0 => array ( 'kind' => 'input', 'name' => 'sambaPwdCanChange_h', 'type' => 'hidden', 'value' => $canchangedate['hours']),
1 => array ( 'kind' => 'input', 'name' => 'sambaPwdCanChange_m', 'type' => 'hidden', 'value' => $canchangedate['minutes']), 1 => array ( 'kind' => 'input', 'name' => 'sambaPwdCanChange_m', 'type' => 'hidden', 'value' => $canchangedate['minutes']),
2 => array ( 'kind' => 'input', 'name' => 'sambaPwdCanChange_s', 'type' => 'hidden', 'value' => $canchangedate['seconds']), 2 => array ( 'kind' => 'input', 'name' => 'sambaPwdCanChange_s', 'type' => 'hidden', 'value' => $canchangedate['seconds']),
@ -896,7 +896,7 @@ class sambaSamAccount extends baseModule {
$return[] = array( $return[] = array(
0 => array('kind' => 'text', 'text' => _('Repeat password')), 0 => array('kind' => 'text', 'text' => _('Repeat password')),
1 => array('kind' => 'input', 'name' => 'sambaLMPassword2', 'type' => 'password', 'size' => '20', 'maxlength' => '255')); 1 => array('kind' => 'input', 'name' => 'sambaLMPassword2', 'type' => 'password', 'size' => '20', 'maxlength' => '255'));
if (isset($_SESSION[$this->base]->module['posixAccount']->clearTextPassword)) { if (isset($this->getAccountContainer()->module['posixAccount']->clearTextPassword)) {
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Use Unix password') ), $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Use Unix password') ),
1 => array ( 'kind' => 'input', 'name' => 'useunixpwd', 'type' => 'checkbox', 'checked' => $this->useunixpwd), 1 => array ( 'kind' => 'input', 'name' => 'useunixpwd', 'type' => 'checkbox', 'checked' => $this->useunixpwd),
2 => array ('kind' => 'help', 'value' => 'useunixpwd')); 2 => array ('kind' => 'help', 'value' => 'useunixpwd'));
@ -1003,8 +1003,8 @@ class sambaSamAccount extends baseModule {
} }
else $options[] = $names[$i]; else $options[] = $names[$i];
} }
if ($wrid) $options[] = $_SESSION['cache']->getgrnam($_SESSION[$this->base]->module['posixAccount']->attributes['gidNumber'][0]); if ($wrid) $options[] = $_SESSION['cache']->getgrnam($this->getAccountContainer()->module['posixAccount']->attributes['gidNumber'][0]);
else $selected[] = $_SESSION['cache']->getgrnam($_SESSION[$this->base]->module['posixAccount']->attributes['gidNumber'][0]); else $selected[] = $_SESSION['cache']->getgrnam($this->getAccountContainer()->module['posixAccount']->attributes['gidNumber'][0]);
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Windows group') ), $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Windows group') ),
1 => array ( 'kind' => 'select', 'name' => 'sambaPrimaryGroupSID', 'options' => $options, 'options_selected' => $selected), 1 => array ( 'kind' => 'select', 'name' => 'sambaPrimaryGroupSID', 'options' => $options, 'options_selected' => $selected),
2 => array ( 'kind' => 'help', 'value' => 'group' )); 2 => array ( 'kind' => 'help', 'value' => 'group' ));
@ -1031,13 +1031,13 @@ class sambaSamAccount extends baseModule {
1 => array ( 'kind' => 'select', 'name' => 'sambaDomainName', 'options' => $sambaDomainNames, 'options_selected' => array($sel_domain)), 1 => array ( 'kind' => 'select', 'name' => 'sambaDomainName', 'options' => $sambaDomainNames, 'options_selected' => array($sel_domain)),
2 => array ( 'kind' => 'help', 'value' => 'domain' )); 2 => array ( 'kind' => 'help', 'value' => 'domain' ));
// logon hours // logon hours
if ($_SESSION[$this->base]->type=='user') { if ($this->getAccountContainer()->type=='user') {
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Logon hours') ), $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Logon hours') ),
1 => array ( 'kind' => 'input', 'type' => 'submit', 'name' => 'form_subpage_sambaSamAccount_logonHours_open', 'value' => _('Edit logon hours')), 1 => array ( 'kind' => 'input', 'type' => 'submit', 'name' => 'form_subpage_sambaSamAccount_logonHours_open', 'value' => _('Edit logon hours')),
2 => array ( 'kind' => 'help', 'value' => 'logonHours' )); 2 => array ( 'kind' => 'help', 'value' => 'logonHours' ));
} }
// reset host password // reset host password
if ($_SESSION[$this->base]->type=='host') { if ($this->getAccountContainer()->type=='host') {
$return[] = array ( 0 => array ( 'kind' => 'input', 'name' => 'sambaAcctFlagsW', 'type' => 'hidden', 'value' => 'true' )); $return[] = array ( 0 => array ( 'kind' => 'input', 'name' => 'sambaAcctFlagsW', 'type' => 'hidden', 'value' => 'true' ));
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Reset password') ), $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Reset password') ),
1 => array ( 'kind' => 'input', 'type' => 'submit', 'name' => 'ResetSambaPassword', 'value' => _('Reset')), 1 => array ( 'kind' => 'input', 'type' => 'submit', 'name' => 'ResetSambaPassword', 'value' => _('Reset')),
@ -1058,7 +1058,7 @@ class sambaSamAccount extends baseModule {
* It will output a complete html-table * It will output a complete html-table
*/ */
function display_html_sambaUserWorkstations() { function display_html_sambaUserWorkstations() {
if ($_SESSION[$this->base]->type=='user') { if ($this->getAccountContainer()->type=='user') {
// Get list of all hosts. // Get list of all hosts.
$result = $_SESSION['cache']->get_cache('uid', 'sambaSamAccount', 'host'); $result = $_SESSION['cache']->get_cache('uid', 'sambaSamAccount', 'host');
if (is_array($result)) { if (is_array($result)) {

View File

@ -219,13 +219,13 @@ class shadowAccount extends baseModule {
* <br>"modify" are attributes which have to been modified in LDAP entry * <br>"modify" are attributes which have to been modified in LDAP entry
*/ */
function save_attributes() { function save_attributes() {
$return = $_SESSION[$this->base]->save_module_attributes($this->attributes, $this->orig); $return = $this->getAccountContainer()->save_module_attributes($this->attributes, $this->orig);
// Set shadowLastchange manual. // Set shadowLastchange manual.
if (isset($_SESSION[$this->base]->module['posixAccount']->clearTextPassword)) { if (isset($this->getAccountContainer()->module['posixAccount']->clearTextPassword)) {
$return[$_SESSION[$this->base]->dn]['modify']['shadowLastChange'] = array(intval(time()/3600/24)); $return[$this->getAccountContainer()->dn]['modify']['shadowLastChange'] = array(intval(time()/3600/24));
} }
elseif ($_SESSION[$this->base]->isNewAccount) { elseif ($this->getAccountContainer()->isNewAccount) {
$return[$_SESSION[$this->base]->dn]['add']['shadowLastChange'] = array(intval(time()/3600/24)); $return[$this->getAccountContainer()->dn]['add']['shadowLastChange'] = array(intval(time()/3600/24));
} }
return $return; return $return;
} }