Ejemplo n.º 1
0
/**
 * Function called when editing a group
 */
function _ppolicy_baseGroupEdit($ldapArr, $postArr)
{
    if (!isset($ldapArr["cn"][0])) {
        return;
    }
    $default = getDefaultPPolicyName();
    $f = new DivForModule(_T("Password policy management", "ppolicy"), "#FDF");
    $f->push(new Table());
    $ppolicyList = listPPolicy();
    if (count($ppolicyList) > 1) {
        $ppolicyTpl = new SelectItem("ppolicyname");
        foreach ($ppolicyList as $pp) {
            $name = $pp[1]['cn'][0];
            if (isset($pp[1]['description'][0])) {
                $desc = $pp[1]['description'][0];
            } else {
                $desc = $name;
            }
            if ($name == $default) {
                $name = "";
                $desc = _T($desc, "ppolicy");
            }
            $values[$desc] = $name;
        }
        $ppolicyTpl->setElements(array_keys($values));
        $ppolicyTpl->setElementsVal(array_values($values));
        $f->add(new TrFormElement(_T("Apply a password policy for all group users", "ppolicy"), $ppolicyTpl, array("tooltip" => _T("If not set the default password policy is enforced.", "ppolicy"))), array("value" => $ppolicyName));
    }
    $f->pop();
    $f->display();
}
Ejemplo n.º 2
0
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with MMC.  If not, see <http://www.gnu.org/licenses/>.
 */
require_once "modules/ppolicy/includes/ppolicy.inc.php";
if (isset($_GET["filter"])) {
    $filter = $_GET["filter"];
} else {
    $filter = "";
}
$editActions = array();
$delActions = array();
$ppolicies = array();
foreach (listPPolicy($filter) as $dn => $entry) {
    $name = $entry[1]["cn"][0];
    $desc = '';
    if (isset($entry[1]["description"][0])) {
        $desc = $entry[1]["description"][0];
    }
    # don't allow to remove the default password policy
    if ($name == getDefaultPPolicyName()) {
        $desc = _T($desc, "ppolicy");
        $editActions[] = new ActionItem(_T("Edit password policy", "ppolicy"), "editppolicy", "edit", "ppolicy", "base", "users");
        $delActions[] = new EmptyActionItem();
    } else {
        $editActions[] = new ActionItem(_T("Edit password policy", "ppolicy"), "editppolicy", "edit", "ppolicy", "base", "users");
        $delActions[] = new ActionPopupItem(_T("Delete password policy", "ppolicy"), "deleteppolicy", "delete", "ppolicy", "base", "users");
    }
    $ppolicies[$name] = '(' . $desc . ')';