Look: Mise aux normes de la fiche utilisateur, New: Ajout du nom du module en rapport avec les droits sur la liste des droits
This commit is contained in:
parent
68653fd072
commit
a1494cd493
@ -1,6 +1,7 @@
|
|||||||
<?PHP
|
<?PHP
|
||||||
/* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
|
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||||
|
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@ -24,6 +25,8 @@ require("./pre.inc.php");
|
|||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
|
$action=isset($_GET["action"])?$_GET["action"]:$_POST["action"];
|
||||||
|
|
||||||
if ($_GET["subaction"] == 'addrights' && $user->admin)
|
if ($_GET["subaction"] == 'addrights' && $user->admin)
|
||||||
{
|
{
|
||||||
$edituser = new User($db,$_GET["id"]);
|
$edituser = new User($db,$_GET["id"]);
|
||||||
@ -36,7 +39,7 @@ if ($_GET["subaction"] == 'delrights' && $user->admin)
|
|||||||
$edituser->delrights($_GET["rights"]);
|
$edituser->delrights($_GET["rights"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($HTTP_POST_VARS["action"] == 'confirm_delete' && $HTTP_POST_VARS["confirm"] == "yes")
|
if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == "yes")
|
||||||
{
|
{
|
||||||
if ($id <> $user->id)
|
if ($id <> $user->id)
|
||||||
{
|
{
|
||||||
@ -47,18 +50,17 @@ if ($HTTP_POST_VARS["action"] == 'confirm_delete' && $HTTP_POST_VARS["confirm"]
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($_POST["action"] == 'add' && $user->admin)
|
||||||
if ($HTTP_POST_VARS["action"] == 'add' && $user->admin)
|
|
||||||
{
|
{
|
||||||
$edituser = new User($db,0);
|
$edituser = new User($db,0);
|
||||||
|
|
||||||
$edituser->nom = $HTTP_POST_VARS["nom"];
|
$edituser->nom = $_POST["nom"];
|
||||||
$edituser->note = $HTTP_POST_VARS["note"];
|
$edituser->note = $_POST["note"];
|
||||||
$edituser->prenom = $HTTP_POST_VARS["prenom"];
|
$edituser->prenom = $_POST["prenom"];
|
||||||
$edituser->login = $HTTP_POST_VARS["login"];
|
$edituser->login = $_POST["login"];
|
||||||
$edituser->email = $HTTP_POST_VARS["email"];
|
$edituser->email = $_POST["email"];
|
||||||
$edituser->admin = $HTTP_POST_VARS["admin"];
|
$edituser->admin = $_POST["admin"];
|
||||||
$edituser->webcal_login = $HTTP_POST_VARS["webcal_login"];
|
$edituser->webcal_login = $_POST["webcal_login"];
|
||||||
|
|
||||||
$id = $edituser->create();
|
$id = $edituser->create();
|
||||||
if (isset($_POST['password']) && $_POST['password']!='' )
|
if (isset($_POST['password']) && $_POST['password']!='' )
|
||||||
@ -101,8 +103,10 @@ if ($action == 'password' && $user->admin)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
|
|
||||||
|
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* Nouvel utilisateur */
|
/* Nouvel utilisateur */
|
||||||
@ -112,7 +116,8 @@ llxHeader();
|
|||||||
if ($action == 'create')
|
if ($action == 'create')
|
||||||
{
|
{
|
||||||
|
|
||||||
print '<div class="titre">Nouvel utilisateur</div><br>';
|
print_titre('Nouvel utilisateur');
|
||||||
|
|
||||||
print '<form action="'.$PHP_SELF.'" method="post">';
|
print '<form action="'.$PHP_SELF.'" method="post">';
|
||||||
print '<input type="hidden" name="action" value="add">';
|
print '<input type="hidden" name="action" value="add">';
|
||||||
|
|
||||||
@ -164,31 +169,25 @@ else
|
|||||||
$fuser = new User($db, $_GET["id"]);
|
$fuser = new User($db, $_GET["id"]);
|
||||||
$fuser->fetch();
|
$fuser->fetch();
|
||||||
|
|
||||||
print_fiche_titre("Fiche utilisateur",$message);
|
/*
|
||||||
|
* Confirmation suppression
|
||||||
if ($request == 'delete')
|
*/
|
||||||
|
if ($action == 'delete')
|
||||||
{
|
{
|
||||||
print '<form method="post" action="'.$PHP_SELF.'?id='.$fuser->id.'">';
|
print_fiche_titre("Suppression fiche utilisateur",$message);
|
||||||
print '<input type="hidden" name="action" value="confirm_delete">';
|
print '<br>';
|
||||||
print '<table class="border" cellspacing="0" border="1" width="100%" cellpadding="3">';
|
|
||||||
|
|
||||||
print "<tr>".'<td colspan="3">Supprimer cet utilisateur</td></tr>';
|
$html = new Form($db);
|
||||||
print "<tr>".'<td class="delete">Etes-vous sur de vouloir supprimer cet utilisateur ?</td><td class="delete">';
|
$html->form_confirm("$PHP_SELF?id=$fuser->id","Supprimer cet utilisateur","Etes-vous sûr de vouloir supprimer cet utilisateur ?","confirm_delete");
|
||||||
$htmls = new Form($db);
|
|
||||||
|
|
||||||
$htmls->selectyesno("confirm","no");
|
|
||||||
|
|
||||||
print "</td>\n";
|
|
||||||
print '<td class="delete" align="center"><input type="submit" value="Confirmer"</td></tr>';
|
|
||||||
print '</table>';
|
|
||||||
print "</form>\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($_GET["action"] == 'perms')
|
||||||
if ($_GET["request"] == 'perms')
|
|
||||||
{
|
{
|
||||||
|
print_fiche_titre("Permissions utilisateur",$message);
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Droits
|
* Ecran ajout/suppression permission
|
||||||
*/
|
*/
|
||||||
|
|
||||||
print '<table class="border" width="100%" border="0" cellpadding="3" cellspacing="0">';
|
print '<table class="border" width="100%" border="0" cellpadding="3" cellspacing="0">';
|
||||||
@ -198,6 +197,7 @@ else
|
|||||||
print '<td width="25%" valign="top">Prénom</td>';
|
print '<td width="25%" valign="top">Prénom</td>';
|
||||||
print '<td width="25%" class="valeur">'.$fuser->prenom.'</td></tr>';
|
print '<td width="25%" class="valeur">'.$fuser->prenom.'</td></tr>';
|
||||||
|
|
||||||
|
// Droits existant
|
||||||
print "<tr>".'<td valign="top" colspan="2">';
|
print "<tr>".'<td valign="top" colspan="2">';
|
||||||
print '<table width="100%" class="noborder" cellpadding="2" cellspacing="0">';
|
print '<table width="100%" class="noborder" cellpadding="2" cellspacing="0">';
|
||||||
$sql = "SELECT r.id, r.libelle, r.module FROM ".MAIN_DB_PREFIX."rights_def as r ORDER BY r.id ASC";
|
$sql = "SELECT r.id, r.libelle, r.module FROM ".MAIN_DB_PREFIX."rights_def as r ORDER BY r.id ASC";
|
||||||
@ -215,7 +215,7 @@ else
|
|||||||
$oldmod = $obj->module;
|
$oldmod = $obj->module;
|
||||||
$var = !$var;
|
$var = !$var;
|
||||||
}
|
}
|
||||||
print '<tr '. $bc[$var].'><td><a href="fiche.php?id='.$fuser->id.'&request=perms&subaction=addrights&rights='.$obj->id.'">Ajouter</a></td><td>';
|
print '<tr '. $bc[$var].'><td><a href="fiche.php?id='.$fuser->id.'&action=perms&subaction=addrights&rights='.$obj->id.'">Ajouter</a></td><td>';
|
||||||
print $obj->libelle . '</td></tr>';
|
print $obj->libelle . '</td></tr>';
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
@ -224,9 +224,8 @@ else
|
|||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '</td><td colspan="2" valign="top">';
|
print '</td><td colspan="2" valign="top">';
|
||||||
/*
|
|
||||||
* Droits
|
// Droits possédés
|
||||||
*/
|
|
||||||
print '<table class="noborder" width="100%" cellpadding="2" cellspacing="0">';
|
print '<table class="noborder" width="100%" cellpadding="2" cellspacing="0">';
|
||||||
$sql = "SELECT r.id, r.libelle, r.module FROM ".MAIN_DB_PREFIX."rights_def as r, ".MAIN_DB_PREFIX."user_rights as ur";
|
$sql = "SELECT r.id, r.libelle, r.module FROM ".MAIN_DB_PREFIX."rights_def as r, ".MAIN_DB_PREFIX."user_rights as ur";
|
||||||
$sql .= " WHERE ur.fk_id = r.id AND ur.fk_user = ".$fuser->id. " ORDER BY r.id ASC";
|
$sql .= " WHERE ur.fk_id = r.id AND ur.fk_user = ".$fuser->id. " ORDER BY r.id ASC";
|
||||||
@ -245,7 +244,7 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
print "<tr $bc[$var]><td>".$obj->libelle . '</td>';
|
print "<tr $bc[$var]><td>".$obj->libelle . '</td>';
|
||||||
print '<td align="right"><a href="fiche.php?id='.$fuser->id.'&request=perms&subaction=delrights&rights='.$obj->id.'">Supprimer</a></td></tr>';
|
print '<td align="right"><a href="fiche.php?id='.$fuser->id.'&action=perms&subaction=delrights&rights='.$obj->id.'">Supprimer</a></td></tr>';
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -253,33 +252,75 @@ else
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
print "<tr>".'<td align="center" colspan="4"><a href="fiche.php?id='.$id.'">ok</a></td></tr></table>';
|
print "<tr>".'<td align="center" colspan="4"><a href="fiche.php?id='.$id.'">ok</a></td></tr></table>';
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
|
||||||
|
if ($_GET["action"] != 'perms' && $_GET["action"] != 'edit')
|
||||||
{
|
{
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Affichage
|
* Affichage onglet
|
||||||
*/
|
*/
|
||||||
|
$h = 0;
|
||||||
|
|
||||||
|
$head[$h][0] = DOL_URL_ROOT.'/soc.php?socid='.$socid;
|
||||||
|
$head[$h][1] = "Fiche utilisateur";
|
||||||
|
$h++;
|
||||||
|
|
||||||
|
dolibarr_fiche_head($head, $hselected);
|
||||||
|
|
||||||
|
|
||||||
print '<table class="border" width="100%" cellpadding="3" cellspacing="0">';
|
print '<table class="border" width="100%" cellpadding="3" cellspacing="0">';
|
||||||
|
|
||||||
print "<tr>".'<td width="25%" valign="top">Nom</td>';
|
print "<tr>".'<td width="25%" valign="top">Nom</td>';
|
||||||
print '<td width="25%" class="valeur">'.$fuser->nom.'</td>';
|
print '<td width="25%" class="valeur">'.$fuser->nom.'</td>';
|
||||||
print '<td>Droits</td></tr>';
|
print '<td width="25%" valign="top">Prénom</td>';
|
||||||
|
|
||||||
print "<tr>".'<td width="25%" valign="top">Prénom</td>';
|
|
||||||
print '<td width="25%" class="valeur">'.$fuser->prenom.'</td>';
|
print '<td width="25%" class="valeur">'.$fuser->prenom.'</td>';
|
||||||
if (defined("MAIN_MODULE_WEBCALENDAR"))
|
print '</tr>';
|
||||||
|
|
||||||
|
print "<tr>".'<td width="25%" valign="top">Login</td>';
|
||||||
|
print '<td width="25%" class="valeur">'.$fuser->login.'</td>';
|
||||||
|
print '<td width="25%" valign="top">Email</td>';
|
||||||
|
print '<td width="25%" class="valeur"><a href="mailto:'.$fuser->email.'">'.$fuser->email.'</a></td></tr>';
|
||||||
|
|
||||||
|
print "<tr>".'<td width="25%" valign="top">Administrateur</td>';
|
||||||
|
print '<td colspan="3" class="valeur">'.$yn[$fuser->admin].'</td>';
|
||||||
|
|
||||||
|
print "<tr>".'<td width="25%" valign="top">Id Société</td>';
|
||||||
|
print '<td colspan="3" class="valeur">'.$fuser->societe_id.' </td></tr>';
|
||||||
|
|
||||||
|
print "<tr>".'<td width="25%" valign="top">Fiche contact</td>';
|
||||||
|
print '<td colspan="3" valign="top">';
|
||||||
|
if ($fuser->contact_id)
|
||||||
{
|
{
|
||||||
print '<td valign="top" rowspan="7">';
|
print '<a href="../comm/people.php?contactid='.$fuser->contact_id.'&socid='.$fuser->societe_id.'">Fiche contact</a>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<td valign="top" rowspan="6">';
|
print "Pas de fiche parmi les Contacts";
|
||||||
}
|
}
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
print "<tr>".'<td width="25%" valign="top">Note</td>';
|
||||||
|
print '<td colspan="3" class="valeur">'.nl2br($fuser->note).' </td></tr>';
|
||||||
|
|
||||||
|
|
||||||
|
// Autres caractéristiques issus des autres modules
|
||||||
|
if (defined("MAIN_MODULE_WEBCALENDAR"))
|
||||||
|
{
|
||||||
|
print "<tr>".'<td width="25%" valign="top">Webcal Login</td>';
|
||||||
|
print '<td colspan="3">'.$fuser->webcal_login.' </td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Droits
|
* Droits
|
||||||
*/
|
*/
|
||||||
print '<table width="100%" class="noborder" cellpadding="0" cellspacing="0">';
|
print '<table width="100%" class="noborder" cellpadding="0" cellspacing="0">';
|
||||||
|
print '<tr class="liste_titre"><td>Droits</td><td>Module</td></tr>';
|
||||||
$sql = "SELECT r.libelle, r.module FROM ".MAIN_DB_PREFIX."rights_def as r, ".MAIN_DB_PREFIX."user_rights as ur";
|
$sql = "SELECT r.libelle, r.module FROM ".MAIN_DB_PREFIX."rights_def as r, ".MAIN_DB_PREFIX."user_rights as ur";
|
||||||
$sql .= " WHERE ur.fk_id = r.id AND ur.fk_user = ".$fuser->id. " ORDER BY r.id ASC";
|
$sql .= " WHERE ur.fk_id = r.id AND ur.fk_user = ".$fuser->id. " ORDER BY r.id ASC";
|
||||||
$var = True;
|
$var = True;
|
||||||
@ -296,97 +337,54 @@ else
|
|||||||
$var = !$var;
|
$var = !$var;
|
||||||
}
|
}
|
||||||
|
|
||||||
print "<tr $bc[$var]><td>".$obj->libelle . '</td></tr>';
|
print "<tr $bc[$var]><td>".$obj->libelle . '</td><td>'.$obj->module.'</td></tr>';
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
print '</td></tr>';
|
|
||||||
print "<tr>".'<td width="25%" valign="top">Login</td>';
|
|
||||||
print '<td width="25%" class="valeur">'.$fuser->login.'</td></tr>';
|
|
||||||
print "<tr>".'<td width="25%" valign="top">Email</td>';
|
|
||||||
print '<td width="25%" class="valeur"><a href="mailto:'.$fuser->email.'">'.$fuser->email.'</a></td></tr>';
|
|
||||||
if (defined("MAIN_MODULE_WEBCALENDAR"))
|
|
||||||
{
|
|
||||||
print "<tr>".'<td width="25%" valign="top">Webcal Login</td>';
|
|
||||||
print '<td width="25%" class="valeur">'.$fuser->webcal_login.' </td></tr>';
|
|
||||||
}
|
|
||||||
print "<tr>".'<td width="25%" valign="top">Administrateur</td>';
|
|
||||||
print '<td width="25%" class="valeur">'.$yn[$fuser->admin].'</td></tr>';
|
|
||||||
|
|
||||||
print "<tr>".'<td width="25%" valign="top">Id Société</td>';
|
|
||||||
print '<td width="25%" class="valeur">'.$fuser->societe_id.' </td></tr>';
|
|
||||||
print "<tr>".'<td width="25%" valign="top">';
|
|
||||||
if ($fuser->contact_id)
|
|
||||||
{
|
|
||||||
print '<a href="../comm/people.php?contactid='.$fuser->contact_id.'&socid='.$fuser->societe_id.'">Fiche contact</a>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print " ";
|
|
||||||
}
|
|
||||||
print '</td>';
|
|
||||||
print '<td width="25%" class="valeur"> </td></tr>';
|
|
||||||
|
|
||||||
print "<tr>".'<td width="25%" valign="top">Note</td>';
|
|
||||||
print '<td colspan="3" class="valeur">'.nl2br($fuser->note).' </td></tr>';
|
|
||||||
|
|
||||||
print '</table>';
|
|
||||||
/*
|
/*
|
||||||
* Barre d'action
|
* Barre d'actions
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
print '<br><table id="actions" width="100%" border="1" cellspacing="0" cellpadding="2">'."<tr>";
|
print '<div class="tabsAction">';
|
||||||
|
|
||||||
if ($user->admin)
|
if ($user->admin)
|
||||||
{
|
{
|
||||||
print '<td width="20%" align="center"><a href="fiche.php?action=edit&id='.$fuser->id.'">Editer</a></td>';
|
print '<a class="tabAction" href="fiche.php?action=edit&id='.$fuser->id.'">Editer</a>';
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<td width="20%" align="center">-</td>';
|
|
||||||
}
|
|
||||||
print '<td width="20%" align="center">-</td>';
|
|
||||||
|
|
||||||
if ($user->id == $id or $user->admin)
|
if ($user->id == $id or $user->admin)
|
||||||
{
|
{
|
||||||
print '<td width="20%" align="center"><a href="fiche.php?action=password&id='.$fuser->id.'">Nouveau mot de passe</a></td>';
|
print '<a class="tabAction" href="fiche.php?action=password&id='.$fuser->id.'">Modifier mot de passe</a>';
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<td width="20%" align="center">-</td>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user->admin)
|
if ($user->admin)
|
||||||
{
|
{
|
||||||
print '<td width="20%" align="center"><a href="fiche.php?request=perms&id='.$fuser->id.'">Permissions</a></td>';
|
print '<a class="tabAction" href="fiche.php?action=perms&id='.$fuser->id.'">Permissions</a>';
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<td width="20%" align="center">-</td>';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if ($user->admin && $user->id <> $id)
|
if ($user->admin && $user->id <> $id)
|
||||||
{
|
{
|
||||||
print '<td width="20%" align="center"><a href="fiche.php?request=delete&id='.$fuser->id.'">Supprimer</a></td>';
|
print '<a class="tabAction" href="fiche.php?action=delete&id='.$fuser->id.'">Supprimer utilisateur</a></td>';
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<td width="20%" align="center">-</td>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</tr></table><br>';
|
print '</div>';
|
||||||
|
print "<br>\n";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* Edition */
|
/* Edition */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
if ($action == 'edit' && $user->admin && !$fuser->societe_id)
|
if ($action == 'edit' && $user->admin && !$fuser->societe_id)
|
||||||
{
|
{
|
||||||
print '<hr><div class="titre">Edition de l\'utilisateur</div><br>';
|
print_fiche_titre("Edition fiche utilisateur",$message);
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
print '<form action="'.$PHP_SELF.'?id='.$id.'" method="post">';
|
print '<form action="'.$PHP_SELF.'?id='.$id.'" method="post">';
|
||||||
print '<input type="hidden" name="action" value="update">';
|
print '<input type="hidden" name="action" value="update">';
|
||||||
print '<table class="border" border="1" cellpadding="3" cellspacing="0">';
|
print '<table class="border" border="1" cellpadding="3" cellspacing="0">';
|
||||||
@ -411,7 +409,7 @@ else
|
|||||||
print "<tr>".'<td valign="top">Login Webcal</td>';
|
print "<tr>".'<td valign="top">Login Webcal</td>';
|
||||||
print '<td class="valeur"><input size="30" type="text" name="webcal_login" value="'.$fuser->webcal_login.'"></td></tr>';
|
print '<td class="valeur"><input size="30" type="text" name="webcal_login" value="'.$fuser->webcal_login.'"></td></tr>';
|
||||||
|
|
||||||
print "<tr>".'<td valign="top">Description</td><td>';
|
print "<tr>".'<td valign="top">Note</td><td>';
|
||||||
print "<textarea name=\"note\" rows=\"12\" cols=\"40\">";
|
print "<textarea name=\"note\" rows=\"12\" cols=\"40\">";
|
||||||
print $fuser->note;
|
print $fuser->note;
|
||||||
print "</textarea></td></tr>";
|
print "</textarea></td></tr>";
|
||||||
@ -423,8 +421,6 @@ else
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user