added rfc2307bisPosixGroup

This commit is contained in:
Roland Gruber 2008-12-18 14:59:02 +00:00
parent 9884026d0e
commit 244886f50f
1 changed files with 25 additions and 7 deletions

View File

@ -4,6 +4,7 @@ $Id$
This code is part of LDAP Account Manager (http://www.sourceforge.net/projects/lam) This code is part of LDAP Account Manager (http://www.sourceforge.net/projects/lam)
Copyright (C) 2003 - 2006 Tilo Lutz Copyright (C) 2003 - 2006 Tilo Lutz
2007 - 2008 Roland Gruber
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -74,7 +75,7 @@ class quota extends baseModule {
$return["alias"] = _('Quota'); $return["alias"] = _('Quota');
if ($this->get_scope() == 'group') { if ($this->get_scope() == 'group') {
// module dependencies // module dependencies
$return['dependencies'] = array('depends' => array('posixGroup'), 'conflicts' => array()); $return['dependencies'] = array('depends' => array(array('posixGroup', 'rfc2307bisPosixGroup')), 'conflicts' => array());
} }
if ($this->get_scope() == 'user') { if ($this->get_scope() == 'user') {
// module dependencies // module dependencies
@ -184,6 +185,24 @@ class quota extends baseModule {
} }
} }
/**
* Gets the cn from the Unix group module.
*
* @return String cn attribute
*/
private function getCn() {
$modules = array('posixGroup', 'groupOfNames', 'groupOfUniqueNames');
for ($i = 0; $i < sizeof($modules); $i++) {
if ($this->getAccountContainer()->getAccountModule($modules[$i]) != null) {
$attrs = $this->getAccountContainer()->getAccountModule($modules[$i])->getAttributes();
if (isset($attrs['cn'][0])) {
return $attrs['cn'][0];
}
}
}
return null;
}
/** /**
* This function is used to check if this module page can be displayed. * This function is used to check if this module page can be displayed.
* It returns false if a module depends on data from other modules which was not yet entered. * It returns false if a module depends on data from other modules which was not yet entered.
@ -196,8 +215,9 @@ class quota extends baseModule {
if ($attrs['uid'][0]=='') return false; if ($attrs['uid'][0]=='') return false;
} }
if ($this->get_scope()=='group') { if ($this->get_scope()=='group') {
$attrs = $this->getAccountContainer()->getAccountModule('posixGroup')->getAttributes(); if (($this->getCn() == null) || ($this->getCn() == '')) {
if ($attrs['cn'][0]=='') return false; return false;
}
} }
return true; return true;
} }
@ -215,8 +235,7 @@ class quota extends baseModule {
$id = $attrs['uid'][0]; $id = $attrs['uid'][0];
} }
if ($this->get_scope()=='group') { if ($this->get_scope()=='group') {
$attrs = $this->getAccountContainer()->getAccountModule('posixGroup')->getAttributes(); $id = $this->getCn();
$id = $attrs['cn'][0];
} }
// get list of lamdaemon servers // get list of lamdaemon servers
$serverDescriptions = array(); $serverDescriptions = array();
@ -255,8 +274,7 @@ class quota extends baseModule {
$id = $attrs['uid'][0]; $id = $attrs['uid'][0];
} }
if ($this->get_scope()=='group') { if ($this->get_scope()=='group') {
$attrs = $this->getAccountContainer()->getAccountModule('posixGroup')->getAttributes(); $id = $this->getCn();
$id = $attrs['cn'][0];
} }
// get list of lamdaemon servers // get list of lamdaemon servers
$serverDescriptions = array(); $serverDescriptions = array();