Example #1
0
function del_user($login, $files)
{
    callPluginFunction("delUser", array($login));
    if ($files == "on") {
        $fichier = 1;
    } else {
        $fichier = 0;
    }
    $param = array($login, $fichier);
    xmlCall("base.delUserFromAllGroups", $login);
    return xmlCall("base.delUser", $param);
}
Example #2
0
$sidemenu->forceActiveItem($activeItem);
$p->setSideMenu($sidemenu);
$p->display();
// create the form
$f = new ValidatingForm(array('method' => 'POST', 'enctype' => 'multipart/form-data'));
// add submit button
$f->addValidateButton("buser");
// enable/disable buttons
if ($mode == 'edit') {
    $f->addButton("enableAccount", _("Enable account"), "btnSecondary");
    $f->addButton("disableAccount", _("Disable account"), "btnSecondary");
}
// add reset form button
$f->addCancelButton("breset");
// add all modules forms to the edit form
$modules = callPluginFunction("baseEdit", array($FH, $mode));
foreach ($modules as $module => $editForm) {
    $f->push($editForm);
    $f->pop();
}
// display the form
$f->display();
?>
<script type="text/javascript">
jQuery(function(){
    var $ = jQuery;
    $('input.btnPrimary').click(function () {
        $('select#secondary.list option').prop('selected', true);
    });
});
</script>
Example #3
0
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */
if ($_SESSION["AUTH_METHOD"] == "login" || isset($_POST["bback"])) {
    header("Location: " . urlStrRedirect("base/users/index"));
    exit;
}
require "modules/base/includes/users.inc.php";
require "graph/header.inc.php";
require "localSidebar.php";
require "graph/navbar.inc.php";
$user = $_SESSION["login"];
$p = new PageGenerator(_("Reset your password"));
$p->setSideMenu($sidemenu);
$p->display();
if (isset($_POST["bchpasswd"]) && $_POST["newpass"] != "" && $_POST["newpass"] == $_POST["confpass"]) {
    callPluginFunction("changeUserPasswd", array(array($user, prepare_string($_POST["newpass"]), "", False)));
    if (!isXMLRPCError()) {
        $n = new NotifyWidgetSuccess(_("Your password has been changed."));
    }
    header("Location: " . urlStrRedirect("base/users/index"));
    exit;
} else {
    ?>
<form action="<?php 
    echo "main.php?module=base&submod=users&action=resetpasswd";
    ?>
" method="post">
<p><?php 
    echo _("You are going to change your password");
    ?>
</p>
Example #4
0
<?php 
if ($_GET["action"] == "add") {
    $formElt = new InputTpl("groupname", "/^[a-zA-Z][0-9_a-zA-Z-]*\$/");
} else {
    $formElt = new HiddenTpl("groupname");
}
$tr = new TrFormElement(_("Group name"), $formElt);
$tr->display(array("value" => $groupname, "required" => True));
$tr = new TrFormElement(_("Description"), new InputTpl("groupdesc"));
$tr->display(array("value" => $groupdesc));
?>

</table>

<?php 
callPluginFunction("baseGroupEdit", array($detailArr, $_POST));
?>

<?php 
if ($_GET["action"] == "add") {
    ?>
<input name="badd" type="submit" class="btnPrimary" value="<?php 
    echo _("Create");
    ?>
" />
<?php 
} else {
    ?>
<input name="groupname" type="hidden" value="<?php 
    echo $groupname;
    ?>
Example #5
0
 function modify()
 {
     if ($this->modifiable) {
         $user = $this->user;
         $login = $user["login"];
         // the following are not permitted to be changed yet
         unset($user["login"], $user["firstname"], $user["surname"], $user["homedir"], $user["createhomedir"], $user["primaryGroup"]);
         if (key_exists("password", $user)) {
             $ret = callPluginFunction("changeUserPasswd", array(array($login, prepare_string($user["password"]))));
             if (isXMLRPCError()) {
                 foreach ($ret as $info) {
                     $this->result .= _("Password not updated") . "<br/>";
                 }
                 # set errorStatus to 0 in order to make next xmlcalls
                 global $errorStatus;
                 $errorStatus = 0;
             } else {
                 //update result display
                 $this->result .= _("Password updated.") . "<br />";
             }
             unset($user["password"]);
         }
         if (count($user) > 0) {
             foreach ($user as $attribute => $value) {
                 if ($this->checkAttribute($attribute)) {
                     changeUserAttributes($login, $attribute, $value);
                 } else {
                     unset($user[$attribute]);
                 }
             }
             $this->result .= count($user) . _T("Attribute(s) modified", "bulkimport");
         }
     }
 }
Example #6
0
            }
        }
        sort($members);
        reset($members);
    } else {
        if (isset($_POST["bconfirm"])) {
            $curmem = get_members($group);
            $newmem = array_diff($members, $curmem);
            $delmem = array_diff($curmem, $members);
            foreach ($newmem as $new) {
                add_member($group, $new);
                callPluginFunction("addUserToGroup", array($new, $group));
            }
            foreach ($delmem as $del) {
                del_member($group, $del);
                callPluginFunction("delUserFromGroup", array($del, $group));
            }
            if (!isXMLRPCError()) {
                new NotifyWidgetSuccess(_("Group successfully modified"));
            }
            $members = get_members($group);
        } else {
            $members = get_members($group);
            # get an array with all user's attributes
            $users = get_users(true);
        }
    }
}
$diff = array();
foreach ($users as $user) {
    if (!in_array($user['uid'], $members)) {
Example #7
0
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * MMC is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * 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, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */
require "modules/base/includes/groups.inc.php";
if (isset($_POST["bconfirm"])) {
    $group = $_POST["groupname"];
    $ret = callPluginFunction("delGroup", array($group), True);
    if (!isXMLRPCError()) {
        # get code/result messages for each module
        foreach ($ret as $module) {
            if ($module['code'] > 0) {
                $err .= $module['info'];
            } else {
                $info .= $module['info'];
            }
        }
        # display popup
        if (isset($err)) {
            new NotifyWidgetFailure($err);
        } else {
            if (isset($info)) {
                new NotifyWidgetSuccess($info);
Example #8
0
                if ($FH->getValue($attr) == "off") {
                    $value = "FALSE";
                }
                setPPolicyAttribute($attr, $value, $name);
                $update .= "<li>" . $info[0] . "</li>";
            } else {
                if ($FH->isUpdated($attr)) {
                    setPPolicyAttribute($attr, $FH->getValue($attr), $name);
                    $update .= "<li>" . $info[0] . "</li>";
                }
            }
        }
        if ($update) {
            $result .= _T("Attributes updated", "ppolicy") . ": <ul>" . $update . "</ul>";
        }
        callPluginFunction("changePasswordPolicy", array($FH, $mode));
    }
    if ($error) {
        new NotifyWidgetFailure($error);
    }
    if (isXMLRPCError()) {
        $FH->isError(true);
    } else {
        $FH->isError(false);
        if ($result) {
            new NotifyWidgetSuccess($result);
        }
        header("Location: " . urlStrRedirect("base/users/editppolicy", array("ppolicy" => $name)));
        exit;
    }
}