new type API
This commit is contained in:
parent
6022dee5a0
commit
0ac6fc6c2e
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
use \LAM\TYPES\TypeManager;
|
||||
/*
|
||||
$Id$
|
||||
|
||||
|
@ -966,11 +967,12 @@ class inetOrgPerson extends baseModule implements passwordService {
|
|||
}
|
||||
// password status change
|
||||
if (!$this->isUnixActive()) {
|
||||
if ((pwd_is_enabled($this->orig['userPassword'][0]) && pwd_is_enabled($this->attributes['userPassword'][0]))
|
||||
|| (!pwd_is_enabled($this->orig['userPassword'][0]) && !pwd_is_enabled($this->attributes['userPassword'][0]))) {
|
||||
$pwdOrig = empty($this->orig['userPassword'][0]) ? '' : $this->orig['userPassword'][0];
|
||||
$pwdNew = empty($this->attributes['userPassword'][0]) ? '' : $this->attributes['userPassword'][0];
|
||||
if ((pwd_is_enabled($pwdOrig) && pwd_is_enabled($pwdNew)) || (!pwd_is_enabled($pwdOrig) && !pwd_is_enabled($pwdNew))) {
|
||||
$return[$this->getAccountContainer()->dn_orig]['info']['userPasswordStatusChange'][0] = 'unchanged';
|
||||
}
|
||||
elseif (pwd_is_enabled($this->orig['userPassword'][0])) {
|
||||
elseif (pwd_is_enabled($pwdOrig)) {
|
||||
$return[$this->getAccountContainer()->dn_orig]['info']['userPasswordStatusChange'][0] = 'locked';
|
||||
}
|
||||
else {
|
||||
|
@ -3600,14 +3602,17 @@ class inetOrgPerson extends baseModule implements passwordService {
|
|||
$configContainer = new htmlTable();
|
||||
if (isset($_SESSION['conf_config'])) {
|
||||
// add password hash type if posixAccount is inactive
|
||||
$confActiveUnixModules = $_SESSION['conf_config']->get_AccountModules('user');
|
||||
if (in_array('host', $_SESSION['conf_config']->get_ActiveTypes())) {
|
||||
$confActiveUnixModules = array_merge($confActiveUnixModules, $_SESSION['conf_config']->get_AccountModules('host'));
|
||||
$unixModuleFound = false;
|
||||
$typeManager = new TypeManager($_SESSION['conf_config']);
|
||||
$types = $typeManager->getConfiguredTypesForScopes(array('user', 'group'));
|
||||
foreach ($types as $type) {
|
||||
$modules = $type->getModules();
|
||||
if (in_array('posixAccount', $modules) || in_array('posixGroup', $modules)) {
|
||||
$unixModuleFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (in_array('group', $_SESSION['conf_config']->get_ActiveTypes())) {
|
||||
$confActiveUnixModules = array_merge($confActiveUnixModules, $_SESSION['conf_config']->get_AccountModules('group'));
|
||||
}
|
||||
if (!in_array('posixAccount', $confActiveUnixModules) && !in_array('posixGroup', $confActiveUnixModules)) {
|
||||
if (!$unixModuleFound) {
|
||||
$optionsSelected = array('SSHA');
|
||||
$hashOption = new htmlTable();
|
||||
$hashOption->addElement(new htmlTableExtendedSelect('posixAccount_pwdHash', getSupportedHashTypes(), $optionsSelected, _("Password hash type"), 'pwdHash'));
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
$Id$
|
||||
|
||||
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
||||
Copyright (C) 2004 - 2015 Roland Gruber
|
||||
Copyright (C) 2004 - 2017 Roland Gruber
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -484,15 +484,7 @@ class nisMailAlias extends baseModule {
|
|||
if ($this->cachedMailList != null) {
|
||||
return $this->cachedMailList;
|
||||
}
|
||||
$objectClass = 'inetOrgPerson';
|
||||
$activeTypes = $_SESSION['config']->get_ActiveTypes();
|
||||
if (in_array('user', $activeTypes)) {
|
||||
$userModules = $_SESSION['config']->get_AccountModules('user');
|
||||
if (in_array('windowsUser', $userModules)) {
|
||||
$objectClass = 'user';
|
||||
}
|
||||
}
|
||||
$this->cachedMailList = searchLDAPByAttribute('mail', '*', $objectClass, array('mail'), array('user'));
|
||||
$this->cachedMailList = searchLDAPByAttribute('mail', '*', null, array('mail'), array('user'));
|
||||
for ($i = 0; $i < sizeof($this->cachedMailList); $i++) {
|
||||
$this->cachedMailList[$i] = $this->cachedMailList[$i]['mail'][0];
|
||||
}
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
<?php
|
||||
use \LAM\TYPES\TypeManager;
|
||||
/*
|
||||
$Id$
|
||||
|
||||
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
||||
Copyright (C) 2014 - 2015 Roland Gruber
|
||||
Copyright (C) 2014 - 2017 Roland Gruber
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -634,8 +635,9 @@ class nisMailAliasUser extends baseModule {
|
|||
* @return boolean is active
|
||||
*/
|
||||
private function isMailAliasTypeActive() {
|
||||
$activeTypes = $_SESSION['config']->get_ActiveTypes();
|
||||
return in_array('mailAlias', $activeTypes);
|
||||
$typeManager = new TypeManager();
|
||||
$activeTypes = $typeManager->getConfiguredTypesForScope('mailAlias');
|
||||
return !empty($activeTypes);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue