more private class variables
This commit is contained in:
parent
ce13d4eb07
commit
daadf5e28a
|
@ -43,7 +43,7 @@ abstract class baseModule {
|
|||
protected $meta;
|
||||
|
||||
/** the account type of this module (user, group, host) */
|
||||
protected $scope;
|
||||
private $scope;
|
||||
|
||||
/** configuration settings of all modules */
|
||||
protected $moduleSettings;
|
||||
|
@ -80,7 +80,7 @@ abstract class baseModule {
|
|||
/**
|
||||
* This function fills the $messages variable with output messages from this module.
|
||||
*/
|
||||
function load_Messages() {
|
||||
protected function load_Messages() {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -760,10 +760,10 @@ class accountContainer {
|
|||
* This variale stores the account type.
|
||||
* Currently "user", "group" and "host" are supported.
|
||||
*/
|
||||
var $type;
|
||||
private $type;
|
||||
|
||||
/** This is an array with all module objects */
|
||||
var $module;
|
||||
private $module;
|
||||
|
||||
/** DN suffix of the account */
|
||||
var $dn;
|
||||
|
@ -778,16 +778,16 @@ class accountContainer {
|
|||
var $attributes_orig;
|
||||
|
||||
/** Module order */
|
||||
var $order;
|
||||
private $order;
|
||||
|
||||
/** Name of accountContainer variable in session */
|
||||
private $base;
|
||||
|
||||
/** This variable stores the name of the currently displayed page */
|
||||
var $current_page;
|
||||
private $current_page;
|
||||
|
||||
/** This variable is set to the pagename of a subpage if it should be displayed */
|
||||
var $subpage;
|
||||
private $subpage;
|
||||
|
||||
/** True if this is a newly created account */
|
||||
var $isNewAccount;
|
||||
|
|
|
@ -261,19 +261,19 @@ class kolabUser extends baseModule {
|
|||
*/
|
||||
function display_html_attributes() {
|
||||
if ($this->getAccountContainer()->isNewAccount) {
|
||||
if (isset($this->getAccountContainer()->module['posixAccount'])) {
|
||||
if (!$this->getAccountContainer()->module['posixAccount']->attributes['userPassword'][0]) {
|
||||
StatusMessage('ERROR', _("Please enter a user password on this page: %s"), '', array($this->getAccountContainer()->module['posixAccount']->get_alias()));
|
||||
if (isset($this->getAccountContainer()->getAccountModule('posixAccount'))) {
|
||||
if (!$this->getAccountContainer()->getAccountModule('posixAccount')->attributes['userPassword'][0]) {
|
||||
StatusMessage('ERROR', _("Please enter a user password on this page: %s"), '', array($this->getAccountContainer()->getAccountModule('posixAccount')->get_alias()));
|
||||
}
|
||||
}
|
||||
elseif (isset($this->getAccountContainer()->module['inetOrgPerson'])) {
|
||||
if (!$this->getAccountContainer()->module['inetOrgPerson']->attributes['userPassword'][0]) {
|
||||
StatusMessage('ERROR', _("Please enter a user password on this page: %s"), '', array($this->getAccountContainer()->module['inetOrgPerson']->get_alias()));
|
||||
elseif (isset($this->getAccountContainer()->getAccountModule('inetOrgPerson'))) {
|
||||
if (!$this->getAccountContainer()->getAccountModule('inetOrgPerson')->attributes['userPassword'][0]) {
|
||||
StatusMessage('ERROR', _("Please enter a user password on this page: %s"), '', array($this->getAccountContainer()->getAccountModule('inetOrgPerson')->get_alias()));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!$this->getAccountContainer()->module['inetOrgPerson']->attributes['mail'][0]) {
|
||||
StatusMessage('ERROR', _("Please enter an email address on this page: %s"), '', array($this->getAccountContainer()->module['inetOrgPerson']->get_alias()));
|
||||
if (!$this->getAccountContainer()->getAccountModule('inetOrgPerson')->attributes['mail'][0]) {
|
||||
StatusMessage('ERROR', _("Please enter an email address on this page: %s"), '', array($this->getAccountContainer()->getAccountModule('inetOrgPerson')->get_alias()));
|
||||
}
|
||||
$return = array();
|
||||
// check if account is marked for deletion
|
||||
|
@ -581,13 +581,13 @@ class kolabUser extends baseModule {
|
|||
* @return true, if account can be saved
|
||||
*/
|
||||
function module_complete() {
|
||||
if (!$this->getAccountContainer()->module['inetOrgPerson']->attributes['mail'][0]) return false;
|
||||
if (!$this->getAccountContainer()->getAccountModule('inetOrgPerson')->attributes['mail'][0]) return false;
|
||||
if ($this->getAccountContainer()->isNewAccount) {
|
||||
if (isset($this->getAccountContainer()->module['posixAccount'])) {
|
||||
if (!$this->getAccountContainer()->module['posixAccount']->attributes['userPassword'][0]) return false;
|
||||
if (isset($this->getAccountContainer()->getAccountModule('posixAccount'))) {
|
||||
if (!$this->getAccountContainer()->getAccountModule('posixAccount')->attributes['userPassword'][0]) return false;
|
||||
}
|
||||
elseif (isset($this->getAccountContainer()->module['inetOrgPerson'])) {
|
||||
if (!$this->getAccountContainer()->module['inetOrgPerson']->attributes['userPassword'][0]) return false;
|
||||
elseif (isset($this->getAccountContainer()->getAccountModule('inetOrgPerson'))) {
|
||||
if (!$this->getAccountContainer()->getAccountModule('inetOrgPerson')->attributes['userPassword'][0]) return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -182,7 +182,7 @@ class posixAccount extends baseModule {
|
|||
// upload
|
||||
$return['upload_preDepends'] = array('inetOrgPerson');
|
||||
// user specific upload options
|
||||
if (($this->scope == 'user') && $_SESSION['loggedIn']) {
|
||||
if (($this->get_scope() == 'user') && $_SESSION['loggedIn']) {
|
||||
$return['upload_columns'] = array(
|
||||
array(
|
||||
'name' => 'posixAccount_userName',
|
||||
|
@ -262,7 +262,7 @@ class posixAccount extends baseModule {
|
|||
);
|
||||
}
|
||||
// host specific upload options
|
||||
elseif ($this->scope == 'host') {
|
||||
elseif ($this->get_scope() == 'host') {
|
||||
$return['upload_columns'] = array(
|
||||
array(
|
||||
'name' => 'posixAccount_hostName',
|
||||
|
@ -673,15 +673,15 @@ class posixAccount extends baseModule {
|
|||
$this->attributes['uid'][0] = $_POST['uid'];
|
||||
$this->attributes['cn'][0] = $_POST['cn'];
|
||||
if ($this->attributes['cn'][0] == '') {
|
||||
if (($this->scope == 'host') && (substr($_POST['uid'], -1, 1) == '$')) {
|
||||
if (($this->get_scope() == 'host') && (substr($_POST['uid'], -1, 1) == '$')) {
|
||||
$this->attributes['cn'][0] = substr($_POST['uid'], 0, strlen($_POST['uid']) - 1);
|
||||
}
|
||||
elseif (isset($this->getAccountContainer()->module['inetOrgPerson'])) {
|
||||
if ($this->getAccountContainer()->module['inetOrgPerson']->attributes['givenName'][0]) {
|
||||
$this->attributes['cn'][0] = $this->getAccountContainer()->module['inetOrgPerson']->attributes['givenName'][0] . " " . $this->getAccountContainer()->module['inetOrgPerson']->attributes['sn'][0];
|
||||
elseif (isset($this->getAccountContainer()->getAccountModule('inetOrgPerson'))) {
|
||||
if ($this->getAccountContainer()->getAccountModule('inetOrgPerson')->attributes['givenName'][0]) {
|
||||
$this->attributes['cn'][0] = $this->getAccountContainer()->getAccountModule('inetOrgPerson')->attributes['givenName'][0] . " " . $this->getAccountContainer()->getAccountModule('inetOrgPerson')->attributes['sn'][0];
|
||||
}
|
||||
elseif ($this->getAccountContainer()->module['inetOrgPerson']->attributes['sn'][0]) {
|
||||
$this->attributes['cn'][0] = $this->getAccountContainer()->module['inetOrgPerson']->attributes['sn'][0];
|
||||
elseif ($this->getAccountContainer()->getAccountModule('inetOrgPerson')->attributes['sn'][0]) {
|
||||
$this->attributes['cn'][0] = $this->getAccountContainer()->getAccountModule('inetOrgPerson')->attributes['sn'][0];
|
||||
}
|
||||
else {
|
||||
$this->attributes['cn'][0] = $_POST['uid'];
|
||||
|
@ -698,11 +698,11 @@ class posixAccount extends baseModule {
|
|||
$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
|
||||
// load min and may uidNumber
|
||||
if ($this->getAccountContainer()->type=='user') {
|
||||
if ($this->get_scope()=='user') {
|
||||
$minID = intval($this->moduleSettings['posixAccount_minUID'][0]);
|
||||
$maxID = intval($this->moduleSettings['posixAccount_maxUID'][0]);
|
||||
}
|
||||
if ($this->getAccountContainer()->type=='host') {
|
||||
if ($this->get_scope()=='host') {
|
||||
$minID = intval($this->moduleSettings['posixAccount_minMachine'][0]);
|
||||
$maxID = intval($this->moduleSettings['posixAccount_maxMachine'][0]);
|
||||
}
|
||||
|
@ -742,13 +742,13 @@ class posixAccount extends baseModule {
|
|||
}
|
||||
}
|
||||
}
|
||||
if ($this->getAccountContainer()->type=='user') {
|
||||
if ($this->get_scope()=='user') {
|
||||
if (($this->attributes['uid'][0] != $_POST['uid']) && !get_preg($_POST['uid'], '!upper'))
|
||||
$errors[] = $this->messages['uid'][1];
|
||||
if ( !get_preg($this->attributes['homeDirectory'][0], 'homeDirectory' ))
|
||||
$errors[] = $this->messages['homeDirectory'][0];
|
||||
}
|
||||
if ($this->getAccountContainer()->type=='user') {
|
||||
if ($this->get_scope()=='user') {
|
||||
$this->attributes['homeDirectory'][0] = str_replace('$group', $_SESSION['cache']->getgrnam($this->attributes['gidNumber'][0]), $this->attributes['homeDirectory'][0]);
|
||||
if ($this->attributes['uid'][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'))
|
||||
$errors[] = $this->messages['uid'][2];
|
||||
}
|
||||
if ($this->getAccountContainer()->type=='host') {
|
||||
if ($this->get_scope()=='host') {
|
||||
// add "$" to uid if needed
|
||||
if (substr($this->attributes['uid'][0], -1, 1) != '$') {
|
||||
$this->attributes['uid'][0] .= '$';
|
||||
|
@ -781,13 +781,13 @@ class posixAccount extends baseModule {
|
|||
// Change uid to a new uid until a free uid is found
|
||||
else
|
||||
while ($_SESSION['cache']->in_cache($this->attributes['uid'][0], 'uid', array('user', 'host'))) {
|
||||
if ($this->getAccountContainer()->type=='host') $this->attributes['uid'][0] = substr($this->attributes['uid'][0], 0, -1);
|
||||
if ($this->get_scope()=='host') $this->attributes['uid'][0] = substr($this->attributes['uid'][0], 0, -1);
|
||||
// get last character of username
|
||||
$lastchar = substr($this->attributes['uid'][0], strlen($this->attributes['uid'][0])-1, 1);
|
||||
// Last character is no number
|
||||
if ( !ereg('^([0-9])+$', $lastchar)) {
|
||||
// Last character is no number. Therefore we only have to add "2" to it.
|
||||
if ($this->getAccountContainer()->type=='host') {
|
||||
if ($this->get_scope()=='host') {
|
||||
$this->attributes['uid'][0] = $this->attributes['uid'][0] . '2$';
|
||||
}
|
||||
else {
|
||||
|
@ -811,14 +811,14 @@ class posixAccount extends baseModule {
|
|||
$firstchars = substr($this->attributes['uid'][0], 0, $i+1);
|
||||
$lastchars = substr($this->attributes['uid'][0], $i+1, strlen($this->attributes['uid'][0])-$i);
|
||||
// Put username together
|
||||
if ($this->getAccountContainer()->type=='host') $this->attributes['uid'][0] = $firstchars . (intval($lastchars)+1)."$";
|
||||
if ($this->get_scope()=='host') $this->attributes['uid'][0] = $firstchars . (intval($lastchars)+1)."$";
|
||||
else $this->attributes['uid'][0] = $firstchars . (intval($lastchars)+1);
|
||||
}
|
||||
}
|
||||
// Show warning if lam has changed username
|
||||
if ($this->attributes['uid'][0] != $_POST['uid']) {
|
||||
if ($this->getAccountContainer()->type=='user') $errors[] = $this->messages['uid'][5];
|
||||
if ($this->getAccountContainer()->type=='host') $errors[] = $this->messages['uid'][6];
|
||||
if ($this->get_scope()=='user') $errors[] = $this->messages['uid'][5];
|
||||
if ($this->get_scope()=='host') $errors[] = $this->messages['uid'][6];
|
||||
}
|
||||
$attributeList = array('gecos', 'homeDirectory');
|
||||
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]))),
|
||||
2 => array('kind' => 'help', 'value' => 'gidNumber'));
|
||||
|
||||
if ($this->getAccountContainer()->type=='user') {
|
||||
if ($this->get_scope()=='user') {
|
||||
$return[] = array(
|
||||
0 => array('kind' => 'text', 'text' => _('Additional groups')),
|
||||
1 => array('kind' => 'input', 'name' => 'form_subpage_posixAccount_group_open', 'type' => 'submit', 'value' => _('Edit groups')),
|
||||
|
@ -994,7 +994,7 @@ class posixAccount extends baseModule {
|
|||
}
|
||||
|
||||
function display_html_delete() {
|
||||
if ($this->scope == 'user' && isset($_SESSION['config']->scriptPath)) {
|
||||
if ($this->get_scope() == 'user' && isset($_SESSION['config']->scriptPath)) {
|
||||
$return[] = array (
|
||||
0 => array('kind' => 'text', 'text' => _('Delete home directory')),
|
||||
1 => array('kind' => 'input', 'name' => 'deletehomedir', 'type' => 'checkbox'),
|
||||
|
@ -1077,7 +1077,7 @@ class posixAccount extends baseModule {
|
|||
*/
|
||||
function get_profileOptions() {
|
||||
$return = array();
|
||||
if ($this->scope == 'user') {
|
||||
if ($this->get_scope() == 'user') {
|
||||
$groups = $_SESSION['cache']->findgroups(); // list of all groupnames
|
||||
$shelllist = getshells(); // list of all valid shells
|
||||
// primary Unix group
|
||||
|
@ -1098,7 +1098,7 @@ class posixAccount extends baseModule {
|
|||
1 => array('kind' => 'select', 'name' => 'posixAccount_loginShell', 'options' => $shelllist, 'options_selected' => array("/bin/bash")),
|
||||
2 => array('kind' => 'help', 'value' => 'loginShell', 'scope' => 'user'));
|
||||
}
|
||||
elseif ($this->scope == 'host') {
|
||||
elseif ($this->get_scope() == 'host') {
|
||||
$groups = $_SESSION['cache']->findgroups(); // list of all groupnames
|
||||
// primary Unix group
|
||||
$return[] = array(0 => array('kind' => 'text', 'text' => _('Primary group') . ": "),
|
||||
|
@ -1312,7 +1312,7 @@ class posixAccount extends baseModule {
|
|||
if ($gecos != "") $partialAccounts[$i]['gecos'] = $gecos;
|
||||
}
|
||||
// user specific attributes
|
||||
if ($this->scope == 'user') {
|
||||
if ($this->get_scope() == 'user') {
|
||||
// additional groups
|
||||
if ($rawAccounts[$i][$ids['posixAccount_additionalGroups']] != "") {
|
||||
$groups = explode(",", $rawAccounts[$i][$ids['posixAccount_additionalGroups']]);
|
||||
|
@ -1414,7 +1414,7 @@ class posixAccount extends baseModule {
|
|||
}
|
||||
}
|
||||
// host specific attributes
|
||||
elseif ($this->scope == 'host') {
|
||||
elseif ($this->get_scope() == 'host') {
|
||||
// host name
|
||||
if (in_array($rawAccounts[$i][$ids['posixAccount_hostName']], $existingUsers)) {
|
||||
$errMsg = $this->messages['uid'][10];
|
||||
|
@ -1579,7 +1579,7 @@ class posixAccount extends baseModule {
|
|||
*/
|
||||
function getNextUIDs($count, &$errors) {
|
||||
$ret = array();
|
||||
if ($this->scope == "user") {
|
||||
if ($this->get_scope() == "user") {
|
||||
$minID = intval($this->moduleSettings['posixAccount_minUID'][0]);
|
||||
$maxID = intval($this->moduleSettings['posixAccount_maxUID'][0]);
|
||||
}
|
||||
|
|
|
@ -163,8 +163,8 @@ class quota extends baseModule {
|
|||
}
|
||||
|
||||
function module_ready() {
|
||||
if ($this->getAccountContainer()->type=='user' && $this->getAccountContainer()->module['posixAccount']->attributes['uid'][0]=='') return false;
|
||||
if ($this->getAccountContainer()->type=='group' && $this->getAccountContainer()->module['posixGroup']->attributes['cn'][0]=='') return false;
|
||||
if ($this->get_scope()=='user' && $this->getAccountContainer()->getAccountModule('posixAccount')->attributes['uid'][0]=='') return false;
|
||||
if ($this->get_scope()=='group' && $this->getAccountContainer()->getAccountModule('posixGroup')->attributes['cn'][0]=='') return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -184,8 +184,8 @@ class quota extends baseModule {
|
|||
function postModifyActions($newAccount) {
|
||||
if (!isset($this->quota) || !is_array($this->quota)) return;
|
||||
// determine if this is a user or group account
|
||||
if ($this->getAccountContainer()->type=='user') $id = $this->getAccountContainer()->module['posixAccount']->attributes['uid'][0];
|
||||
if ($this->getAccountContainer()->type=='group') $id = $this->getAccountContainer()->module['posixGroup']->attributes['cn'][0];
|
||||
if ($this->get_scope()=='user') $id = $this->getAccountContainer()->getAccountModule('posixAccount')->attributes['uid'][0];
|
||||
if ($this->get_scope()=='group') $id = $this->getAccountContainer()->getAccountModule('posixGroup')->attributes['cn'][0];
|
||||
// get list of lamdaemon servers
|
||||
$serverDescriptions = array();
|
||||
$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]
|
||||
. ',' . $this->quota[$server][$i][6] . ',' . $this->quota[$server][$i][7] . ':';
|
||||
}
|
||||
$ret = lamdaemon(array($id . " quota set " . $this->getAccountContainer()->type . " $quotastring\n"), $server);
|
||||
$ret = lamdaemon(array($id . " quota set " . $this->get_scope() . " $quotastring\n"), $server);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -218,8 +218,8 @@ class quota extends baseModule {
|
|||
$this->initQuotas();
|
||||
if (!isset($this->quota) || !is_array($this->quota)) return true;
|
||||
// determine if this is a user or group account
|
||||
if ($this->getAccountContainer()->type=='user') $id = $this->getAccountContainer()->module['posixAccount']->attributes['uid'][0];
|
||||
if ($this->getAccountContainer()->type=='group') $id = $this->getAccountContainer()->module['posixGroup']->attributes['cn'][0];
|
||||
if ($this->get_scope()=='user') $id = $this->getAccountContainer()->getAccountModule('posixAccount')->attributes['uid'][0];
|
||||
if ($this->get_scope()=='group') $id = $this->getAccountContainer()->getAccountModule('posixGroup')->attributes['cn'][0];
|
||||
// get list of lamdaemon servers
|
||||
$serverDescriptions = array();
|
||||
$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:';
|
||||
$i++;
|
||||
}
|
||||
$ret = lamdaemon(array($id . " quota set " . $this->getAccountContainer()->type . " $quotastring\n"), $server);
|
||||
$ret = lamdaemon(array($id . " quota set " . $this->get_scope() . " $quotastring\n"), $server);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -674,7 +674,7 @@ class quota extends baseModule {
|
|||
$mpParts = split(":", $mountPoints[$m]);
|
||||
$server = $mpParts[0];
|
||||
$dir = $mpParts[1];
|
||||
$quotaString = $name . " quota set " . $this->scope . " " . $dir . ',' .
|
||||
$quotaString = $name . " quota set " . $this->get_scope() . " " . $dir . ',' .
|
||||
implode(',', $temp['accounts'][$name][$mountPoints[$m]]) . "\n";
|
||||
$result = lamdaemon(array($quotaString), $server);
|
||||
if (is_array($result)) {
|
||||
|
|
|
@ -436,8 +436,8 @@ class sambaAccount extends baseModule {
|
|||
var $rids;
|
||||
|
||||
function module_ready() {
|
||||
if ($this->getAccountContainer()->module['posixAccount']->attributes['gidNumber'][0]=='') return false;
|
||||
if ($this->getAccountContainer()->module['posixAccount']->attributes['uidNumber'][0]=='') return false;
|
||||
if ($this->getAccountContainer()->getAccountModule('posixAccount')->attributes['gidNumber'][0]=='') return false;
|
||||
if ($this->getAccountContainer()->getAccountModule('posixAccount')->attributes['uidNumber'][0]=='') return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -481,7 +481,7 @@ class sambaAccount extends baseModule {
|
|||
*/
|
||||
$special = false;
|
||||
if ($this->attributes['rid'][0] < 1000) $special = true;
|
||||
if (!$special) $this->attributes['rid'][0] == $this->getAccountContainer()->module['posixAccount']->attributes['uidNumber'][0]*2+1000;
|
||||
if (!$special) $this->attributes['rid'][0] == $this->getAccountContainer()->getAccountModule('posixAccount')->attributes['uidNumber'][0]*2+1000;
|
||||
$rids = array_values($this->rids);
|
||||
$wrid = false;
|
||||
for ($i=0; $i<count($rids); $i++) {
|
||||
|
@ -490,7 +490,7 @@ class sambaAccount extends baseModule {
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (!$wrid) $this->attributes['primaryGroupID'][0] = ($this->getAccountContainer()->module['posixAccount']->attributes['gidNumber'][0]*2)+1001;
|
||||
if (!$wrid) $this->attributes['primaryGroupID'][0] = ($this->getAccountContainer()->getAccountModule('posixAccount')->attributes['gidNumber'][0]*2)+1001;
|
||||
$return = $this->getAccountContainer()->save_module_attributes($this->attributes, $this->orig);
|
||||
return $return;
|
||||
}
|
||||
|
@ -544,10 +544,10 @@ class sambaAccount extends baseModule {
|
|||
}
|
||||
|
||||
// host attributes
|
||||
if ($this->getAccountContainer()->type=='host') {
|
||||
if ($this->get_scope()=='host') {
|
||||
$this->attributes['primaryGroupID'][0] = $this->rids[_('Domain computers')];
|
||||
if ($_POST['ResetSambaPassword'] || (!$this->attributes['lmPassword'][0])) {
|
||||
$hostname = $this->getAccountContainer()->module['posixAccount']->attributes['uid'][0];
|
||||
$hostname = $this->getAccountContainer()->getAccountModule('posixAccount')->attributes['uid'][0];
|
||||
$hostname = substr($hostname, 0, strlen($hostname) - 1);
|
||||
$this->attributes['lmPassword'][0] = lmPassword($hostname);
|
||||
$this->attributes['ntPassword'][0] = ntPassword($hostname);
|
||||
|
@ -555,7 +555,7 @@ class sambaAccount extends baseModule {
|
|||
}
|
||||
}
|
||||
// check values for user account
|
||||
if ($this->scope == 'user') {
|
||||
if ($this->get_scope() == 'user') {
|
||||
$this->attributes['pwdCanChange'][0] = mktime(intval($_POST['pwdCanChange_h']), intval($_POST['pwdCanChange_m']),
|
||||
intval($_POST['pwdCanChange_s']), intval($_POST['pwdCanChange_mon']), intval($_POST['pwdCanChange_day']),
|
||||
intval($_POST['pwdCanChange_yea']));
|
||||
|
@ -575,13 +575,13 @@ class sambaAccount extends baseModule {
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (!$wrid) $this->attributes['primaryGroupID'][0] = ($this->getAccountContainer()->module['posixAccount']->attributes['gidNumber'][0]*2)+1001;
|
||||
if (!$wrid) $this->attributes['primaryGroupID'][0] = ($this->getAccountContainer()->getAccountModule('posixAccount')->attributes['gidNumber'][0]*2)+1001;
|
||||
if ($_POST['useunixpwd']) $this->useunixpwd = true;
|
||||
else $this->useunixpwd = false;
|
||||
if ($_POST['useunixpwd']) {
|
||||
$this->useunixpwd = true;
|
||||
$this->attributes['lmPassword'][0] = lmPassword($this->getAccountContainer()->module['posixAccount']->clearTextPassword);
|
||||
$this->attributes['ntPassword'][0] = ntPassword($this->getAccountContainer()->module['posixAccount']->clearTextPassword);
|
||||
$this->attributes['lmPassword'][0] = lmPassword($this->getAccountContainer()->getAccountModule('posixAccount')->clearTextPassword);
|
||||
$this->attributes['ntPassword'][0] = ntPassword($this->getAccountContainer()->getAccountModule('posixAccount')->clearTextPassword);
|
||||
$this->attributes['pwdLastSet'][0] = time();
|
||||
}
|
||||
else $this->useunixpwd = false;
|
||||
|
@ -605,16 +605,16 @@ class sambaAccount extends baseModule {
|
|||
$this->attributes['rid'][0] = $this->rids[$_POST['rid']];
|
||||
}
|
||||
else {
|
||||
$this->attributes['rid'][0] = $this->getAccountContainer()->module['posixAccount']->attributes['uidNumber'][0]*2+1000;
|
||||
$this->attributes['rid'][0] = $this->getAccountContainer()->getAccountModule('posixAccount')->attributes['uidNumber'][0]*2+1000;
|
||||
}
|
||||
$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($this->getAccountContainer()->module['posixAccount']->attributes['gidNumber'][0]), $this->attributes['smbHome'][0]);
|
||||
$this->attributes['smbHome'][0] = str_replace('$user', $this->getAccountContainer()->getAccountModule('posixAccount')->attributes['uid'][0], $this->attributes['smbHome'][0]);
|
||||
$this->attributes['smbHome'][0] = str_replace('$group', $_SESSION['cache']->getgrnam($this->getAccountContainer()->getAccountModule('posixAccount')->attributes['gidNumber'][0]), $this->attributes['smbHome'][0]);
|
||||
if ($this->attributes['smbHome'][0] != $_POST['smbHome']) $errors[] = $this->messages['homePath'][1];
|
||||
$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($this->getAccountContainer()->module['posixAccount']->attributes['gidNumber'][0]), $this->attributes['scriptPath'][0]);
|
||||
$this->attributes['scriptPath'][0] = str_replace('$user', $this->getAccountContainer()->getAccountModule('posixAccount')->attributes['uid'][0], $this->attributes['scriptPath'][0]);
|
||||
$this->attributes['scriptPath'][0] = str_replace('$group', $_SESSION['cache']->getgrnam($this->getAccountContainer()->getAccountModule('posixAccount')->attributes['gidNumber'][0]), $this->attributes['scriptPath'][0]);
|
||||
if ($this->attributes['scriptPath'][0] != $_POST['scriptPath']) $errors[] = $this->messages['logonScript'][1];
|
||||
$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($this->getAccountContainer()->module['posixAccount']->attributes['gidNumber'][0]), $this->attributes['profilePath'][0]);
|
||||
$this->attributes['profilePath'][0] = str_replace('$user', $this->getAccountContainer()->getAccountModule('posixAccount')->attributes['uid'][0], $this->attributes['profilePath'][0]);
|
||||
$this->attributes['profilePath'][0] = str_replace('$group', $_SESSION['cache']->getgrnam($this->getAccountContainer()->getAccountModule('posixAccount')->attributes['gidNumber'][0]), $this->attributes['profilePath'][0]);
|
||||
if ($this->attributes['profiletPath'][0] != $_POST['profilePath']) $errors[] = $this->messages['profilePath'][1];
|
||||
if ( (!$this->attributes['smbHome'][0]=='') && (!get_preg($this->attributes['smbHome'][0], 'UNC')))
|
||||
$errors[] = $this->messages['homePath'][0];
|
||||
|
@ -626,10 +626,10 @@ class sambaAccount extends baseModule {
|
|||
// check values for host account
|
||||
else {
|
||||
if (!$this->attributes['rid'][0]) {
|
||||
$this->attributes['rid'][0] = ($this->getAccountContainer()->module['posixAccount']->attributes['uidNumber'][0] * 2) + 1000;
|
||||
$this->attributes['rid'][0] = ($this->getAccountContainer()->getAccountModule('posixAccount')->attributes['uidNumber'][0] * 2) + 1000;
|
||||
}
|
||||
if (!$this->attributes['primaryGroupID'][0]) {
|
||||
$this->attributes['primaryGroupID'][0] = ($this->getAccountContainer()->module['posixAccount']->attributes['gidNumber'][0] * 2) + 1001;
|
||||
$this->attributes['primaryGroupID'][0] = ($this->getAccountContainer()->getAccountModule('posixAccount')->attributes['gidNumber'][0] * 2) + 1001;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -647,7 +647,7 @@ class sambaAccount extends baseModule {
|
|||
*/
|
||||
function process_userWorkstations() {
|
||||
// Load attributes
|
||||
if ($this->getAccountContainer()->type=='user') {
|
||||
if ($this->get_scope()=='user') {
|
||||
if (isset($_POST['availableUserWorkstations']) && isset($_POST['userWorkstations_add'])) { // Add workstations to list
|
||||
$temp = str_replace(' ', '', $this->attributes['userWorkstations'][0]);
|
||||
$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]),
|
||||
2 => array('kind' => 'help', 'value' => 'displayName'));
|
||||
// user attributes
|
||||
if ($this->getAccountContainer()->type=='user') {
|
||||
if ($this->get_scope()=='user') {
|
||||
if (isset($this->attributes['pwdCanChange'][0])) $canchangedate = getdate(intval($this->attributes['pwdCanChange'][0]));
|
||||
else $canchangedate = getdate(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') ),
|
||||
1 => array('kind' => 'input', 'name' => 'lmPassword2', 'type' => 'password', 'size' => '20', 'maxlength' => '255', 'value' => ''),
|
||||
2 => array('kind' => 'help', 'value' => 'password'));
|
||||
if (isset($this->getAccountContainer()->module['posixAccount']->clearTextPassword)) {
|
||||
if (isset($this->getAccountContainer()->getAccountModule('posixAccount')->clearTextPassword)) {
|
||||
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Use Unix password') ),
|
||||
1 => array ( 'kind' => 'input', 'name' => 'useunixpwd', 'type' => 'checkbox', 'checked' => $this->useunixpwd, 'value' => true),
|
||||
2 => array ('kind' => 'help', 'value' => 'pwdUnix'));
|
||||
|
@ -779,8 +779,8 @@ class sambaAccount extends baseModule {
|
|||
}
|
||||
else $options[] = $names[$i];
|
||||
}
|
||||
if ($wrid) $options[] = $_SESSION['cache']->getgrnam($this->getAccountContainer()->module['posixAccount']->attributes['gidNumber'][0]);
|
||||
else $selected[] = $_SESSION['cache']->getgrnam($this->getAccountContainer()->module['posixAccount']->attributes['gidNumber'][0]);
|
||||
if ($wrid) $options[] = $_SESSION['cache']->getgrnam($this->getAccountContainer()->getAccountModule('posixAccount')->attributes['gidNumber'][0]);
|
||||
else $selected[] = $_SESSION['cache']->getgrnam($this->getAccountContainer()->getAccountModule('posixAccount')->attributes['gidNumber'][0]);
|
||||
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Windows group') ),
|
||||
1 => array ( 'kind' => 'select', 'name' => 'primaryGroupID', 'options' => $options, 'options_selected' => $selected),
|
||||
2 => array ( 'kind' => 'help', 'value' => 'group' ));
|
||||
|
@ -803,7 +803,7 @@ class sambaAccount extends baseModule {
|
|||
$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]),
|
||||
2 => array ( 'kind' => 'help', 'value' => 'domain' ));
|
||||
if ($this->getAccountContainer()->type=='host') {
|
||||
if ($this->get_scope()=='host') {
|
||||
$return[] = array ( 0 => array ( 'kind' => 'input', 'name' => 'acctFlagsW', 'type' => 'hidden', 'value' => 'true' ));
|
||||
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Reset password') ),
|
||||
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
|
||||
*/
|
||||
function display_html_userWorkstations() {
|
||||
if ($this->getAccountContainer()->type=='user') {
|
||||
if ($this->get_scope()=='user') {
|
||||
// Get list of all hosts.
|
||||
$result = $_SESSION['cache']->get_cache('uid', 'sambaAccount', 'host');
|
||||
if (is_array($result)) {
|
||||
|
|
|
@ -200,8 +200,8 @@ class sambaGroupMapping extends baseModule {
|
|||
}
|
||||
else $options[] = $names[$i];
|
||||
}
|
||||
if ($wrid) $options[] = $this->getAccountContainer()->module['posixGroup']->attributes['cn'][0];
|
||||
else $selected[] = $this->getAccountContainer()->module['posixGroup']->attributes['cn'][0];
|
||||
if ($wrid) $options[] = $this->getAccountContainer()->getAccountModule('posixGroup')->attributes['cn'][0];
|
||||
else $selected[] = $this->getAccountContainer()->getAccountModule('posixGroup')->attributes['cn'][0];
|
||||
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Windows group') ),
|
||||
1 => array ( 'kind' => 'select', 'name' => 'sambaSID', 'options' => $options, 'options_selected' => $selected),
|
||||
2 => array ( 'kind' => 'help', 'value' => 'sambaSID' ));
|
||||
|
@ -390,7 +390,7 @@ class sambaGroupMapping extends baseModule {
|
|||
|
||||
|
||||
function module_ready() {
|
||||
if ($this->getAccountContainer()->module['posixGroup']->attributes['gidNumber'][0]=='') return false;
|
||||
if ($this->getAccountContainer()->getAccountModule('posixGroup')->attributes['gidNumber'][0]=='') return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -438,7 +438,7 @@ class sambaGroupMapping extends baseModule {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (!$wrid) $this->attributes['sambaSID'][0] = $SID . "-" . ($this->getAccountContainer()->module['posixGroup']->attributes['gidNumber'][0]*2+$RIDbase+1);
|
||||
if (!$wrid) $this->attributes['sambaSID'][0] = $SID . "-" . ($this->getAccountContainer()->getAccountModule('posixGroup')->attributes['gidNumber'][0]*2+$RIDbase+1);
|
||||
// Return error-messages
|
||||
return $errors;
|
||||
}
|
||||
|
@ -470,7 +470,7 @@ class sambaGroupMapping extends baseModule {
|
|||
$wrid=true;
|
||||
}
|
||||
}
|
||||
if (!$wrid) $this->attributes['sambaSID'][0] == $SID."-".($this->getAccountContainer()->module['posixGroup']->attributes['gidNumber'][0]*2+1+$RIDbase);
|
||||
if (!$wrid) $this->attributes['sambaSID'][0] == $SID."-".($this->getAccountContainer()->getAccountModule('posixGroup')->attributes['gidNumber'][0]*2+1+$RIDbase);
|
||||
$return = $this->getAccountContainer()->save_module_attributes($this->attributes, $this->orig);
|
||||
|
||||
return $return;
|
||||
|
|
|
@ -492,9 +492,9 @@ class sambaSamAccount extends baseModule {
|
|||
* @return boolean true, if page can be displayed
|
||||
*/
|
||||
function module_ready() {
|
||||
if ($this->getAccountContainer()->module['posixAccount']->attributes['gidNumber'][0]=='') return false;
|
||||
if ($this->getAccountContainer()->module['posixAccount']->attributes['uidNumber'][0]=='') return false;
|
||||
if ($this->getAccountContainer()->module['posixAccount']->attributes['uid'][0]=='') return false;
|
||||
if ($this->getAccountContainer()->getAccountModule('posixAccount')->attributes['gidNumber'][0]=='') return false;
|
||||
if ($this->getAccountContainer()->getAccountModule('posixAccount')->attributes['uidNumber'][0]=='') return false;
|
||||
if ($this->getAccountContainer()->getAccountModule('posixAccount')->attributes['uid'][0]=='') return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -549,7 +549,7 @@ class sambaSamAccount extends baseModule {
|
|||
$special = false;
|
||||
if ($this->attributes['sambaSID'][0] == $SID."-500") $special = true;
|
||||
if ($this->attributes['sambaSID'][0] == $SID."-501") $special = true;
|
||||
if (!$special) $this->attributes['sambaSID'][0] == $SID."-".($this->getAccountContainer()->module['posixAccount']->attributes['uidNumber'][0]*2+$RIDbase);
|
||||
if (!$special) $this->attributes['sambaSID'][0] == $SID."-".($this->getAccountContainer()->getAccountModule('posixAccount')->attributes['uidNumber'][0]*2+$RIDbase);
|
||||
|
||||
$return = $this->getAccountContainer()->save_module_attributes($this->attributes, $this->orig);
|
||||
|
||||
|
@ -619,10 +619,10 @@ class sambaSamAccount extends baseModule {
|
|||
}
|
||||
|
||||
// host attributes
|
||||
if ($this->getAccountContainer()->type=='host') {
|
||||
if ($this->get_scope()=='host') {
|
||||
$this->attributes['sambaPrimaryGroupSID'][0] = $SID."-".$this->rids[_('Domain computers')];
|
||||
if ($_POST['ResetSambaPassword'] || !$this->attributes['sambaLMPassword'][0]) {
|
||||
$hostname = $this->getAccountContainer()->module['posixAccount']->attributes['uid'][0];
|
||||
$hostname = $this->getAccountContainer()->getAccountModule('posixAccount')->attributes['uid'][0];
|
||||
$hostname = substr($hostname, 0, strlen($hostname) - 1);
|
||||
$this->attributes['sambaLMPassword'][0] = lmPassword($hostname);
|
||||
$this->attributes['sambaNTPassword'][0] = ntPassword($hostname);
|
||||
|
@ -630,7 +630,7 @@ class sambaSamAccount extends baseModule {
|
|||
}
|
||||
}
|
||||
// user attributes
|
||||
if ($this->getAccountContainer()->type=='user') {
|
||||
if ($this->get_scope()=='user') {
|
||||
$this->attributes['sambaHomePath'][0] = $_POST['sambaHomePath'];
|
||||
if ($_POST['sambaHomeDrive'] == "-")
|
||||
$this->attributes['sambaHomeDrive'][0] = '';
|
||||
|
@ -648,7 +648,7 @@ class sambaSamAccount extends baseModule {
|
|||
}
|
||||
}
|
||||
if (!$wrid) {
|
||||
$gidnumber = $this->getAccountContainer()->module['posixAccount']->attributes['gidNumber'][0];
|
||||
$gidnumber = $this->getAccountContainer()->getAccountModule('posixAccount')->attributes['gidNumber'][0];
|
||||
$groups = $_SESSION['cache']->get_cache(array('gidNumber', 'sambaSID'), 'sambaGroupMapping', 'group');
|
||||
$groupKeys = array_keys($groups);
|
||||
for ($i = 0; $i < sizeof($groupKeys); $i++) {
|
||||
|
@ -663,8 +663,8 @@ class sambaSamAccount extends baseModule {
|
|||
|
||||
if ($_POST['useunixpwd']) {
|
||||
$this->useunixpwd = true;
|
||||
$this->attributes['sambaLMPassword'][0] = lmPassword($this->getAccountContainer()->module['posixAccount']->clearTextPassword);
|
||||
$this->attributes['sambaNTPassword'][0] = ntPassword($this->getAccountContainer()->module['posixAccount']->clearTextPassword);
|
||||
$this->attributes['sambaLMPassword'][0] = lmPassword($this->getAccountContainer()->getAccountModule('posixAccount')->clearTextPassword);
|
||||
$this->attributes['sambaNTPassword'][0] = ntPassword($this->getAccountContainer()->getAccountModule('posixAccount')->clearTextPassword);
|
||||
$this->attributes['sambaPwdLastSet'][0] = time();
|
||||
}
|
||||
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]));
|
||||
// change only if not yet set or previously set to special SID
|
||||
if (!$this->attributes['sambaSID'][0] || in_array($rid, $this->rids)) {
|
||||
$this->attributes['sambaSID'][0] = $SID."-". (($this->getAccountContainer()->module['posixAccount']->attributes['uidNumber'][0]*2)+$RIDbase);
|
||||
$this->attributes['sambaSID'][0] = $SID."-". (($this->getAccountContainer()->getAccountModule('posixAccount')->attributes['uidNumber'][0]*2)+$RIDbase);
|
||||
}
|
||||
}
|
||||
// Check values
|
||||
$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($this->getAccountContainer()->module['posixAccount']->attributes['gidNumber'][0]), $this->attributes['sambaHomePath'][0]);
|
||||
$this->attributes['sambaHomePath'][0] = str_replace('$user', $this->getAccountContainer()->getAccountModule('posixAccount')->attributes['uid'][0], $this->attributes['sambaHomePath'][0]);
|
||||
$this->attributes['sambaHomePath'][0] = str_replace('$group', $_SESSION['cache']->getgrnam($this->getAccountContainer()->getAccountModule('posixAccount')->attributes['gidNumber'][0]), $this->attributes['sambaHomePath'][0]);
|
||||
if ($this->attributes['sambaHomePath'][0] != $_POST['sambaHomePath']) $errors[] = $this->messages['homePath'][1];
|
||||
$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($this->getAccountContainer()->module['posixAccount']->attributes['gidNumber'][0]), $this->attributes['sambaLogonScript'][0]);
|
||||
$this->attributes['sambaLogonScript'][0] = str_replace('$user', $this->getAccountContainer()->getAccountModule('posixAccount')->attributes['uid'][0], $this->attributes['sambaLogonScript'][0]);
|
||||
$this->attributes['sambaLogonScript'][0] = str_replace('$group', $_SESSION['cache']->getgrnam($this->getAccountContainer()->getAccountModule('posixAccount')->attributes['gidNumber'][0]), $this->attributes['sambaLogonScript'][0]);
|
||||
if ($this->attributes['sambaLogonScript'][0] != $_POST['sambaLogonScript']) $errors[] = $this->messages['logonScript'][1];
|
||||
$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($this->getAccountContainer()->module['posixAccount']->attributes['gidNumber'][0]), $this->attributes['sambaProfilePath'][0]);
|
||||
$this->attributes['sambaProfilePath'][0] = str_replace('$user', $this->getAccountContainer()->getAccountModule('posixAccount')->attributes['uid'][0], $this->attributes['sambaProfilePath'][0]);
|
||||
$this->attributes['sambaProfilePath'][0] = str_replace('$group', $_SESSION['cache']->getgrnam($this->getAccountContainer()->getAccountModule('posixAccount')->attributes['gidNumber'][0]), $this->attributes['sambaProfilePath'][0]);
|
||||
if ($this->attributes['sambaProfilePath'][0] != $_POST['sambaProfilePath']) $errors[] = $this->messages['profilePath'][1];
|
||||
if ( (!$this->attributes['sambaHomePath'][0]=='') && (!get_preg($this->attributes['sambaHomePath'][0], 'UNC')))
|
||||
$errors[] = $this->messages['homePath'][0];
|
||||
|
@ -715,7 +715,7 @@ class sambaSamAccount extends baseModule {
|
|||
}
|
||||
else { // host
|
||||
if (!$this->attributes['sambaSID'][0]) {
|
||||
$this->attributes['sambaSID'][0] = $SID."-". (($this->getAccountContainer()->module['posixAccount']->attributes['uidNumber'][0]*2)+$RIDbase);
|
||||
$this->attributes['sambaSID'][0] = $SID."-". (($this->getAccountContainer()->getAccountModule('posixAccount')->attributes['uidNumber'][0]*2)+$RIDbase);
|
||||
}
|
||||
}
|
||||
return $errors;
|
||||
|
@ -729,7 +729,7 @@ class sambaSamAccount extends baseModule {
|
|||
*/
|
||||
function process_sambaUserWorkstations() {
|
||||
// Load attributes
|
||||
if ($this->getAccountContainer()->type=='user') {
|
||||
if ($this->get_scope()=='user') {
|
||||
if (isset($_POST['availableSambaUserWorkstations']) && isset($_POST['sambaUserWorkstations_add'])) { // Add workstations to list
|
||||
$temp = str_replace(' ', '', $this->attributes['sambaUserWorkstations'][0]);
|
||||
$workstations = explode (',', $temp);
|
||||
|
@ -878,7 +878,7 @@ class sambaSamAccount extends baseModule {
|
|||
0 => array('kind' => 'text', 'text' => _('Display name')),
|
||||
1 => array('kind' => 'input', 'type' => 'text', 'name' => 'displayName', 'size' => '20', 'value' => $this->attributes['displayName'][0]),
|
||||
2 => array('kind' => 'help', 'value' => 'displayName'));
|
||||
if ($this->getAccountContainer()->type=='user') {
|
||||
if ($this->get_scope()=='user') {
|
||||
$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']),
|
||||
2 => array ( 'kind' => 'input', 'name' => 'sambaPwdCanChange_s', 'type' => 'hidden', 'value' => $canchangedate['seconds']),
|
||||
|
@ -896,7 +896,7 @@ class sambaSamAccount extends baseModule {
|
|||
$return[] = array(
|
||||
0 => array('kind' => 'text', 'text' => _('Repeat password')),
|
||||
1 => array('kind' => 'input', 'name' => 'sambaLMPassword2', 'type' => 'password', 'size' => '20', 'maxlength' => '255'));
|
||||
if (isset($this->getAccountContainer()->module['posixAccount']->clearTextPassword)) {
|
||||
if (isset($this->getAccountContainer()->getAccountModule('posixAccount')->clearTextPassword)) {
|
||||
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Use Unix password') ),
|
||||
1 => array ( 'kind' => 'input', 'name' => 'useunixpwd', 'type' => 'checkbox', 'checked' => $this->useunixpwd),
|
||||
2 => array ('kind' => 'help', 'value' => 'useunixpwd'));
|
||||
|
@ -1003,8 +1003,8 @@ class sambaSamAccount extends baseModule {
|
|||
}
|
||||
else $options[] = $names[$i];
|
||||
}
|
||||
if ($wrid) $options[] = $_SESSION['cache']->getgrnam($this->getAccountContainer()->module['posixAccount']->attributes['gidNumber'][0]);
|
||||
else $selected[] = $_SESSION['cache']->getgrnam($this->getAccountContainer()->module['posixAccount']->attributes['gidNumber'][0]);
|
||||
if ($wrid) $options[] = $_SESSION['cache']->getgrnam($this->getAccountContainer()->getAccountModule('posixAccount')->attributes['gidNumber'][0]);
|
||||
else $selected[] = $_SESSION['cache']->getgrnam($this->getAccountContainer()->getAccountModule('posixAccount')->attributes['gidNumber'][0]);
|
||||
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Windows group') ),
|
||||
1 => array ( 'kind' => 'select', 'name' => 'sambaPrimaryGroupSID', 'options' => $options, 'options_selected' => $selected),
|
||||
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)),
|
||||
2 => array ( 'kind' => 'help', 'value' => 'domain' ));
|
||||
// logon hours
|
||||
if ($this->getAccountContainer()->type=='user') {
|
||||
if ($this->get_scope()=='user') {
|
||||
$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')),
|
||||
2 => array ( 'kind' => 'help', 'value' => 'logonHours' ));
|
||||
}
|
||||
// reset host password
|
||||
if ($this->getAccountContainer()->type=='host') {
|
||||
if ($this->get_scope()=='host') {
|
||||
$return[] = array ( 0 => array ( 'kind' => 'input', 'name' => 'sambaAcctFlagsW', 'type' => 'hidden', 'value' => 'true' ));
|
||||
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Reset password') ),
|
||||
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
|
||||
*/
|
||||
function display_html_sambaUserWorkstations() {
|
||||
if ($this->getAccountContainer()->type=='user') {
|
||||
if ($this->get_scope()=='user') {
|
||||
// Get list of all hosts.
|
||||
$result = $_SESSION['cache']->get_cache('uid', 'sambaSamAccount', 'host');
|
||||
if (is_array($result)) {
|
||||
|
|
|
@ -221,7 +221,7 @@ class shadowAccount extends baseModule {
|
|||
function save_attributes() {
|
||||
$return = $this->getAccountContainer()->save_module_attributes($this->attributes, $this->orig);
|
||||
// Set shadowLastchange manual.
|
||||
if (isset($this->getAccountContainer()->module['posixAccount']->clearTextPassword)) {
|
||||
if (isset($this->getAccountContainer()->getAccountModule('posixAccount')->clearTextPassword)) {
|
||||
$return[$this->getAccountContainer()->dn]['modify']['shadowLastChange'] = array(intval(time()/3600/24));
|
||||
}
|
||||
elseif ($this->getAccountContainer()->isNewAccount) {
|
||||
|
|
Loading…
Reference in New Issue