packages/ssoinabox-webui/root/usr/local/share/ssoinabox/htdocs/includes/users.php
author Dan Fuhry <dan@fuhry.us>
Sat, 16 Feb 2013 20:47:45 -0500
changeset 7 faf6f7941e8f
parent 0 3906ca745819
permissions -rw-r--r--
Enhancements to User CP - handle attribute deletion/mod more gracefully

<?php

function disable_user($username)
{
	ldap_replace_attr(ldap_make_user_dn($username), 'loginShell', '/sbin/nologin');
	kadm5_disable_user($username);
}

function enable_user($username)
{
	ldap_replace_attr(ldap_make_user_dn($username), 'loginShell', '/bin/bash');
	kadm5_enable_user($username);
}

function is_user_enabled($username)
{
	return kadm5_is_user_unexpired($username);
}

function delete_user($username)
{
	ldap_delete_user($username);
	kadm5_delete_user($username);
}

function create_user($username, $password, $gn, $sn, $cn, $title)
{
	return ldap_create_user($username, $gn, $sn, $cn, $title) &&
		kadm5_create_user($username, $password);
}

function reset_password($username, $password)
{
	return kadm5_reset_password($username, $password);
}

function create_group($gid, $desc)
{
	return ldap_create_group($gid, $desc);
}

function delete_group($gid)
{
	return ldap_delete_group($gid);
}