added error message if no domains were found
This commit is contained in:
parent
e6693bbfb2
commit
ab4adf6a61
|
@ -75,6 +75,21 @@ class sambaGroupMapping extends baseModule {
|
||||||
parent::baseModule($scope);
|
parent::baseModule($scope);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the module after it became part of an accountContainer
|
||||||
|
*
|
||||||
|
* @param string $base the name of the accountContainer object ($_SESSION[$base])
|
||||||
|
*/
|
||||||
|
function init($base) {
|
||||||
|
// call parent init
|
||||||
|
parent::init($base);
|
||||||
|
$sambaDomains = search_domains($_SESSION['config']->get_Suffix('domain'));
|
||||||
|
if (sizeof($sambaDomains) == 0) {
|
||||||
|
StatusMessage("ERROR", _('No Samba 3 domains found in LDAP! Please create one first.'), '');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* In this function the LDAP account is built up.
|
* In this function the LDAP account is built up.
|
||||||
*
|
*
|
||||||
|
@ -153,8 +168,11 @@ class sambaGroupMapping extends baseModule {
|
||||||
* It will output a complete html-table
|
* It will output a complete html-table
|
||||||
*/
|
*/
|
||||||
function display_html_attributes(&$post) {
|
function display_html_attributes(&$post) {
|
||||||
// Get Domain SID from name
|
|
||||||
$sambaDomains = search_domains($_SESSION['config']->get_Suffix('domain'));
|
$sambaDomains = search_domains($_SESSION['config']->get_Suffix('domain'));
|
||||||
|
if (sizeof($sambaDomains) == 0) {
|
||||||
|
StatusMessage("ERROR", _('No Samba 3 domains found in LDAP! Please create one first.'), '');
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Get Domain-SID from group SID
|
// Get Domain-SID from group SID
|
||||||
if ($this->attributes['sambaSID'][0]!='')
|
if ($this->attributes['sambaSID'][0]!='')
|
||||||
$domainSID = substr($this->attributes['sambaSID'][0], 0, strrpos($this->attributes['sambaSID'][0], "-"));
|
$domainSID = substr($this->attributes['sambaSID'][0], 0, strrpos($this->attributes['sambaSID'][0], "-"));
|
||||||
|
@ -375,12 +393,15 @@ class sambaGroupMapping extends baseModule {
|
||||||
* @return array list of info/error messages
|
* @return array list of info/error messages
|
||||||
*/
|
*/
|
||||||
function process_attributes(&$post) {
|
function process_attributes(&$post) {
|
||||||
|
$sambaDomains = search_domains($_SESSION['config']->get_Suffix('domain'));
|
||||||
|
if (sizeof($sambaDomains) == 0) {
|
||||||
|
return array(array(array("ERROR", _('No Samba 3 domains found in LDAP! Please create one first.'))));
|
||||||
|
}
|
||||||
// Save attributes
|
// Save attributes
|
||||||
$this->attributes['displayName'][0] = $post['displayName'];
|
$this->attributes['displayName'][0] = $post['displayName'];
|
||||||
$this->attributes['sambaGroupType'][0] = $this->sambaGroupTypes[$post['sambaGroupType']];
|
$this->attributes['sambaGroupType'][0] = $this->sambaGroupTypes[$post['sambaGroupType']];
|
||||||
|
|
||||||
// Get Domain SID from name
|
// Get Domain SID from name
|
||||||
$sambaDomains = search_domains($_SESSION['config']->get_Suffix('domain'));
|
|
||||||
for ($i=0; $i<count($sambaDomains); $i++ )
|
for ($i=0; $i<count($sambaDomains); $i++ )
|
||||||
if ($post['sambaDomainName'] == $sambaDomains[$i]->name) {
|
if ($post['sambaDomainName'] == $sambaDomains[$i]->name) {
|
||||||
$SID = $sambaDomains[$i]->SID;
|
$SID = $sambaDomains[$i]->SID;
|
||||||
|
|
|
@ -37,6 +37,23 @@ $Id$
|
||||||
*/
|
*/
|
||||||
class sambaSamAccount extends baseModule {
|
class sambaSamAccount extends baseModule {
|
||||||
|
|
||||||
|
// Variables
|
||||||
|
/** use unix password as samba password? */
|
||||||
|
var $useunixpwd;
|
||||||
|
/** use no password? */
|
||||||
|
var $nopwd;
|
||||||
|
/** password does not expire? */
|
||||||
|
var $noexpire;
|
||||||
|
/** account deactivated? */
|
||||||
|
var $deactivated;
|
||||||
|
/** array of well known rids */
|
||||||
|
var $rids;
|
||||||
|
/** HEX to binary conversion table */
|
||||||
|
var $hex2bitstring = array('0' => '0000', '1' => '0001', '2' => '0010', '3' => '0011', '4' => '0100',
|
||||||
|
'5' => '0101', '6' => '0110', '7' => '0111', '8' => '1000', '9' => '1001', 'A' => '1010',
|
||||||
|
'B' => '1011', 'C' => '1100', 'D' => '1101', 'E' => '1110', 'F' => '1111');
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new sambaSamAccount object.
|
* Creates a new sambaSamAccount object.
|
||||||
*
|
*
|
||||||
|
@ -412,24 +429,12 @@ class sambaSamAccount extends baseModule {
|
||||||
$this->noexpire = true;
|
$this->noexpire = true;
|
||||||
$this->nopwd = false;
|
$this->nopwd = false;
|
||||||
$this->deactivated = false;
|
$this->deactivated = false;
|
||||||
|
$sambaDomains = search_domains($_SESSION['config']->get_Suffix('domain'));
|
||||||
|
if (sizeof($sambaDomains) == 0) {
|
||||||
|
StatusMessage("ERROR", _('No Samba 3 domains found in LDAP! Please create one first.'), '');
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Variables
|
|
||||||
/** use unix password as samba password? */
|
|
||||||
var $useunixpwd;
|
|
||||||
/** use no password? */
|
|
||||||
var $nopwd;
|
|
||||||
/** password does not expire? */
|
|
||||||
var $noexpire;
|
|
||||||
/** account deactivated? */
|
|
||||||
var $deactivated;
|
|
||||||
/** array of well known rids */
|
|
||||||
var $rids;
|
|
||||||
/** HEX to binary conversion table */
|
|
||||||
var $hex2bitstring = array('0' => '0000', '1' => '0001', '2' => '0010', '3' => '0011', '4' => '0100',
|
|
||||||
'5' => '0101', '6' => '0110', '7' => '0111', '8' => '1000', '9' => '1001', 'A' => '1010',
|
|
||||||
'B' => '1011', 'C' => '1100', 'D' => '1101', 'E' => '1110', 'F' => '1111');
|
|
||||||
|
|
||||||
|
|
||||||
function module_ready() {
|
function module_ready() {
|
||||||
if ($_SESSION[$this->base]->module['posixAccount']->attributes['gidNumber'][0]=='') return false;
|
if ($_SESSION[$this->base]->module['posixAccount']->attributes['gidNumber'][0]=='') return false;
|
||||||
|
@ -501,10 +506,13 @@ class sambaSamAccount extends baseModule {
|
||||||
* @return array list of info/error messages
|
* @return array list of info/error messages
|
||||||
*/
|
*/
|
||||||
function process_attributes(&$post) {
|
function process_attributes(&$post) {
|
||||||
|
$sambaDomains = search_domains($_SESSION['config']->get_Suffix('domain'));
|
||||||
|
if (sizeof($sambaDomains) == 0) {
|
||||||
|
return array(array(array("ERROR", _('No Samba 3 domains found in LDAP! Please create one first.'))));
|
||||||
|
}
|
||||||
// Save attributes
|
// Save attributes
|
||||||
$this->attributes['sambaDomainName'][0] = $post['sambaDomainName'];
|
$this->attributes['sambaDomainName'][0] = $post['sambaDomainName'];
|
||||||
// Get Domain SID from name
|
// Get Domain SID from name
|
||||||
$sambaDomains = search_domains($_SESSION['config']->get_Suffix('domain'));
|
|
||||||
for ($i=0; $i<count($sambaDomains); $i++ )
|
for ($i=0; $i<count($sambaDomains); $i++ )
|
||||||
if ($this->attributes['sambaDomainName'][0] == $sambaDomains[$i]->name) {
|
if ($this->attributes['sambaDomainName'][0] == $sambaDomains[$i]->name) {
|
||||||
$SID = $sambaDomains[$i]->SID;
|
$SID = $sambaDomains[$i]->SID;
|
||||||
|
@ -752,9 +760,13 @@ class sambaSamAccount extends baseModule {
|
||||||
*/
|
*/
|
||||||
function display_html_attributes(&$post) {
|
function display_html_attributes(&$post) {
|
||||||
// Get Domain SID from user SID
|
// Get Domain SID from user SID
|
||||||
|
$sambaDomains = search_domains($_SESSION['config']->get_Suffix('domain'));
|
||||||
|
if (sizeof($sambaDomains) == 0) {
|
||||||
|
StatusMessage("ERROR", _('No Samba 3 domains found in LDAP! Please create one first.'), '');
|
||||||
|
return;
|
||||||
|
}
|
||||||
if ($this->attributes['sambaSID'][0]!='')
|
if ($this->attributes['sambaSID'][0]!='')
|
||||||
$domainSID = substr($this->attributes['sambaSID'][0], 0, strrpos($this->attributes['sambaSID'][0], "-"));
|
$domainSID = substr($this->attributes['sambaSID'][0], 0, strrpos($this->attributes['sambaSID'][0], "-"));
|
||||||
$sambaDomains = search_domains($_SESSION['config']->get_Suffix('domain'));
|
|
||||||
for ($i=0; $i<count($sambaDomains); $i++ ) {
|
for ($i=0; $i<count($sambaDomains); $i++ ) {
|
||||||
$sambaDomainNames[] = $sambaDomains[$i]->name;
|
$sambaDomainNames[] = $sambaDomains[$i]->name;
|
||||||
if ($domainSID == $sambaDomains[$i]->SID) {
|
if ($domainSID == $sambaDomains[$i]->SID) {
|
||||||
|
|
Loading…
Reference in New Issue